# Test transactions in the sandbox

Use this process to test transactions using the *TestProcessor* payment gateway in the sandbox environment.
To test all other payment gateways, refer to their specific documentation.

## Test basic transactions

1. Optionally, to test transactions, create a new test customer and a Rebilly hosted payment form:
  1. In the left navigation bar, press , 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 , then press **Collect payment**.
  5. Enter the amount and add a description for the test 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. Use any card number from the steps below.
2. Simulate an approved transaction: Use a card number with a result of `Approved` from [Test cards, IBANs, and ACH details](/docs/tutorials/test-payment-cards#test-cards-ibans-and-ach-details).
3. Simulate a declined transaction: Use a card number with a result of `Declined` from [Test cards, IBANs, and ACH details](/docs/tutorials/test-payment-cards#test-cards-ibans-and-ach-details).


## Test special cases

Use the following special test scenarios to simulate specific transaction behaviors:

Use a future expiration date (except `10/2051`), and any valid CVV except `000`, or `0000` for Amex.
Amex cards have a 4 digit CVV, all others have a 3 digit CVV.

- **Incorrect CVV number provided**: Simulate the scenario where a user enters payment card details with an incorrect CVV.
This results in a gateway response code "N7" with the message "Decline for CVV2 failure".
CVV:`000`, `0000` for Amex.
- **Invalid or mismatched expiration date**: Simulate the scenario where the card number is valid but the expiration date does not match what the issuer has on file.
Use an expiration date of `10/2051`.
This results in a gateway response code "54" with the message "Expired card or expiration date is missing".
- **First transaction approved, subsequent transactions declined**: Simulate a successful subscription creation followed by declines on all rebills. Visa: `4000000000000010`
- **Timeout (Approved)**: Simulate a timeout from a downstream gateway.
After execution, the result is updated from `timeout` to `approved`.
Visa: `4000000000000200`
- **Timeout (Declined)**: Simulate a timeout from a downstream gateway.
After execution, the result is updated from `timeout` to `declined`.
Visa: `4462030000000000`
- **Connection error**: Simulate a connection exception. Visa: `4000000000001000`
- **Refund request morphed to void**: Where possible, Rebilly voids a transaction instead of refunding it.
A void transaction prevents the transaction from occurring.
A refund is a secondary transaction.
Visa: `4000000000020000`
- **Refund declined**: Simulate a refund declined scenario. Visa: `4000000000100000`
- **Alternating approved or declined**: This test works on recurring payments (rebills) only. Using this payment card number will alternate between approved and declined transactions, starting with an approved status: Visa: `4000000002000000`
- **Declined with reason code Fraud**: Test this scenario if you handle declines with reason code Fraud, or want to test rules that are in place to handle this automatically, such as adding those customers to a blocklist. Visa: `4000000010000000`
- **Offsite payment flow**: Offsite payment is used for scenarios that involve Dynamic Currency Conversion (DCC) and 3D Secure.
The offsite payment workflow is advanced, [contact us](https://www.rebilly.com/contact/) for more information.
To trigger an offsite payment flow, use the following:
  - Simulate `waiting-approval` and then approve after a simulated 3DS flow is completed: Visa: `4000000000000101`
  - Approve instantly: Visa: `4000001000000000`
- **Waiting on gateway flow**: This test simulates `waiting-gateway` status, waiting on an asynchronous response from the processor.
The transaction is marked as `approved` within 10 minutes.
Visa: `4263982640269299`
- **Test ACH bank accounts**: Use this test bank account to test ACH:
  - Routing number: `123456789`
  - Account number: `1234567890`