Skip to main content

Documentation

Simulating 3DS Authentication - API Method

When an API method requires 3DS authentication for a card operation, you can simulate the authentication in the sandbox. Relevant where the payment method category is card.

The 3DS simulator authenticates the card, the operation is completed, and Rapyd sends a webhook.

Card operations with 3DS authentication must be authenticated within 15 minutes.

3DS authentication is available for the following card operations:

  • Create Payment.

  • Create Customer with card payment method.

  • Add card payment method to existing customer.

To simulate 3DS authentication in the sandbox:

Method

Description

Create Payment

Set amount to 1000 or above. Certain amounts above 2000 trigger specific errors instead of the 3DS flow. See Error Simulation. For an amount below 1000, set payment_method_options.3d_required to true. Relevant to card payment methods where the response to Get Payment Method Required Fields includes 3d_required.

Create Customer

The simulator requires 3DS for all card payment methods. In production, the requirements differ from card to card.

Add Payment Method to Customer

The simulator requires 3DS for all card payment methods. In production:

  • The requirements differ from card to card.

  • 3DS authentication is required when payment_method_options.3d_required is set to true. Relevant to payment methods where the response to Get Payment Method Required Fields includes 3d_required.

The API response includes the following fields:

Field

Description

next_action

3d_verification - 3DS authentication is required to complete the operation.

redirect_url

The URL for simulating 3DS authentication.

status

ACT - The payment is active and awaiting completion of 3DS. Relevant to payments.

When authentication is complete, the API returns the following webhooks:

Method

Webhook

Create Payment

PAYMENT_COMPLETED

Create Customer

CARD_ADDED_SUCCESSFULLY

Add Payment Method to Customer

CARD_ADDED_SUCCESSFULLY

The example below illustrates creating a card payment that requires 3DS authentication and simulating the authentication.

Creating a Payment with 3DS Authentication

To create a payment that requires 3DS authentication, specify an amount above 1000 and not one of the amounts described on Error Simulation. See Create Payment.

Create Payment Request

In this example, the value of amount is 1050.

Create Payment Request

Request URL - post https://sandboxapi.rapyd.net/v1/payments

{
    "amount": 1050,
    "currency": "USD",
    "payment_method": {
        "type": "us_visa_card",
        "fields": {
            "number": "4111111111111111",
            "expiration_month": "12",
            "expiration_year": "25",
            "cvv": "789",
            "name": "John Doe"
        }
    },
    "capture": true
}
Create Payment Response
{
    "status": {
        "error_code": "",
        "status": "SUCCESS",
        "message": "",
        "response_code": "",
        "operation_id": "42416643-4159-49a8-8c65-4a17e8d4e489"
    },
    "data": {
        "id": "payment_46bd13214fe6e7ab9f12f70e64d5743c",
        "amount": 0,
        "original_amount": 1050,
        "is_partial": false,
        "currency_code": "USD",
        "country_code": "US",
        "status": "ACT",

 //     ...    

        "payment_method": "card_761c1a5ce9b7af77f5f6cd539fb1fcbb",
        "payment_method_data": {
            "id": "card_761c1a5ce9b7af77f5f6cd539fb1fcbb",
            "type": "us_visa_card",
            "category": "card",

 //            ...    

            "next_action": "3d_verification"            
            },

 //     ...    

        "redirect_url": "https://sandboxcheckout.rapyd.net/3ds-payment?token=payment_46bd13214fe6e7ab9f12f70e64d5743c",

 //     ...    

        "next_action": "3d_verification",

 //     ...    
        },
}

In the data section:

  • status - The status of the payment is ACT (active). The payment is active and awaiting completion of 3DS authentication.

  • redirect_url - The URL for 3DS authentication.

  • next_action - The value is 3d_verification. 3DS authentication is required to complete the payment.