Overview
3D Secure (3DS) is an authentication protocol that adds an extra layer of security for online card transactions, reducing the risk of unauthorized card usage and mitigating fraud by requiring additional authentication from the cardholder. When a card authorization requires 3DS, Payrails returns the information needed to take the customer through the challenge as part of the authorization flow. This page covers:- The two integration patterns for handling the 3DS redirect
- API mode, where you render the bank’s 3DS screens in your own iframes
- The
threeDSresponse object you receive when authentication completes
threeDS object reference.
Handling 3DS during authorization
When you authorize a card payment via API, the response includes alinks.consumerWait URL. You can use it in one of two ways.
Managed redirect with consumerWait
Redirect the customer to links.consumerWait after authorizing. Payrails handles the 3DS challenge if one is required, and returns the customer to your returnInfo.success URL when the session is complete. This is the integration pattern documented in our accept payments via API and authorize a payment guides.
The customer sees a Payrails-hosted intermediate page while the execution resolves, followed by either the 3DS challenge or your return URL.
Manual redirect with links.3ds
If you’d rather handle the 3DS redirect yourself (for example, to avoid showing a Payrails-hosted intermediate page on non-3DS payments), you can detect the 3DS step from the execution state and redirect to links.3ds directly.
-
After calling Authorize a payment, long-poll the execution:
-
When the request returns, check
actionRequiredon the execution:- If
actionRequiredis"3ds", redirect the customer tolinks.3ds. - If
actionRequiredis absent and the authorization has reached a terminal state, no challenge was required.
- If
-
After the 3DS challenge completes, Payrails redirects the customer to your
returnInfo.successURL. The final authorization result arrives via webhook notification.
Note that this pattern handles 3DS only. If you use payment methods that require other types of redirects (such as APM hosted payment pages), the managed flow above handles those transparently while the manual flow does not.
3DS API mode
In API mode, Payrails returns the bank’s 3DS screens as form data inrequiredAction, instead of a link to the Payrails-hosted 3DS page. You post each form from an iframe on your own checkout page, so the customer never leaves it.
API mode has these requirements:
- Payrails enables API mode for your merchant account. Ask your Payrails contact to turn it on.
- The payment runs a 3DS step in a modular workflow, and the step uses Netcetera as its 3DS provider.
- You send the customer’s browser data in
meta.clientContext, because the Payrails 3DS page that collects it in hosted mode isn’t used.
Request API mode
Addmeta.threeDSOptions to the authorize request, together with the customer’s browser data:
The Meta reference describes every field.
Render the fingerprint step
Long-poll the execution after you authorize, as in the manual redirect pattern. When the bank supports the 3DS Method, the execution returns arequiredAction with threeDSStep set to fingerprint:
- Create a hidden iframe.
- Inside it, submit a form to
hrefwithmethod, and send each entry inparametersas a form field (application/x-www-form-urlencoded).
href is the bank’s 3DS server. The bank notifies Payrails directly when the fingerprint finishes, and Payrails continues after at most methodTimeoutSeconds. You don’t need to call Payrails.
threeDSMethodData holds base64url-encoded JSON with the Payrails notification URL and the 3DS transaction ID. Send it to the bank unchanged.
Render the challenge step
If the bank asks the customer to authenticate, the nextrequiredAction has threeDSStep set to challenge, with a creq form field and no renderMode:
- Show a visible iframe, for example in a modal.
- Inside it, submit a form to
hrefwithmethod, and sendparameters.creqas a form field.
cres) to your challengeNotificationUrl. Use that request only as a signal to close the iframe: the 3DS result doesn’t come from it.
links.3ds isn’t returned for either step in API mode.
Get the result
Payrails receives the 3DS result from Netcetera and continues the workflow. Read the outcome from the execution or from theexecutionActionCompleted notification, the same as in hosted mode. The threeDS object carries transStatus, eci and authenticationValue.
When a fingerprint ends without a challenge, the requiredAction disappears and the workflow continues.
Errors
The 3DS step fails withrequest.param.invalid before Payrails contacts Netcetera when:
- API mode isn’t enabled for your merchant account.
- A
threeDSOptionsvalue is invalid. The error names the field. - The 3DS step uses a provider other than Netcetera.
- A required
clientContextfield is missing. The error lists the missing fields.
errors of the authorization’s executionActionCompleted event.
The threeDS object
The threeDS object encapsulates various parameters related to the 3DS authentication process. It provides detailed information about the authentication status, transaction identifiers, and relevant parameters. You can expect to receive the threeDS object in the Notifications under paymentComposition. Below is a breakdown of the key components within the threeDS object:
The structure of the object is based in the EMV 3DS 2.3.1.1 specification (PDF). However, depending on the availability of those fields in the response from your payment provider, we may not have all of them for all cases. Please contact our team to make sure you will get all the information you need for your processing.
Parameters
eci values
According to the 3DS specification, the following are the possible values for the eci field.
transStatus values
According to the 3DS specification, the following are the possible values for the transStatus field.