RsaOaep256 Encryption - CyberSource Flex API
Hello everyone, i am trying to develop a proof of concept use the Cybersource Rest API .
Right now i am following this documentation to implement.
The First step about the Generate Key is working just fine, but the next step Tokenize a Card, i am facing a problem with the required Card Info.
In the documentation the JSON Body request this format
{
But if a Post my request using this JSON format i have a JSON Format response warning me about the error, so i change the Json Body to
{
"keyId": "08Q9LVyAGl04sMGMxytx2nw5YIOrWWuy",
"cardInfo": {
"cardNumber": "ejbhIpMEgYnIODcB4//rrVxMHrqHcnLD6pDRF36jlEk72bETAfiOoxmpI9pGiidqMmkgAnvJfVgR3CLAV5EdG4Mu5IWK26QRnVtwvsVEUtpah7IylbxV9MLvXh2FjIJskKCWNLidb1G4PN5963hnV3IoZd2pF99JwV9lPhOHT5ymlNeg7sTzQQDN1I0/yJApds+t79hl9QVp4PusUDfSsPQTtR2frzlH4V3W+XjHDhmy5oNhiUaVxv27cyG1SWeCKkVC9tc8zLy4pvlgoplrLV8JRaS9hfWalJjv2xtk3DXmNT2urtFv2evcI3LM/S29KlJjPXZcBp0IYyB/taunCA==",
"cardType": "001"
}
}
Second Issue
Now i need to encrypt the Card info using an algorithm as visa Api inform, "If the encryption type of RsaOaep256 was used in the Generate Key request, this value needs to be the RSA OAEP 256 encrypted card number."
How can i format the credit card info using this algorithm? I look to some examples on the internet but there's few information about how to deal with it.
If I try to post the same creditcard that the documentation provide, the API return an error.
Body from my HTTP
{
"keyId": "08Q9LVyAGl04sMGMxytx2nw5YIOrWWuy",
"cardInfo": {
"cardNumber": "ejbhIpMEgYnIODcB4//rrVxMHrqHcnLD6pDRF36jlEk72bETAfiOoxmpI9pGiidqMmkgAnvJfVgR3CLAV5EdG4Mu5IWK26QRnVtwvsVEUtpah7IylbxV9MLvXh2FjIJskKCWNLidb1G4PN5963hnV3IoZd2pF99JwV9lPhOHT5ymlNeg7sTzQQDN1I0/yJApds+t79hl9QVp4PusUDfSsPQTtR2frzlH4V3W+XjHDhmy5oNhiUaVxv27cyG1SWeCKkVC9tc8zLy4pvlgoplrLV8JRaS9hfWalJjv2xtk3DXmNT2urtFv2evcI3LM/S29KlJjPXZcBp0IYyB/taunCA==",
"cardType": "001"
}
}
Response
{
"responseStatus": {
"status": 400,
"reason": "DECRYPTION_ERROR",
"message": "Cannot decrypt PAN (RsaOaep256): data hash wrong",
"correlationId": null,
"details": [],
"_embedded": {}
},
"_links": {
"self": null,
"documentation": [],
"next": []
}
}
Hi Jefferson,
Thank you for your interest in the CyberSource API. In addition to below, what you are seeing in the reference for the CyberSource
API and its related sample request is that there is a discrepancy in the information. On the API reference, we have cardInfo, however in the sample request we have cardDetails.
One of the two needs to be updated and, most likely, it will be the sample request. We are currently working on resolving this issue by publishing the correct sample request information on the portal.
Please let me know if you have other questions or you can submit another case to developer@visa.com.
Thank You,
Vaibhav
Hi
I am also facing the same error. Do we have a sloution to this. Where can I find the updated working sample JSON