# Card testing (/credit-card-number-generator)



Test your card integration in the [sandbox environment](/sandbox-testing/overview) by simulating:

* [Successful payments](#simulate-successful-payments) for Expanded Checkout integrations using [test card numbers](#test-card-numbers).
* [Card error scenarios](#simulate-card-error-scenarios) by using [rejection triggers](#rejection-triggers).
* [3D Secure authentication](#simulate-3d-secure-card-payments) scenarios.
* [Recommended use cases](#test-integration) for Expanded Checkout integration.

> **Tip:** **Tip:** Use the [credit card generator](#credit-card-generator) to generate test credit cards for sandbox testing.

## Simulate successful payments [#simulate-successful-payments]

To simulate a successful card capture with Expanded Checkout integration in sandbox:

* Ensure the integration is in sandbox mode, with a sandbox client ID, and connected to `api-m.sandbox.paypal.com` endpoints.
* Use a test card number with a future expiration date and a 3-digit CVV, or a 4-digit CVV for American Express.

### Test static card numbers [#test-static-card-numbers]

#### Test card numbers [#test-card-numbers]

Test [Expanded Checkout](/platforms/checkout/advanced/integrate) payments and [saved payment method](/v5/save-payment-methods/overview) use cases with these test card numbers:

> **Tip:** **Tip:** Enter a future expiration date and a 3-digit CVV, or 4-digit CVV for American Express, to proceed.

| Test number      | Card type        |
| ---------------- | ---------------- |
| 371449635398431  | American Express |
| 376680816376961  | American Express |
| 36461510000039   | Diners Club      |
| 36461510000013   | Diners Club      |
| 6304000000000000 | Maestro          |
| 5063516945005047 | Maestro          |
| 2223000048400011 | Mastercard       |
| 4005519200000004 | Visa             |
| 4012000033330026 | Visa             |
| 4012000077777777 | Visa             |
| 4012888888881881 | Visa             |
| 4217651111111119 | Visa             |
| 4500600000000061 | Visa             |
| 4772129056533503 | Visa             |
| 4915805038587737 | Visa             |
| 6200680000000004 | CUP              |
| 6200680000000038 | CUP              |
| 3636500000000260 | JCB              |
| 3636500000000989 | JCB              |

### Test generated card numbers [#test-generated-card-numbers]

#### Credit card generator [#credit-card-generator]

Generate additional credit cards for sandbox testing and [PayPal Checkout](/checkout). You can add generated credit cards to a PayPal sandbox account or use them to test credit card payments.

 

## Simulate card error scenarios [#simulate-card-error-scenarios]

Enter a rejection trigger in the **First Name** or **Name on Card** to simulate credit card error scenarios in Expanded Checkout integrations.

> **Note:** **Note:** Test using a Visa card number, such as 4012 8888 8888 1881, with a future expiration date and any 3-digit CVV.

![Simulate card error](https://www.paypalobjects.com/ppdevdocs/img/simulate-card-error.svg)

### Rejection triggers [#rejection-triggers]

Rejection test simulations show a `response_code` that changes based on the test trigger you use. Rejection trigger values are case-sensitive.

> **Note:** **Note:** All rejection scenarios return the AVS code as globally unavailable and the CVV code as not processed.

| Test name          | Trigger               | Processor response code | Code description                                                                  |
| ------------------ | --------------------- | ----------------------- | --------------------------------------------------------------------------------- |
| Card refused       | `CCREJECT-REFUSED`    | `0500`                  | `DO_NOT_HONOR`                                                                    |
| Fraudulent card    | `CCREJECT-SF`         | `9500`                  | `SUSPECTED_FRAUD`. Try using another card. Do not retry the same card.            |
| Card expired       | `CCREJECT-EC`         | `5400`                  | `EXPIRED_CARD`                                                                    |
| Luhn Check fails   | `CCREJECT-IRC`        | `5180`                  | `INVALID_OR_RESTRICTED_CARD`. Try using another card. Do not retry the same card. |
| Insufficient funds | `CCREJECT-IF`         | `5120`                  | `INSUFFICIENT_FUNDS`                                                              |
| Card lost, stolen  | `CCREJECT-LS`         | `9520`                  | `LOST_OR_STOLEN`. Try using another card. Do not retry the same card.             |
| Card not valid     | `CCREJECT-IA`         | `1330`                  | `INVALID_ACCOUNT`                                                                 |
| Card is declined   | `CCREJECT-BANK_ERROR` | `5100`                  | `GENERIC_DECLINE`                                                                 |
| CVC check fails    | `CCREJECT-CVV_F`      | `00N7`                  | `CVV2_FAILURE_POSSIBLE_RETRY_WITH_CVV`                                            |

### Sample response [#sample-response]

The response shows that the order is successfully created, but because a refusal was passed, the card payment `status` is `DECLINED`:

* Line 18 shows `status=DECLINED`. The card was refused.
* Line 51 shows `avs_code=G`. The card is globally unavailable.
* Line 52 shows `cvv_code=P`. The card wasn't processed.
* Line 53 shows `response_code=5400`. The card is expired.

```json
{
  "id": "3M049991JF5624929",
  "status": "COMPLETED",
  "payment_source": {
    "card": {
      "last_digits": "6889",
      "brand": "VISA",
      "type": "CREDIT"
    }
  },
  "purchase_units": [
    {
      "reference_id": "default",
      "payments": {
        "captures": [
          {
            "id": "2FB04508RA686960W",
            "status": "DECLINED",
            "amount": {
              "currency_code": "USD",
              "value": "500.00"
            },
            "final_capture": true,
            "disbursement_mode": "INSTANT",
            "seller_protection": { "status": "NOT_ELIGIBLE" },
            "seller_receivable_breakdown": {
              "gross_amount": { "currency_code": "USD", "value": "500.00" },
              "paypal_fee": { "currency_code": "USD", "value": "13.44" },
              "net_amount": { "currency_code": "USD", "value": "486.56" }
            },
            "links": [
              {
                "href": "https://api-m.sandbox.paypal.com/v2/payments/captures/2FB04508RA686960W",
                "rel": "self",
                "method": "GET"
              },
              {
                "href": "https://api-m.sandbox.paypal.com/v2/payments/captures/2FB04508RA686960W/refund",
                "rel": "refund",
                "method": "POST"
              },
              {
                "href": "https://api-m.sandbox.paypal.com/v2/checkout/orders/3M049991JF5624929",
                "rel": "up",
                "method": "GET"
              }
            ],
            "create_time": "2022-08-09T22:20:05Z",
            "update_time": "2022-08-09T22:20:05Z",
            "processor_response": {
              "avs_code": "G",
              "cvv_code": "P",
              "response_code": "5400"
            }
          }
        ]
      }
    }
  ],
  "links": [
    {
      "href": "https://api-m.sandbox.paypal.com/v2/checkout/orders/3M049991JF5624929",
      "rel": "self",
      "method": "GET"
    }
  ]
}
```

### Processor response and error codes [#processor-response-and-error-codes]

To understand why a card payment was declined, review the [Orders v2 processor response object](/api/orders/v2/definitions/processor_response) in the Orders API response.

For more information about card payment decline reasons and possible values, see:

* [Card decline errors](/v5/expanded/card-decline-errors).
* Error responses for [CVV](/v5/expanded/card-decline-errors#cvv-error) and [AVS](/v5/expanded/card-decline-errors#avs-error).
* [Processor response codes](/api/orders/v2/definitions/processor_response) for non-PayPal payment processors.

## Simulate 3D Secure card payments [#simulate-3d-secure-card-payments]

Use 3D Secure to authenticate cardholders through card issuers. When your customer submits their card details on your website for processing, you can trigger 3D Secure. When triggered, customers are prompted by their card-issuing bank to complete an additional verification step to enter a one-time or static password, depending on the issuer's method.

For more information about including [3D Secure authentication](/expanded/3d-secure) in your payment flow, see:

* Learn more about [3D Secure](/api/orders-v2/expanded/3d-secure) for Expanded Checkout using the Orders API.
* Simulate 3D Secure-supported scenarios using 3D Secure test cards to [verify your card integration](/v5/expanded/3d-secure/test-scenarios).

## Test integration [#test-integration]

Test the recommended use cases for [Expanded Checkout integration](/platforms/checkout/advanced/integrate) before you go live.

### Accept payment [#accept-payment]

#### Checkout page

Test a successful card payment:

1. Go to the checkout page for your integration.
2. Choose a test card from [this list](#test-card-numbers).
3. Enter the card details in the hosted field, including the name on the card, billing address, and 2-character [country code](/api/codes/country-region). Then submit the order.
4. Confirm that the order was processed.
5. Log in to your merchant sandbox account and navigate to the activity page to ensure the payment amount shows up in the account.

#### 3D Secure

Test a successful 3D Secure card authentication:

1. Choose a 3D Secure test card from [this list](/v5/expanded/3d-secure/test-scenarios) for a successful scenario.
2. Make a [create order call](/api/orders/v2/orders-create) that includes a [`payment_source`](/api/orders/v2/orders-create) object with a [valid card number](#test-card-numbers).
3. Ensure that the request passes `SCA_ALWAYS` as the `verification.method` to manually trigger [3D Secure authentication](/api/orders-v2/expanded/3d-secure#1-include-a-contingency-for-3d-secure).
4. To approve 3D Secure authentication, follow the `"rel": "payer-action"` HATEOAS link included in the response. The order is automatically approved in the sandbox environment when you visit the URL.
5. Make a [get order call](/api/orders/v2/orders-get) and look for the 3D Secure results in the response.
6. Verify that the [response](/api/orders-v2/expanded/3d-secure) includes an `authentication_result` object.
7. Verify that the response matches the [specific 3D Secure scenario](/v5/expanded/3d-secure/test-scenarios) for the test card selected.

### Decline payment [#decline-payment]

#### Checkout page

Decline a test card payment from the checkout page:

1. Go to the checkout page for your integration.
2. Choose a test card from [this list](#test-card-numbers).
3. Select a rejection trigger from [this list](#rejection-triggers) and enter it in the card's name field.
4. Enter the other card details in the card fields, including the card number, billing address, and a 2-character [country code](/api/codes/country-region).
5. Submit the order.
6. Verify that the declined payment error message shows up.

#### Orders API

Verify the [processor response code](#rejection-triggers) for a declined payment using the [Orders API](/api/orders/v2):

1. Make a [create order](/api/orders/v2/orders-create) call that includes a [`payment_source`](/api/orders/v2/orders-create) object with a [valid card number](#test-card-numbers).
2. Set the value of the card name or `address_line_1` to any rejection trigger value, for example, `CCREJECT-REFUSED`.
3. Verify that the [response](#sample-response) indicates the status of the capture as `DECLINED`, with the processor code that matches the [rejection trigger](#rejection-triggers).

### Authorize payment [#authorize-payment]

#### Authorize

Test authorization and capture of a card payment:

1. Make a [create order call](/api/orders/v2/orders-create) with intent as `AUTHORIZE` that includes a [`payment_source`](/api/orders/v2/orders-create) object with a [valid card number](#test-card-numbers).
2. Authorize the [order](/api/orders/v2/orders-authorize).
3. Complete the authorized order using [capture authorized payment call](/api/payments/v2/authorizations-capture).
4. Confirm that the capture status is `COMPLETED` in the authorization response.

#### Void

Cancel a test card payment:

1. Make a [create order call](/api/orders/v2/orders-create) with intent as `AUTHORIZE` that includes a [`payment_source`](/api/orders/v2/orders-create) object with a [valid card number](#test-card-numbers).
2. Authorize the [order](/api/orders/v2/orders-authorize).
3. Ensure that the authorized payment hasn't been fully captured.
4. Make a call to [void authorized payment](/api/payments/v2/authorizations-void).
5. Confirm that the order was voided using the authorization response.

#### Refund

Refund a captured test payment:

1. Ensure that the authorized payment has been fully captured. Refer to the **Authorize** tab in the **Authorize payment** section.
2. Make a [refund captured payment](/api/payments/v2/captures-refund) call.
3. Verify that the response includes the refund ID and shows the status as `COMPLETED`.

## See also [#see-also]

* [Postman Collection](https://www.postman.com/paypal/workspace/345300e6-346e-42e0-aed1-53717919aef0/folder/19024122-c9c2265d-f2ed-41ed-947b-e9d23fd2627c) — Test additional positive and `4xx` error conditions.
* [Simulate negative responses](/negative-testing/request-headers) — Use API request headers to trigger negative responses.
* [Error messages](/api/orders/v2/error-messages) — Explore error messages supported by the Orders API.
