Decrypted consumer data
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Decrypted consumer data
Hello,
I'm trying to figure out how to decrypt the consumer data after getting V.on("payment.success"....)
I'm using Node.js and I used the decryption algorithm provided in the docs.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Decrypted consumer data
Hey @julialiebs,
Can you please confirm the API product that your query relates to so that we can provide you with further assistance? Please take a look at our website for APIs relevant to your business case. We are happy to help.
https://developer.visa.com/
https://developer.visa.com/apibrowser
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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Decrypted consumer data
This is using the Get Payment Info API when decrypting consumer information by using the following sample code:
The following Node.js JavaScript code provides an example of decrypting the payload:
const crypto = require('crypto');
module.exports = { decryptPayload: function(key,wrappedKey,payload){
let decryptedKey = decrypt(wrappedKey,key); let decryptedMsg = decrypt(payload,decryptedKey); return decryptedMsg.toString('utf8'); }}
function decrypt(encrypted,key){ let encryptedBuffer = new Buffer(encrypted,'base64'); // TODO: Check that data(encryptedBuffer) is at least bigger // than HMAC + IV length , i.e. 48 bytes let hmac = new Buffer(32); let iv = new Buffer(16); encryptedBuffer.copy(hmac,0,0,32); encryptedBuffer.copy(iv,0,32,48); let data = Buffer.from(encryptedBuffer).slice(48);
var hash = crypto.createHmac('SHA256', key).update (Buffer.concat([iv,data])).digest(); if(!hmac.equals(hash)){
// TODO: Handle HMAC validation failure
return ''; }
let decipher = crypto.createDecipheriv('aes-256-cbc', crypto.createHash('sha256').update(key).digest(), iv); let decryptedData = Buffer.concat([decipher.update(data), decipher.final()]); return decryptedData;
}
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Decrypted consumer data
Hey @julialiebs,
I'm happy to help you get in touch with a Visa Checkout Partner. Currently, you'll have to work with a partner to integrate Visa Checkout into your project.
Please find a list of Partners to integrate with Visa Checkout using this link here: https://globalcheckout.visa.com/visacheckoutPartners
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.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Decrypted consumer data
Thanks for your response. I'm hoping to not use a partner, since I am not planning on using this to actually process card data, it's just for the learning process. Is there a way to just create this in a sandbox environment?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Decrypted consumer data
Hey @julialiebs,
Please reach out to a Visa Checkout Partner using this link here if you have any questions about Visa Checkout: https://globalcheckout.visa.com/visacheckoutPartners