AnsweredAssumed Answered

"Token not found" error using LitleSdkForNet

Question asked by dov765 on Feb 23, 2020

Our company has been using Little/Vantiv/WorldPay to process payments for a couple of years, without any major issues. For the past few days we've been getting many failed transactions with the error "Token not found".

 

Maybe something changed on WorldPay's side?

Maybe we need to change our code?

 

We use the LitleSdkForNet API to post payments. 

Our LitleSdkForNet version is 9.12.6.0.

 

We submit the transaction in 2 steps:

1) On client-side - get the paypageRegistrationId.

2) On the server - post the payment using the LitleSdkForNet API.

 

Below is our code:

 

1) Here is the client side - where we get the paypageRegistrationId:

 

<script src="https://request.eprotect.vantivcnp.com/eProtect/litle-api3.js" type="text/javascript"></script>
<script type="text/javascript">
   
var payPageid; // set from internal data

   
function setLitleResponseFields(response) {
      document.getElementById('response$code').value = response.response;
      document.getElementById('response$message').value = response.message;
      document.getElementById('response$responseTime').value = response.responseTime;
      document.getElementById('response$litleTxnId').value = response.litleTxnId;
      document.getElementById('response$type').value = response.type;
      document.getElementById('paypageRegistrationId').value = response.paypageRegistrationId;
      document.getElementById('lastFourDigits').value = response.lastFour;
   }

   function getPayPageRegistrationId() {
      var litleRequest = {
         "paypageId": payPageid,
         "reportGroup": document.getElementById("request$reportGroup").value,
         "orderId": document.getElementById("request$orderId").value,
         "id": document.getElementById("request$merchantTxnId").value,
         "url""https://request.eprotect.vantivcnp.com"
      
};

      var formFields = {
         "accountNum": document.getElementById('CardNumber'),
         "cvv2": document.getElementById('CVV'),
         "paypageRegistrationId": document.getElementById('response$paypageRegistrationId'),
         "bin": document.getElementById('response$bin')
      };

      new LitlePayPage().sendToLitle(litleRequest, formFields, setLitleResponseFields, onErrorAfterLitle, timeoutOnLitle, 5000);
   }
</script>

2) Here is the server side where we send the payment. This is in C#:

 

private void sendTransaction()
{
   sale sale = new sale();
   sale.orderId = "|" + clientId + "|";
   sale.amount = amount;
   sale.processingType = processingType.initialCOF;
   sale.orderSource = orderSourceType.ecommerce;

   contact billToContactInfo = new contact();
   billToContactInfo.name = nameOnCard;
   billToContactInfo.firstName = clientFirstName;
   billToContactInfo.lastName = clientLastName;
   billToContactInfo.addressLine1 = clientStreetLine1;
   billToContactInfo.addressLine2 = clientStreetLine2;
   billToContactInfo.city = clientCity;
   billToContactInfo.state = clientState;
   billToContactInfo.zip = clientZipCode;
   billToContactInfo.phone = clientPhone;
   billToContactInfo.country = countryTypeEnum.US;
   sale.billToAddress = billToContactInfo;

   // paypageRegistrationId is taken from JavaScript in client-side
   
string paypageRegistrationId;

   if (string.IsNullOrWhiteSpace(paypageRegistrationId) || paypageRegistrationId.Length == 88)
   {
      cardPaypageType card = new cardPaypageType();
      card.type = clientCard.CardType;
      card.expDate = clientCard.ExpirationMonth + clientCard.ExpirationYear.Substring(2, 2);
      card.cardValidationNum = "000";
      card.paypageRegistrationId = paypageRegistrationId;
      sale.paypage = card;
   }
   else
   {
      cardTokenType card = new cardTokenType();
      card.type = clientCard.CardType;
      card.expDate = clientCard.ExpirationMonth + clientCard.ExpirationYear.Substring(2, 2);
      card.cardValidationNum = "000";
      card.litleToken = paypageRegistrationId;
      sale.token = card;
   }

   // internal data
   
string userName;
   string merchantId;
   string password;

   Dictionary<stringstring> config = new Dictionary<stringstring>();
   config.Add("url""https://payments.vantivcnp.com/vap/communicator/online");
   config.Add("reportGroup""Default Report Group");
   config.Add("username", userName);
   config.Add("version""8.13");
   config.Add("timeout""65");
   config.Add("merchantId", merchantId);
   config.Add("password", password);
   config.Add("printxml""true");
   config.Add("logFile""C:\\LitleLog.xml");
   config.Add("neuterAccountNums""true");

   try
   
{
      LitleOnline litle = new LitleOnline(config);
      saleResponse litleResponse = litle.Sale(sale);
   }
   catch (Exception ex)
   {
      // here we get the error: "Token was not found"
   
}
}

 

Here is an example transaction from today, it is taken from our log file LitleLog.xml:

 

02/22/2020 16:48:25

<?xml version='1.0' encoding='utf-8'?>

<litleOnlineRequest merchantId="07144346" version="9.14" merchantSdk="DotNet;9.14" xmlns="http://www.litle.com/schema">

    <authentication>

    <user>MCOFFICE</user>

    <password>*******</password>

    </authentication>

    <sale id="" reportGroup="Default Report Group">

    <orderId>|4918825|</orderId>

    <amount>101</amount>

    <orderSource>ecommerce</orderSource>

    <billToAddress>

    <name>Dov Test1</name>

    <firstName>Dov</firstName>

    <lastName>Test1</lastName>

    </billToAddress>

    <token>

    <litleToken>1045415648011842473</litleToken>

    <expDate>0620</expDate>

    <cardValidationNum>000</cardValidationNum>

    <type>VI</type>

    </token>

    </sale>

</litleOnlineRequest>

 

02/22/2020 16:48:25

<litleOnlineResponse version="9.14" xmlns="http://www.litle.com/schema"

    response="0" message="Valid Format">

    <saleResponse id="" reportGroup="Default Report Group">

        <litleTxnId>820256055035115126</litleTxnId>

        <orderId>|4918825|</orderId>

        <response>822</response>

        <responseTime>2020-02-22T21:48:25</responseTime>

        <postDate>2020-02-22</postDate>

        <message>Token was not found</message>

        <fraudResult>

            <avsResult>34</avsResult>

        </fraudResult>

    </saleResponse>

</litleOnlineResponse>

 

 

Any help would be appreciated!

Thanks,

 

Dov

Outcomes