Step 6: Add 3DS fields in Sale API
At this point, the required 3DS values for the Sale API have been received either from:
The Get Result API response
OR
The Auth API response - if it is a frictionless transaction.
The required Sale 3DS fields
The required 3ds properties to go inside the Sale payload are
1. dsTransactionId
2. eci
3. cavv
4. version
This is how they are mapped to the 3Ds values in either the Auth API response, or the Get Result API response.
dsTransactionId
>>threeDs2TransactionId
eci
>>eci
cavv
>>cavv
version
>>threeDsVersion
Here is a handy Javascript function to map the response:
function mapThreeDsVals(response){
const eci = response.threeDSProviderResponse.eci;
const cavv = response.threeDSProviderResponse.cavv;
const dsTransactionId = response.threeDSProviderResponse.threeDs2TransactionId;
const version = response.threeDSProviderResponse.threeDsVersion;
const threeDsVals = { dsTransactionId, eci, cavv, version };
return threeDsVals;
}
Create the Sale API request payload
To perform the SALE, read the API docs here.
Add the 3DS values into the Sale API request payload like so:
const threeDsVals = mapThreeDsVals(resultResponse);
const salePayload = {
... // the required sale api fields
3DS: threeDsVals
}
Example:
{
...// the required sale api fields
"3DS": {
"dsTransactionId":"cadd2f53-9401-498c-9306-8ca28bca1a6a",
"eci": "05",
"cavv": "AJkBBQiQcSiQAAAAJ5BxAAAAAAA=",
"version": "2.1.0"
}
}