Re: Error from running SOAP UI example for X-PAY TOKEN

New Contributor

Error from running SOAP UI example for X-PAY TOKEN

{"responseStatus":{"code":"9101","severity":"ERROR","info":"","status":401,"message":"Token validation failed"}}

I ran this code:


import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
def hmac(String secretKey, String data) {
Mac mac = Mac.getInstance("HmacSHA256")
SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes(), "HmacSHA256")
byte[] digest = mac.doFinal(data.getBytes())
return digest
def sharedSecret = ‘VALUE_OF_YOUR_SHARED_SECRET’
def URI = "helloworld"
def QS = "apikey="+APIKey
def timeStampUTC = String.valueOf(System.currentTimeMillis().intdiv(1000L))
def payload = ""
def HMACDigest = hmac(sharedSecret, timeStampUTC + URI + QS + payload)
def encodedDigest = HMACDigest.encodeHex().toString()
def XPayToken = "xv2:"+ timeStampUTC + ":" + encodedDigest
testRunner.testCase.setPropertyValue("xpayToken", XPayToken)


I followed your instructions to the T and get this error. Please advice what I need to do.

(I only changed  APIKey and sharedSecret)

Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Error from running SOAP UI example for X-PAY TOKEN

Hi @petablue,

I recommend using the VDC Playground tool to test X-Pay Token. You can find the guide on Getting Started with VDC Playground from this blog post here -


Here's my setup for reference:




1. Select Auth Method as X-Pay Token.

2. Get the API Key and Shared Secret from VDP Dashboard  > Credentials section.

3. Provide the API key as part of query parameter on the API End Point.

4. Provide the Shared Secret in the settings input field.


Hope this helps.


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