julialiebs
Helper

Get Payment Data API

Screen Shot 2020-11-27 at 11.51.28 PM.png

Is it just me or is the get payment data API down? I can't get it to work! I tried testing it out in a browser (separately from my application, in this link: https://developer.visa.com/capabilities/visa_checkout/reference#visa_checkout__get_payment_data_api) and got the response pictured above.

 

When I try to run my own application using the code below I get a 401 Apikey not present 9206 error.

const apiKey='....';
const sharedSecret='...'; //encryption shared secret
const encryptionAPIKey='....;
var queryParams = 'apiKey='+apiKey;
var fullUnhashedString=queryParams+'&encryptionKey='+encryptionAPIKey;
var timestamp = Math.floor(Date.now()/1000);
var resourcePath="payment/data/"+req.body.callid;
var preHashString = timestamp + resourcePath + fullUnhashedString+postBody;
console.log("prehash string is: ");
console.log(preHashString);
var hashString = crypto.createHmac('sha256', sharedSecret).update(preHashString).digest('hex');

var xPayToken = 'xv2:'+timestamp + ':' + hashString;
console.log(hashString);
console.log(xPayToken);
let callId=req.body.callid;
var options = {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'x-pay-token': xPayToken
},
json: true
};

console.log(options);

options.agent = new https.Agent(options);

request.get(options, (err, res, body) => {
if (err) {
return console.log(err);
}
console.log(`Status: ${res.statusCode}`);
console.log(body);
});
res.send('Hello World');
 
please help! Thanks!
1 REPLY 1
DianaTran
Visa Developer Support Specialist

Re: Get Payment Data API

Hey @julialiebs,

 

We're happy to help answer your Visa Checkout query. To integrate the Visa Checkout API into your project, you'll need to work with a partner. Here's a list of Partners to integrate Visa Checkout with: https://globalcheckout.visa.com/visacheckoutPartners 

Please let us know if you have other questions and someone will be happy to help. 

 




Thanks,

Diana



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