Customer Rules Registration, always return 9159

Solved! Go to solution
JavierSivack
Regular Contributor

Customer Rules Registration, always return 9159

Hello,

I'm having problems trying to test the customer rules registration api.

I had downloaded the Helloworld postman x-pay token example, it works,  then I have changed it to hit the customer rules registration.

So my

Post URL looks like: https://sandbox.api.visa.com/vctc/customerrules/v1/consumertransactioncontrols?apiKey=xxx

Header: x-pay-token {{x-pay-token}}

Body raw: {"primaryAccountNumber": "498649053823XXXX"}

pre-request script looks like these:

 

var resourcePath = '/vctc/customerrules/v1/consumertransactioncontrols';
var queryParams = 'apiKey=xxx';
var sharedSecret = 'xxx';
var postBody = '{"primaryAccountNumber": "498649053823XXXX"}';

var timestamp = Math.floor(Date.now() / 1000);
var preHashString = timestamp + resourcePath + queryParams + postBody;
var hashString = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(preHashString, sharedSecret));
var xPayToken = 'xv2:' + timestamp + ':' + hashString;

postman.setEnvironmentVariable('x-pay-token', xPayToken);

 

And I'm getting this response:

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

 

I already tried resourcePath like: core/customer, only customer, and consumertransactioncontrols but nothing works.

 

What I'm doing wrong?

 

Thanks 

Javier.


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
16 REPLIES 16
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Customer Rules Registration, always return 9159

Hi @JavierSivack,

 

Can you please share the follow details:

  1. Request Header
  2. Request Body
  3. Response Header (include the x-correlation-id)
  4. Response Body

Please also reference the X-Pay-Token Guide to assist with troubleshooting.


Best,
Stacey

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

Re: Customer Rules Registration, always return 9159

Hi Stacey,

Thank you for the response.

Here is the postman raw log (I have deleted de tokens and keys and replaced them by xxx):

POST /vctc/customerrules/v1/consumertransactioncontrols?apiKey=xxx HTTP/1.1
x-pay-token: xv2:xxx
Accept: application/json
Content-Type: application/json
User-Agent: PostmanRuntime/7.28.3
Postman-Token: ac3c4faf-2345-4c3a-b0c3-d0830410f382
Host: sandbox.api.visa.com
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 44
 
{"primaryAccountNumber": "498649053823XXXX"}
 
HTTP/1.1 401 Unauthorized
Server: nginx
Date: Fri, 13 Aug 2021 12:17:23 GMT
Content-Type: application/json
Content-Length: 112
Connection: keep-alive
X-SERVED-BY: l73c013
X-CORRELATION-ID: 1628857043_758_463564656_l73c013_VDP_WS
x-vdp-normalized-url: /vctc/customerrules/v1/consumertransactioncontrols
X-APP-STATUS: 401
x-vdp-authn-api-visa-id: PMC.100
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000;includeSubdomains
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: -1
 
{"responseStatus":{"status":401,"code":"9159","severity":"ERROR","message":"Token Validation Failed","info":""}}

 and this is the pre-request script:

var resourcePath = 'vctc/customerrules/v1/consumertransactioncontrols';
var queryParams = 'apiKey=xxx';
var sharedSecret = 'xxx';
var postBody = '{"primaryAccountNumber": "498649053823XXXX"}';

var timestamp = Math.floor(Date.now() / 1000);  
var preHashString = timestamp + resourcePath + queryParams + postBody;  
var hashString = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(preHashString, sharedSecret));
var xPayToken = 'xv2:' + timestamp + ':' + hashString;

postman.setEnvironmentVariable('x-pay-token', xPayToken);

 

Thanks in advance,

Javier Sivack


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Customer Rules Registration, always return 9159

Hi @JavierSivack,

 

Thank you for sharing the details and masking sensitive information. It seems the service is currently down and our tech team is investigating the issue. I will share an update as soon as I hear back from the team.


Best,
Stacey

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

Re: Customer Rules Registration, always return 9159

Hi @JavierSivack,

 

Thank you for your patience. The issue has been fixed, please retry and you should get a success response as below:

 

End Point https://sandbox.api.visa.com/vctc/customerrules/v1/consumertransactioncontrols?apikey=N8KUCJUHWL9LZM...

Method POST

 

Request
{"primaryAccountNumber": "498649053823XXXX"}

Response
{
"receivedTimestamp": "2021-08-18 21:14:32.66",
"resource": {
"lastUpdateTimeStamp": "2021-08-18 21:14:17",
"documentID": "ctc-vd-5a3ef463-b854-40d6-b9eb-c40cb399d122",
"createdOnDate": "2021-08-18 21:14:17.590"
},
"processingTimeinMs": 7
}

Response Header
Status Code: 200 OK
Server : nginx
Date : Wed, 18 Aug 2021 21:14:32 GMT
Content-Type : application/json;charset=UTF-8
Content-Length : 227
Connection : keep-alive
X-SERVED-BY : l73c014
X-CORRELATION-ID : 1629321272_595_1125181131_l73c014_VDP_WS
X-APP-STATUS : 200
X-Backside-Transport : OK OK,OK OK
Cache-Control : no-cache, no-store, must-revalidate
Pragma : no-cache
Expires : -1
Accept : application/json
X-Global-Transaction-ID : 458484be611d78388f8be487
X-Frame-Options : SAMEORIGIN
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Content-Language : en-US
Strict-Transport-Security : max-age=2592000;includeSubdomains
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains;always

 


Best,
Stacey

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

Re: Customer Rules Registration, always return 9159

HI Stacy,

Still same problem, error 9159.

 

 


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Customer Rules Registration, always return 9159

Hi @JavierSivack,

 

Can you please confirm the following:

1. Did you create a project in Visa Developer?

2. Did you add VTC to your project?

3. Did you choose the X-Pay-Token authentication method?

4. Are you using the API key and Shared Secret from the credential section of your project dashboard to connect to the VTC API (screenshot below).

X-Pay-Token-Credentials.jpg

 

 


Best,
Stacey

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

Re: Customer Rules Registration, always return 9159

Hi Stacy,

Yes to all.

 Screen Shot 2021-08-19 at 15.35.33.jpegScreen Shot 2021-08-19 at 15.35.10.jpeg


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Customer Rules Registration, always return 9159

Hi @JavierSivack,

 

Would you mind downloading our VDP Playground tool to quickly test your X-Pay Token? The Playground tool is available for download from your project dashboard page. Scroll down to General Assets => ZIP tab. 

 

You can find the guide on Getting Started with VDC Playground from this blog post here - https://developer.visa.com/pages/visa-developer-center-playground

 

Once setup, the VTC API request and response should look like this:

 

VTC_XPayToken_Playground.jpg

 

 


Best,
Stacey

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

Re: Customer Rules Registration, always return 9159

Hi Stacy,

I'm on a Mac, so I think I can't use it, is that true?


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.