3. Initiate Pay
Once the merchant request has been verified, this API is used to safely handle payment requests by encrypting card data using AES and RSA encryption.
API Endpoints
https://kwpaypg.casheer.com/COFWAY/InitiatePayhttps://kwpaypgsb.casheer.com/COFWAY/InitiatePaySample Request & Response
The following fields ought to be included in the request body:
"Initiate pay request{
"ReferenceId" : "xxxxxxxxx"
"MerchantId": xxxxxx,
"ECardData" = "encryptedCard",
32BIT AES Encryption
"ECardKey" = "encryptedKey",
"ACS_CallbackURL"= "call back url for 3DS"+ReferenceId
}
}; {
"errorCode": 0,
"errorMessgae": "SUCCESS",
"result": {
"authentication": {
"the3Ds1": null,
"the3Ds2": null,
"acceptVersions": null,
"channel": null,
"purpose": null,
"redirect": {
"customized": null,
"domainName": "ap.gateway.mastercard.com",
"html": "<div id=\"threedsChallengeRedirect\" xmlns=\"http://www.w3.org/1999/html\" style=\"height: 100vh\"> <form id =\"threedsChallengeRedirectForm\" method=\"POST\" action=\"https://ap.gateway.mastercard.com/acs/mastercard/v2/prompt\" target=\"challengeFrame\"> <input type=\"hidden\" name=\"creq\" value=\"eyJ0aHJlZURTU2VydmVyVHJhbnNJRCI6IjNmN2E4MmVjLTEzZjYtNDg2Ni05ODVjLTlkOTgxZjIzMGQ0OSJ9\" /> </form> <iframe id=\"challengeFrame\" name=\"challengeFrame\" width=\"100%\" height=\"100%\" ></iframe> <script id=\"authenticate-payer-script\"> var e=document.getElementById(\"threedsChallengeRedirectForm\"); if (e) { e.submit(); if (e.parentNode !== null) { e.parentNode.removeChild(e); } } </script> </div>"
},
"redirectHtml": null,
"version": "3DS2",
"the3Ds": null,
"method": "OUT_OF_BAND",
"payerInteraction": null
}
}
}ReferenceId
String
15-digit reference id received in the validate requet response
MerchantId
String
Merchant code provided by PSP
ECardData
String
The card data encrypted using AES encryption with a 32-bit key. Explained below
Explanation of the ECardData Encryption Object
ECardData Encryption ObjectThe ECardData field in the request is an encrypted representation of the sensitive card details. The following explains the object that is encrypted using AES encryption before being included in the API request:
Sample code to encrypt ECardData
ACS_CallbackURL
The provider will handle the 3D Secure callback if it is empty, and the user will be sent to the callback URL that was supplied in step 1. For more info about redirection refer here.
If provided, the 3D Secure callback will be sent to the merchant's specified URL, and the merchant must call the API at here for further processing.
Response Explaination
Upon receiving the response from the InitiatePay API, the merchant must verify the errorCode to determine the next steps. If the errorCode is 0, indicating a successful initiation, the merchant should parse the result object and render the HTML content provided in result.redirect.html to proceed with the 3DS authentication process.
Last updated