Token Validation Failed. Code 9159.

Regular Visitor

Token Validation Failed. Code 9159.

We're trying to implement Funds Transfer API.

We use the same way of generation authorization token as with and with "helloworld" it works great, but in case of using Funds Transfer API, I get:


    "responseStatus": {
        "status": 401,
        "code": "9159",
        "severity": "ERROR",
        "message": "Token Validation Failed",
        "info": ""



API Key and Shared secred are copied from "Credentials" page in the project dashboard.

Please assist on how we can solve this issue.
Thank you in advance.


Our request data:

Method: POST







Pre-request script:


var sharedSecret = "{{X-PAY Token shared secret}}";
var body = JSON.stringify(;
var resourcePath = "fundstransfer/v1/pullfundstransactions";
var queryParams = "apiKey={{API_Key}}";
var timestamp = Math.floor( / 1000);
var preHashString = timestamp + resourcePath + queryParams + body;  
var hashString = CryptoJS.HmacSHA256(preHashString, sharedSecret).toString(CryptoJS.enc.Hex);
var xPayToken = 'xv2:' + timestamp + ':' + hashString;
pm.collectionVariables.set("xPayToken", xPayToken);



Body (Taken from Sandbox example):


  "surcharge": "11.99",
  "amount": "124.02",
  "localTransactionDateTime": "2023-05-05T12:00:00",
  "cpsAuthorizationCharacteristicsIndicator": "Y",
  "riskAssessmentData": {
    "traExemptionIndicator": true,
    "trustedMerchantExemptionIndicator": true,
    "scpExemptionIndicator": true,
    "delegatedAuthenticationIndicator": true,
    "lowValueExemptionIndicator": true
  "colombiaNationalServiceData": {
    "addValueTaxReturn": "10.00",
    "taxAmountConsumption": "10.00",
    "nationalNetReimbursementFeeBaseAmount": "20.00",
    "addValueTaxAmount": "10.00",
    "nationalNetMiscAmount": "10.00",
    "countryCodeNationalService": "170",
    "nationalChargebackReason": "11",
    "emvTransactionIndicator": "1",
    "nationalNetMiscAmountType": "A",
    "costTransactionIndicator": "0",
    "nationalReimbursementFee": "20.00"
  "cardAcceptor": {
    "address": {
      "country": "USA",
      "zipCode": "94404",
      "county": "081",
      "state": "CA"
    "idCode": "ABCD1234ABCD123",
    "name": "Visa Inc. USA-Foster City",
    "terminalId": "ABCD1234"
  "acquirerCountryCode": "840",
  "acquiringBin": "408999",
  "senderCurrencyCode": "USD",
  "retrievalReferenceNumber": "330000560031",
  "addressVerificationData": {
    "street": "XYZ St",
    "postalCode": "12345"
  "cavv": "0700100038238906000013405823891061668252",
  "systemsTraceAuditNumber": "452012",
  "businessApplicationId": "AA",
  "senderPrimaryAccountNumber": "4003974278332156",
  "settlementServiceIndicator": "9",
  "visaMerchantIdentifier": "73625198",
  "foreignExchangeFeeTransaction": "11.99",
  "senderCardExpiryDate": "2023-10",
  "nationalReimbursementFee": "11.22"



Community Moderator

Re: Token Validation Failed. Code 9159.

Hi, @Y_Varshavskyi. Thank you for reaching out! An agent is looking into this and will get back to you shortly. Until then, if any community members know a solution, please reply to this thread.

Visa Developer Support Specialist

Re: Token Validation Failed. Code 9159.

Hi @Y_Varshavskyi,


Before sandbox testing the Visa Direct API, please refer to the Visa Direct getting started page where there are important requirements that you'll have to meet in order to use Visa Direct. The requirements are listed in the box with the exclamation mark. Here's the link to Visa Direct for you to review the requirements -  



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.