Implementation examples
Node.js
The Components integration handles frictionless and challenge 3D Secure authentication flows, including the data exchange between your front end and the issuer's Access Control Server (ACS).
This guide is for integrations using Web Component with the /payments or /payments/details endpoints on versions earlier than v6.0.0. If you are using a v6.0.0 or later, follow the guide for the latest version.
If your integration uses the /sessions endpoint, you do not need additional configuration for 3D Secure.
To handle native 3D Secure 2 authentication:
- Get additional shopper details in your payment form.
- Make a payment request, including additional shopper details.
- Handle the 3D Secure 2 action to perform the authentication flow.
- Submit the authentication result.
- Show the payment result.
Before you begin
This page assumes that you have already either:
- Built a Card Component integration.
- Built your own UI for collecting shopper's card details.
A strict CSP for your website can prevent native 3D Secure 2 challenges from being loaded on your website. You can use the redirect flow if you do not want to adjust your CSP.
If you are using 3D Secure for PSD2 compliance, read our comprehensive PSD2 SCA guide.
Step 1: Get additional shopper details in your payment form
For higher authentication rates, we strongly recommend that you collect the shopper's email address, cardholder name, billing address, and IP address for payments with 3D Secure authentication.
Step 2: Make a payment
From your server, make a /payments request, specifying:
Your next steps depend on if the /payments response contains an action
object. Choose your API version:
Step 3: Handle the 3D Secure 2 action
If your integration uses Card Component v3.6.0 or later to collect the shopper's card details, also use it to handle the 3D Secure 2 action on the same page.
If you built your own UI for collecting the shopper's card details or want to render 3D Secure authentication on a different page than the payment, create a new 3D Secure 2 Component.
Handle Component errors
When an error occurs, Component calls the onError
handler.
For errors that happen during the 3D Secure 2 authentication, you do not need to stop the payment flow because the shopper can continue.
Step 4: Submit the authentication result
Step 5: Show the payment result
Use the resultCode from the /payments or /payments/details response to present the payment result to your shopper. You will also receive the outcome of the payment asynchronously in a webhook.
For card payments, you can receive the following resultCode
values:
resultCode | Description | Action to take |
---|---|---|
Authorised | The payment was successful. | Inform the shopper that the payment has been successful. If you are using manual capture, you also need to capture the payment. |
Cancelled | The shopper cancelled the payment. | Ask the shopper if they want to continue with the order, or ask them to select a different payment method. |
Error | There was an error when the payment was being processed. For more information, check the
refusalReason
field. |
Inform the shopper that there was an error processing their payment. |
Refused | The payment was refused. For more information, check the
refusalReason
field. |
Ask the shopper to try the payment again using a different payment method. |
Test and go live
Use our test card numbers to test how your integration handles different 3D Secure authentication scenarios.