# Test a 3DS challenge flow

Use this process to test a 3DS challenge flow.

3DS is an additional security layer for online credit and debit card transactions. 3D stands for the three domains which interact using the protocol: the merchant or acquirer domain, the issuer domain, and the interoperability domain.
For more information, see [3D Secure (3DS)](/docs/settings/3ds).

## Configure 3DS on the payment gateway

1. Configure 3DS on the payment gateway account:

    1. In the left navigation bar, press **Settings**.
    2. In the **Configuration** section, press **Gateway accounts**.
    3. Press **TestProcessor**.
    4. Press **Edit gateway account**.
    5. In the **Setup instruction** section, in the **Instruction** dropdown, select **Authorize**.
    6. In the **Advanced configuration** section, turn on the **Advanced configuration** toggle.
    7. Scroll down the page to the **3D secure** section, then select the **Activate 3D secure** checkbox.
    8. In the **3D server** dropdown, select **ThreeDSecureIO3dsServer**.
    9. Depending on which payment cards you would like to test using 3Ds, select from the following:

      At a minimum, you must enter details for Visa and Mastercard.

      **Visa**

          1. In the **Acquirer merchant ID Visa** field, enter `test-visa`.
          2. In the **Merchant acquirer BIN Visa** field, enter `411111`.
      **Mastercard**

          1. In the **Acquirer merchant ID Mastercard** field, enter `test-mastercard`.
          2. In the **Merchant acquirer BIN Mastercard** field, enter `555555`.
      **American Express (AMEX)**

          1. In the **Acquirer merchant ID AMEX** field, enter `test-amex`.
          2. In the **Merchant acquirer BIN Amex** field, enter `378282`.
      **Discover**

          1. In the **Acquirer merchant ID Discover** field, enter `test-discover`.
          2. In the **Merchant acquirer BIN Discover** field, enter `601111`.
      **JCB**

          1. In the **Acquirer merchant ID JCB** field, enter `test-jcb`.
          2. In the **Merchant acquirer BIN JCB** field, enter `305693`.
2. In the **Merchant name** field, enter your merchant name.
3. In the **Merchant country** dropdown, select a country.
4. In the **Merchant URL** field, enter any valid URL.
5. In the **Transaction type** dropdown, select **Goods/Service purchase**.
6. At the bottom of the page, press **Save gateway account**.

## Create a test customer and transaction

1. Create a new customer and test the transaction:

    1. In the left navigation bar, press **Data tables**, then press **Customers**.
    2. In the top right of the page, press **Add customer**.
    3. Enter the test customer's details, then press **Save customer**.
    4. In the right of the page, press **Manage customer**, then press **Collect payment**.
    5. Enter the amount and add a description for the payment.
    6. Select the **Pay with Rebilly hosted payment form** option, and press **Submit**.
    7. Press **Copy URL** and open the URL in a browser.
    8. In the payment card number field, enter `4111111111111111`.
      Use a future expiration date (avoid `10/2051`), and any valid CVV (avoid `000`, `0000` for Amex).
    9. Press **Continue**, then press **Confirm**.

## Test 3DS outcomes

In the response, an `approvalUrl` value is returned.
At the URL, simulate the different outcomes of the challenge flow in a 3DSecure.io sandbox environment.

Agent skill for a transaction with result `unknown` and status `waiting-approval`: [Finish a waiting payment](https://www.rebilly.com/.well-known/agent-skills/finish-a-waiting-payment/SKILL.md).

To test different 3DS flows, use the last four digits from 3dsecure.io to generate a card number that passes the Luhn check.
For more information, see [3DS browser tests](https://docs.3dsecure.io/3dsv2/sandbox.html#browser-tests).

Alternatively, select from the following predefined card numbers to test 3DS outcomes:

| **Card brand** | **Number** | **Outcome** |
| --- | --- | --- |
| `Visa` | `4111111111111111` | Manual challenge |
| `Mastercard` | `5555555555554444` | Frictionless flow, authenticated |
| American Express | `378282246310005` | Frictionless flow, authenticated |
| `Visa` | `4000000000000002` | Frictionless flow, not authenticated |
| `Mastercard` | `5105105105105100` | Frictionless flow, not authenticated |
| American Express | `371449635398431` | Frictionless flow, not authenticated |

To test a card that is not enrolled in 3DS, use the amount `71.00` or `71.71`.
At these amounts, the outcome of a predefined card number does not change.

## Test 3DS outcomes with gateway test cards

To test a 3DS outcome with a test card of another payment gateway, enter a keyword as the first name or last name of the cardholder.
The payment gateway receives the card number that you enter and approves or declines the payment based on its own test card numbers.
The 3DS outcome is selected by the keyword.

Enter the keyword as a whole word, in any letter case, such as `Jane Frictionless`.
If the payment gateway selects a payment result by first name or last name, enter the keyword in the other field.
The cardholder name is taken from the billing address of the payment, the billing address of the payment card, or the primary address of the customer, in that order.

The following keywords select a 3DS outcome:

| **Keyword** | **Outcome** |
| --- | --- |
| `Challenge` | Manual challenge |
| `Frictionless` | Frictionless flow, authenticated |
| `NotAuthenticated` | Frictionless flow, not authenticated |
| `NotEnrolled` | Card not enrolled in 3DS |

A keyword also replaces the outcome of a predefined card number, and of the amount `71.00` or `71.71`.
If the cardholder name has no keyword, the outcome is selected by the card number.
For more information, see [Test 3DS outcomes](#test-3ds-outcomes).
