This topic describes how to test payment transactions in Rebilly.
Use the sandbox environment to test code changes and experiment without risk.
By default, the sandbox is configured with a testing payment gateway called TestProcessor. No information is sent to third parties when using this gateway.
Use the live environment as your product environment. Experimenting in this environment involves risk. Plan your tests carefully.
Before releasing to your users, complete the following:
- Define a series of small-value test transactions for various scenarios, and test these using all enabled card types.
- Test the checkout flow.
- Subscribe to a plan and ensure that the card is charged immediately. For more information, see Create a product and pricing plan.
- Cancel a subscription. For more information, see Cancel a subscription.
- Issue a partial and a full refund. For more information, see Refund transactions.
- Limit the payment gateway to using one, or a small number of, test customer IDs. For more information, see in Set up a payment gateway - Configure additional filters.
After completing the test transactions, log in to your payment gateway account and confirm that the corresponding test transactions are present.
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.
Optionally, to test transactions, create a new test customer and a Rebilly hosted payment form:
- In the left navigation bar, press Data tables, then press Customers.
- In the top right of the screen, press Add customer.
- Enter the test customer's details, then press Save customer.
- In the right of the screen, press , then press Collect payment.
- Enter the amount and add a description for the test payment.
- Select the Pay with Rebilly hosted payment form option, and press Submit.
- Press Copy URL and open the URL in a browser.
- Use any card number from the steps below.
Simulate an approved transaction: Use any card in Simulate approved transactions.
Simulate a declined transaction. Use any card in Simulate declined transactions.
Simulate special cases:
Use a future expiration date (except
10/2051), and any valid CVV except000, or0000for 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,0000for 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
timeouttoapproved. Visa:4000000000000200 - Timeout (Declined): Simulate a timeout from a downstream gateway. After execution, the result is updated from
timeouttodeclined. 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 for more information. To trigger an offsite payment flow, use the following:
- Simulate
waiting-approvaland then approve after a simulated 3DS flow is completed: Visa:4000000000000101 - Approve instantly: Visa:
4000001000000000
- Simulate
- Waiting on gateway flow: This test simulates
waiting-gatewaystatus, waiting on an asynchronous response from the processor. The transaction is marked asapprovedwithin 10 minutes. Visa:4263982640269299 - Test ACH bank accounts: Use this test bank account to test ACH:
- Routing number:
123456789 - Account number:
1234567890
- Routing number:
- 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:
Use the following payment cards, IBANs, and ACH details to simulate different outcomes in the Rebilly sandbox environment when processing payments. These details do not generate real charges.
For payment cards, use a future expiration date, and any valid CVV. Amex cards have a 4 digit CVV, all others have a 3 digit CVV.
- A CVV of
000, or0000for Amex, results in a gateway response code "N7" with the message "Decline for CVV2 failure". For more information, see Simulate an issuer decline caused by invalid CVV. - The expiration date
10/2051triggers a test decline with expired/missing expiration error code. This expiration date is not valid and will result in a test decline. For more information, see Simulate an issuer decline caused by invalid expiration date.
The following test card numbers and IBAN simulate approved transactions.
| Card brand | Number | Country |
|---|---|---|
| Visa | 4111111111111111 | US |
| Visa | 4123400073320224 | DE |
| Visa | 4761229700150465 | AU |
| Visa | 4761209980011439 | NZ |
| Mastercard | 5555555555554444 | CA |
| Mastercard | 5204245250460049 | DE |
| American Express | 378282246310005 | US |
| Discover | 6011111111111117 | |
| Diners Club | 30569309025904 | |
| JCB | 3530111333300000 | JP |
| China UnionPay | 6253111111111114 | |
| Maestro | 6759641111111119 | |
| IBAN | DE89370400440532013000 | |
| ACH | Routing number: 123456789Account number: 1234567890 |
To simulate an approved transaction using a special amount in the sandbox environment, use 71.00. This is useful for methods like Apple Pay, where the DPAN cannot be controlled.
The following test card numbers simulate declined transactions.
| Card brand | Number | Country |
|---|---|---|
| Visa | 4000000000000002 | US |
| Mastercard | 5105105105105100 | CA |
| American Express | 371449635398431 | US |
| Discover | 6011000990139424 | US |
| Diners Club | 38520000023237 | |
| JCB | 3566002020360505 | |
| China UnionPay | 6243030000000001 | |
| Maestro | 6771790000000018 | AT |
| IBAN | DE62370400440532013001 | |
| ACH | Routing number: 031245679 Account number: 0312456798 |
To simulate an issuer decline caused by an invalid or mismatched expiration date, while using a valid test card number, set the expiration date to 10/2051. This results in a gateway response code "54" with the message "Expired card or expiration date is missing".
To simulate an issuer decline caused by an invalid CVV, while using a valid test card number, set the CVV to 000, or 0000 for Amex. This results in a gateway response code "N7" with the message "Decline for CVV2 failure".
Use this process to test a generic offsite approval flow.
Ensure that 3DS is not active on the payment gateway account:
- In the left navigation bar, press Settings .
- In the Configuration section, press Gateway accounts.
- Press TestProcessor.
- Press Edit gateway account.
- In the Setup instruction section, in the Instruction dropdown, select Authorize.
- In the Advanced configuration section, turn on the Advanced configuration toggle.
- Scroll down the page to the 3D secure section, and ensure that the Activate 3D secure checkbox is clear.
- At the bottom of the page, press Save gateway account.
Create a new customer and test the transaction:
- In the left navigation bar, press Data tables, then press Customers.
- In the top right of the screen, press Add customer.
- Enter the test customer's details, then press Save customer.
- In the right of the screen, press , then press Collect payment.
- Enter the amount and add a description for the payment.
- Select the Pay with Rebilly hosted payment form option, and press Submit.
- Press Copy URL and open the URL in a browser.
- In the payment card number field, enter
4000000000000101. Use a future expiration date (avoid10/2051), and any valid CVV (avoid000,0000for Amex). - Press Continue, then press Confirm.
In the response, an approvalUrl value is returned. From the URL you have the option to approve, decline, or cancel the transaction.
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).
Configure 3DS on the payment gateway account:
In the left navigation bar, press Settings .
In the Configuration section, press Gateway accounts.
Press TestProcessor.
Press Edit gateway account.
In the Setup instruction section, in the Instruction dropdown, select Authorize.
In the Advanced configuration section, turn on the Advanced configuration toggle.
Scroll down the page to the 3D secure section, then select the Activate 3D secure checkbox.
In the 3D server dropdown, select ThreeDSecureIO3dsServer.
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
- In the Acquirer merchant ID Visa field, enter
test-visa. - In the Merchant acquirer BIN Visa field, enter
411111.
- In the Acquirer merchant ID Visa field, enter
Mastercard
- In the Acquirer merchant ID Mastercard field, enter
test-mastercard. - In the Merchant acquirer BIN Mastercard field, enter
555555.
- In the Acquirer merchant ID Mastercard field, enter
American Express (AMEX)
- In the Acquirer merchant ID AMEX field, enter
test-amex. - In the Merchant acquirer BIN Amex field, enter
378282.
- In the Acquirer merchant ID AMEX field, enter
Discover
- In the Acquirer merchant ID Discover field, enter
test-discover. - In the Merchant acquirer BIN Discover field, enter
601111.
- In the Acquirer merchant ID Discover field, enter
JCB
- In the Acquirer merchant ID JCB field, enter
test-jcb. - In the Merchant acquirer BIN JCB field, enter
305693.
- In the Acquirer merchant ID JCB field, enter
In the Merchant name field, enter your merchant name.
In the Merchant country dropdown, select a country.
In the Merchant URL field, enter any valid URL.
In the Transaction type dropdown, select Goods/Service purchase.
At the bottom of the screen, press Save gateway account.
Create a new customer and test the transaction:
- In the left navigation bar, press Data tables, then press Customers.
- In the top right of the screen, press Add customer.
- Enter the test customer's details, then press Save customer.
- In the right of the screen, press , then press Collect payment.
- Enter the amount and add a description for the payment.
- Select the Pay with Rebilly hosted payment form option, and press Submit.
- Press Copy URL and open the URL in a browser.
- In the payment card number field, enter
4111111111111111. Use a future expiration date (avoid10/2051), and any valid CVV (avoid000,0000for Amex). - Press Continue, then press Confirm.
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. 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.
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 |
| Visa | 4000000000000002 | Frictionless flow, not authenticated |
| Mastercard | 5105105105105100 | Frictionless flow, not authenticated |