# Sandbox testing

> Use sandbox test cards to validate card payment flows, 3DS scenarios, failure responses, subscriptions, token payments, and wallet payments.

Use the following test cards in the sandbox to validate your payment flows. Test cards are for sandbox use only. Do not use them in production, and do not replace them with real cardholder data.

<note>

The response codes and messages in the tables show the expected sandbox responses for testing successful and failed payments. Actual API responses still depend on the current sandbox configuration.

</note>

## Card payment test cards

Use these card numbers to validate one-time payments, 3DS authentication flows, exemption scenarios, failure responses, subscription payments, and token payments.

For these card payment test cards, enter the following details:

- Expiry date: use any correctly formatted date that has not expired.
- CVV: use any value in the required format.
- Cardholder name: include both a first name and a last name, separated by a space, for example `tester tester`.

<tip>

The 3DS test scenario describes the authentication flow or exemption path simulated by the sandbox test card. `Challenge flow` and `Frictionless flow` are 3DS authentication flows. `Exemption` describes an exemption scenario. These labels are not fixed properties of the card itself, and they do not mean every transaction from the same country or region will trigger the same result.

</tip>

| Card number | Country | Card brand | 3DS test scenario | Response code | Response message | Subscription | Save payment method |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `4000020951595032` | 🇺🇸 US | Visa | Challenge flow | `20000` | `Success` | Yes | Yes |
| `4761344136141390` | 🇸🇬 SG | Visa | Exemption | `20000` | `Success` | Yes | Yes |
| `4000319872807223` | 🇺🇸 US | Visa | Frictionless flow | `20000` | `Success` | No | Yes |
| `4000128449498204` | 🇺🇸 US | Visa | Frictionless flow | `60005` | `Do not honor` | No | Yes |
| `4021937195658141` | 🇬🇧 GB | Visa | Frictionless flow | `60051` | `Insufficient funds/over credit limit` | No | No |
| `4000164166749263` | 🇮🇳 IN | Visa | Frictionless flow | `60059` | `Suspected fraud` | No | No |
| `2221008123677736` | 🇺🇸 US | Mastercard | Challenge flow | `20000` | `Success` | Yes | No |
| `5333302221254276` | 🇹🇷 TR | Mastercard | Exemption | `20000` | `Success` | No | No |
| `5333418445863914` | 🇲🇽 MX | Mastercard | Frictionless flow | `20000` | `Success` | No | No |
| `5109486948867999` | 🇺🇸 US | Mastercard | Frictionless flow | `60062` | `Restricted card (card invalid in region or country)/Restricted card` | No | No |
| `4998170000000015` | 🇧🇷 BR | Visa | Challenge flow | `20000` | `Success` | No | No |
| `4998170000000023` | 🇧🇷 BR | Visa | Challenge flow | `60059` | `Suspected fraud` | No | No |

## Apple Pay sandbox testing

Before testing Apple Pay in the sandbox, complete the following preparation:

1. **Domain verification**: If you show the Apple Pay button on your own pages through the Web SDK or the Direct API, the test domain must first pass Apple domain verification, either through your own Apple Developer account or registered by Onerway; see [Apple Pay setup](/payments/versions/v2/online-payments/payment-methods/apple-pay#setup). The Onerway-hosted checkout page does not need this step.
2. **Sandbox tester account**: Create a sandbox tester account in App Store Connect. Sign out of iCloud on the test device, then sign in with the tester account.
3. **Device country and region**: Set the test device's country and region to one that the Apple Pay sandbox supports and that matches the card network of the test card; Wallet in the China mainland region supports UnionPay test cards only.

Test cards are provided by Apple and replaced in batches, so use the latest cards on the [Apple Pay sandbox testing](https://developer.apple.com/apple-pay/sandbox-testing/) page and add them manually in the Wallet app on the test device.

When testing Apple Pay with a Visa or Mastercard test card in the Onerway sandbox, use the payment amount to select the expected result:

| Payment amount | Expected payment result | Response code | Response message |
| --- | --- | --- | --- |
| `100.00` | Successful | `20000` | `Success` |
| `50.00` | Failed | `60059` | `Suspected fraud` |

## Google Pay test cards

Before testing Google Pay, join the [Google Pay test card suite group](https://groups.google.com/g/googlepay-test-mode-stub-data) with your Google account. Once joined, Google Pay on that account automatically presents a set of test cards, so there is no need to add cards manually.

In the Onerway sandbox, the Google Pay payment result depends on the selected test card number. Select the following cards in the Google Pay payment sheet to test successful and failed payments:

| Card number | Card brand | Expected payment result | Response code | Response message |
| --- | --- | --- | --- | --- |
| `4111111111111111` | Visa | Failed | `60059` | `Suspected fraud` |
| `5555555555554444` | Mastercard | Successful | `20000` | `Success` |
| `6011111111111117` | Discover | Successful | `20000` | `Success` |

## Suggested test scenarios

- Use test cards with an expected `Success` response to validate payment creation and payment confirmation.
- Verify that your server receives payment webhooks: verify each notification using the signature required by its event in [Webhook signature verification](/payments/versions/v2/get-started/webhook-signatures), then return the acknowledgement response so the notification is not redelivered.
- Use test cards with an expected failure response to validate error display, retry handling, and order status rollback.
- Use cards that support subscriptions to validate subscription payments.
- Use cards that support saving payment methods to validate save payment method flows and later token payments.
- Use the Apple Pay amounts and Google Pay card numbers above to validate successful and failed wallet payments.

## API authentication and notification checks

Before going live, test [request authentication](/payments/versions/v2/get-started/authentication) in the sandbox with the v2 API base URL, an enabled `API_KEY`, and an allowed server IP. Requests must carry `ApiKey` and omit request `sign`, while keeping the endpoint's required `merchantNo`, `appId`, and JSON-string fields.

Verify that missing or disabled API Keys are rejected. A key belonging to a different merchant returns `RS0024` with `API key verification failed`. Test the key-rotation sequence with two enabled keys, switch your server to the new key, and verify that disabling the old key prevents further requests using it.

For every event your integration uses, test verification with its required signature, successful acknowledgement, and duplicate handling. Include notifications with missing or invalid signatures. Confirm that your server does not use a notification it cannot verify to update payment or case records, or automatically fall back to a legacy signature. Verify the result through a server-side query instead. Retried notifications must not repeat business actions; a refreshed `x-timestamp` does not replace signature verification or deduplication. Follow each event's API Reference for retry exceptions.
