Enroll PAN api testing in Sandbox Account.

rabbicse06
Regular Visitor

Enroll PAN api testing in Sandbox Account.

I have faced some problem in Enroll PAN API for sandbox test environment.
How can i find the encPaymentInstrument value as there exists no test data except card number in test data.
 
I am currently receiving the following response code.
Request Body:
{
"clientAppID": "APP1",
"locale": "en_US",
"panSource": "MOBILEAPP",
"encPaymentInstrument": ""
}
 
Response:
{
  "errorResponse": {
    "status": 401,
    "message": "Token Validation Failed",
    "reason": "inputValidationError",
    "details": [
      {
        "location": "x-pay-token"
      }
    ]
  }
 
}
5 REPLIES 5
ricardo_visa
Community Scholar

Re: Enroll PAN api testing in Sandbox Account.

Hi there,

I'm looking into this for you.

Thanks,
Ricardo



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

Re: Enroll PAN api testing in Sandbox Account.

Hi there,

 

There will be no Test data on the portal for this field but In the  VTS guides we have the details on how to get the value for encPaymentInstrument. This is an encrypted value which uses JSON Web Encryption.

 

Find the information here:

https://qaint.vdp.visa.com/products/vts/guides#merchants_and_wallet_providers

 

Let me know how this works out!

 

-Ricardo




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

Re: Enroll PAN api testing in Sandbox Account.

Thanks for your suggestion.
I have already tried with sample data to produce encrypted payment information. I have shared the code snipet that was used to generate (using jose4j and bouncy castle library)
 
Code:
String shared_secret = "$I1l1GKgA3/}Voph-Hm}J8sd9@7XEu0eDo5oo6r1";
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] digest = md.digest(shared_secret.getBytes("UTF-8"));

JsonWebEncryption jwe = new JsonWebEncryption();

// A256GCMKW for key wrap
jwe.setAlgorithmHeaderValue(KeyManagementAlgorithmIdentifiers.A256GCMKW);

// A256GCM for content encryption
jwe.setEncryptionMethodHeaderParameter(ContentEncryptionAlgorithmIdentifiers.AES_256_GCM);

// the key (from above)
jwe.setKey(new SecretKeySpec(digest, "AES"));

// whatever content you want to encrypt
jwe.setPayload("{\"accountNumber\":\"4957031040790002\",\"cvv2\":\"758\",\"billingAddress\":{\"country\":\"BAN\"},\"name\":\"Rabbi\",\"expirationDate\":{\"month\":\"10\",\"year\":\"2020\"}}");


// Produce the JWE compact serialization, which is where the actual encryption is done.
// The JWE compact serialization consists of five base64url encoded parts
// combined with a dot ('.') character in the general format of
// <header>.<encrypted key>.<initialization vector>.<ciphertext>.<authentication tag>
String serializedJwe = jwe.getCompactSerialization();
-------------------------------------------------------------------------------- 
 
But the output i received is "eyJhbGciOiJBMjU2R0NNS1ciLCJlbmMiOiJBMjU2R0NNIiwiaXYiOiJOcFZ5UW9Sb0lYZERiTXBVIiwidGFnIjoiOXYyYlM2dDByM0dORm55ZGd3SldOdyJ9.TVME0j9MVYct95P_juiAHXSJGE1gAWupG8KYpzIO19A.Iz_ULcaT7pHeQlcg.iqvuloANeaHxLA8su5dWzt9iGCpWsyxt5XdlONMLgylcMvyadnBH3wFX5pEnyG2wLBO-J-N5Cih2f5tl7jp19s_d4R1VUNat6keSoN36KXrKqsJtro9-C7njckXrP0ap6GsMILaN33KLuHJSMhoLvyVp5AgsYk8dLARmEPE8Bhk4UUMj4efkv_OmbZgWS09kSQ.xRV4VxN-93x756TCL67EIw"
 
With this while requesting for enroll pan it respond with token validation failed.
Request:
{
"clientAppID": "MyWallet",
"locale": "en_US",
"panSource": "MOBILEAPP",
"encPaymentInstrument": "eyJhbGciOiJBMjU2R0NNS1ciLCJlbmMiOiJBMjU2R0NNIiwiaXYiOiJOcFZ5UW9Sb0lYZERiTXBVIiwidGFnIjoiOXYyYlM2dDByM0dORm55ZGd3SldOdyJ9.TVME0j9MVYct95P_juiAHXSJGE1gAWupG8KYpzIO19A.Iz_ULcaT7pHeQlcg.iqvuloANeaHxLA8su5dWzt9iGCpWsyxt5XdlONMLgylcMvyadnBH3wFX5pEnyG2wLBO-J-N5Cih2f5tl7jp19s_d4R1VUNat6keSoN36KXrKqsJtro9-C7njckXrP0ap6GsMILaN33KLuHJSMhoLvyVp5AgsYk8dLARmEPE8Bhk4UUMj4efkv_OmbZgWS09kSQ.xRV4VxN-93x756TCL67EIw"
}
response:
{
"errorResponse": {
"status": 401,
"message": "Token Validation Failed",
"reason": "inputValidationError",
"details": [
{
"location": "x-pay-token"
}
]
}
}
 
Please suggest and if there any library or sdk for Visa TSP?
WillieBurgerICS
Regular Visitor

Re: Enroll PAN api testing in Sandbox Account.

Hi,

 

I am batteling with the exact same problem but from C#.

 

I have assembled this method below but the error received is the same as which you did and I would like to know if you ever managed to get past this issue?

 

Any help will be greatly appreciated.

 

public static string JWEEncodeJose(string message,string key, string secret)
{

HMACSHA256 hmacsha256 = new HMACSHA256();
var keyToUse = hmacsha256.ComputeHash(Encoding.ASCII.GetBytes(secret));

long expireTime = ((long)DateTime.UtcNow.AddHours(1).Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds) / 1000;

var extraHeaders = new Dictionary<string, object>()
{
{ "kid", key },
{ "iat", expireTime.ToString() }
};

string result = Jose.JWT.Encode(message, keyToUse, JweAlgorithm.A256GCMKW, JweEncryption.A256GCM,extraHeaders: extraHeaders);
return result;
}

myrestlife2012
Occasional Visitor

Re: Enroll PAN api testing in Sandbox Account.

did anybody resolved this?