Add 3DS Fields in Sale API (Flows A, B)
At this point, the required 3DS values for the Sale API have been received either from:
- The Initialisation API response;
- The Get Result API response.
The required Sale 3DS fields
The required 3ds properties to go inside the Sale payload are:
-
dsTransactionId -
eci -
cavv -
version
This is how they are mapped to the 3DS values in either the Initialisation API response (Flow A), or the Get Result API response (Flow B).
dsTransactionId>>threeDs2TransactionIdeci>>ecicavv>>cavvversion>>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"
}
}