How to Implement 3D Secure v2

When 3D Secure v2 is enabled, each REST API real-time transaction call can run through the 3D Secure process before it processes the payment depending on the selected setting. There are 3 settings that are available for you to choose when processing eCommerce transactions.

 

 Please note:

  • Each payment via HPP will always run through the 3D Secure process no matter the setting.

  • 3D Secure is not available when charging a stored card

  • 3D Secure is not compatible with Wallet Payments (Apple Pay and Google Pay)


Real-time Transaction API call

The real-time transaction API (POST Make a live tokenised card transaction) remains the same, except there are now extra fields that become mandatory depending on which 3DS setting you select. There are 3 settings for you to choose from:

 

  • Optional

  • Required

  • Required (eCommerce)


3DS “Optional” Setting

When “Optional” setting is selected, three new fields are required to support 3DS. The three fields are “CallbackUrl”, “BrowserInfo” and “use3ds”. You can decide per transaction if you want to use 3DS or not by making use of the “use3ds” field.

 

 For example:

  • If value of “use3ds” = “true” – 3DS actioned

  • If value of “use3ds” = “false” – no 3DS action

  • If “use3ds” not in body = no 3DS action

  • If no extra fields are supplied = no 3DS action

 

Sample:

POST

{{url}}/businesses/{{business-id}}/transactions/card-payments/token

BODY

{ "ProcessType": "COMPLETE", "Reference": "3DS Testing 212", "Description": "This is an example real-time transaction", "Amount": 100.25, "CallbackUrl": "https://www.payrix.com.au", "use3ds": "true", "BrowserInfo": { "UserAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.106 Safari/537.36", "AcceptHeader": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "Language": "en-GB", "TimeZone": -660, "ColorDepth": 24, "ScreenHeight": 1080, "ScreenWidth": 1920, }, "CardToken": "c698ed0d8ac943188c69d88a439bdce3", "ServiceDate": "2022-03-01T10:00:00+10:00", "Payer": { "email": "test@test.com", }, "Audit": { "Username": "Example-User", "UserIP": "1.2.3.4" } }

 

If you are missing any required fields, it will return a response like the samples below:

{ "errorCode": "BadRequest", "errorMessage": "Your business requires 3-D Secure Authentication so you must provide a CallbackUrl", "errorDetail": "CallbackUrl" }

 


3DS “Required” Setting

When “Required” setting is selected, 3DS is required for all real-time transactions and the 3DS process is mandatory for all transactions. Two extra fields become mandatory for merchants with this setting.

 

The new fields are “CallbackUrl” and “BrowserInfo” – see example below:

 If these fields are not included, you will receive an error and will not progress.

 

Sample

POST

BODY


3DS “Required (eCommerce)” Setting

When “Required (eCommerce”) is selected, from the Card Transaction model, three extra fields become mandatory. The three extra fields plus, “CallbackUrl” and “BrowserInfo” are:

 

  • “CardAuthorizationType”

  • “RecurringReference”

  • “CardStorageType”

 

If you send CIT_ECOMMERCE as the value for “CardStorageType”, 3DS will be performed.

For Example:

 

  • If “CardStorageType” value = CIT_ECOMMERCE – 3DS actioned

  • If “CardStorageType” value = CIT_MOTO – no 3DS action

  • If “CardStorageType” value = CIT_MERCHANT_STORED – no 3DS action

  • If “CardStorageType” value = MIT_MERCHANT_STORED – no 3DS action

 

Sample

POST

BODY


Real-time Transaction API call cont.

When this function is called, we run AReq and one of the following responses will be returned based on what response we get back:

 

1. If AReq returns Frictionless Successful it will proceed to process the transaction and a result as normal.

 

2. If AReq returns Frictionless Rejection the transaction will not be submitted to the bank/gateway for processing and a new transaction will be immediately generated with the rejected status and the result will be as follows:

 

3. If AReq returns Challenge Required, we will return a response with a new StatusCode of “V” (no transaction is generated yet) which looks like this:

Note the two new fields “redirectUrl” and “redirectId” which are returned only for this status “V” response.

“redirectUrl and “redirectId” is required to process the challenge as described in “3-D Secure Finalise Transaction” API call


Finalise Real-time Transaction API call

If challenge required was returned, it will be up to the merchant to redirect their customer to the URL we provided in the response. For testing, you can simply copy and paste the “redirectUrl” into your browser to get to the challenge page.

 

Once you have completed the challenge, you should be redirected to the URL provided in the “CallbackUrl” from the previous API call. To determine the result of the challenge and complete the transaction, you will need to call this API - (3-D Secure Finalise Transaction) by using the “redirectId”.

 

This function checks the result of the challenge and if it was successful, it will continue to process the transaction with all the information originally provided in the card transaction API call. This function returns the same result model as the real-time transaction function, so can be handled in the same way.

 

Sample if challenge successful:

 

If challenge failed, a rejected transaction record is generated and a rejected result is returned.