Test cards in sandbox mode

Sandbox mode is a stand-alone environment that supports all the features of a live environment, except real and declined payments. You can access sandbox mode by sending “mode”:“sandbox” when you get the token.

To open the payment UI, use this link and specify the obtained token there: https://sandbox-secure.xsolla.com/paystation4/?token={token}.

In sandbox mode, you can test the following payment UI interaction scenarios while making a payment with a bank card:

Test one-time purchase

Making a test payment

  1. Open the payment UI in sandbox mode.
  2. Choose the Bank card payment method.
  3. Enter the bank card details. In other fields (e.g., name or address), you can enter any data. You can also specify incorrect details (card number or expiration date) to test if an error is generated.
  4. Click Pay.
Test cards list
See the list of test bank cards.
Note

In addition to card details, you need to specify the ZIP code if at least one of the following conditions is true:

  • The user’s country is the US or Canada.
  • The Bank Identification Number (BIN) indicates that a card was issued in the US.

You can specify any valid ZIP code (e.g., 12345). This determines the sales tax rate and does not affect the progress of the test payment.
Sandbox bank card payments can be made in the following currencies: USD, EUR, RUB, GBP, AED, ALL, AMD, ARS, AUD, AZN, BGN, BRL, BYN, CAD, CHF, CLP, CNY, COP, CZK, DKK, DZD, EGP, GEL, HKD, HRK, HUF, IDR, ILS, INR, ISK, JPY, KES, KGS, KRW, KZT, MAD, MDL, MKD, MNT, MXN, MYR, NGN, PEN, PHP, PKR, PLN, RON, RSD, SAR, SEK, SGD, THB, TRY, TWD, UAH, UYU, UZS, VEF, VND, ZAR.

To see transactions made in sandbox mode:
  1. Open your Publisher Account.
  2. Go to Accounting > Transaction registry.
  3. Check the Show test transactions box.

Refund

  1. Configure the Refund webhook.
  2. Make a successful test payment.
  3. Call the Request refund API method.

A notification about the payment refund will be sent to the webhook URL.

Partial refund

  1. Configure the Partial refund webhook.
  2. Make a successful test payment.
  3. Call the Request partial refund API method.

A notification about the partial payment refund will be sent to the webhook URL.

Blocking fraud transaction

  1. Configure the AFS rejected transaction webhook.
  2. Make a test payment with this card:
CardCountry3-D Secure
Card number: 5159084825528450
Exp. date: 12/40
CVV2: Any 3 digits
Card brand: Mastercard
USNo
When making this payment, you will see an error in the payment UI. A notification about a declined transaction as the result of the AFS check will also be sent to the webhook URL.

Chargeback

A separate API call for sandbox mode was developed to test this scenario without any bank participation.

To test chargeback:

  1. Configure the Refund webhook.
  2. Make a successful test payment.
  3. Call the Request chargeback API method.

You will receive a Refund webhook with the following code:

CodeReasonDescription
2ChargebackTransaction chargeback requested.

Test saved cards

Save card

You can test saving a card by two ways:

Saving card while making a test payment

  1. Configure the Add payment account webhook.
  2. Open the payment UI in sandbox mode.
  3. Choose the Bank card payment method.
  4. Enter the bank card details. You can also specify incorrect details (card number or expiration date) to test if an error is generated.
  5. Check the Save this card for future payments box.
  6. Click Pay now.
Test cards list
See the list of test bank cards.

A notification about adding a new card will be sent to the webhook URL.
Saved card will be displayed in the Saved methods section.

Note

In addition to card details, you need to specify the ZIP code if at least one of the following conditions is true:

  • The user’s country is the US or Canada.
  • The Bank Identification Number (BIN) indicates that a card was issued in the US.

You can specify any valid ZIP code (e.g., 12345). This determines the sales tax rate and does not affect the progress of the test payment.
Sandbox bank card payments can be made in the following currencies: USD, EUR, RUB, GBP, AED, ALL, AMD, ARS, AUD, AZN, BGN, BRL, BYN, CAD, CHF, CLP, CNY, COP, CZK, DKK, DZD, EGP, GEL, HKD, HRK, HUF, IDR, ILS, INR, ISK, JPY, KES, KGS, KRW, KZT, MAD, MDL, MKD, MNT, MXN, MYR, NGN, PEN, PHP, PKR, PLN, RON, RSD, SAR, SEK, SGD, THB, TRY, TWD, UAH, UYU, UZS, VEF, VND, ZAR.

To see transactions made in sandbox mode:
  1. Open your Publisher Account.
  2. Go to Accounting > Transaction registry.
  3. Check the Show test transactions box.

Saving card from a user account

  1. Configure the Add payment account webhook.
  2. Open the payment UI in sandbox mode.
  3. Go to Saved.
  4. Click the pencil icon and choose Add new method.
  5. Click Bank card.
  6. Enter the bank card details. You can also specify incorrect details (card number or expiration date) to test if an error is generated.
  7. Click Save.

A notification about adding a new card will be sent to the webhook URL.
Saved card will be displayed in the Saved methods section.

Delete saved card

You can test deleting a saved card by two ways:

Deleting saved card via API

  1. Configure the Remove payment account webhook.
  2. Call the Delete saved accounts API method.

A notification about deleting a card will be sent to the webhook URL.

Deleting saved card in payment UI

  1. Configure the Remove payment account webhook.
  2. Open the payment UI in sandbox mode.
  3. Go to Saved.
  4. Click the pencil icon.
  5. Click Edit methods.
  6. Choose a card and click the bin icon.

A notification about deleting a card will be sent to the webhook URL.

Charge with saved card

You can test a payment with a saved card in the following ways:
Note
You can test both:
  • a one-time charge (e.g., purchase with a saved card)
  • regular charges (e.g., subscription payment)

Charging with saved card via API

  1. Configure the Payment webhook.
  2. Save card in the sandbox mode.
  3. Call the Charge with saved account API method.

A notification about a successful payment will be sent to the webhook URL.

Charging with saved card in the payment UI

  1. Configure the Payment webhook.
  2. Save card in the sandbox mode.
  3. Open the payment UI in sandbox mode.
  4. Click the card from the list of saved payment accounts.
  5. Click Pay.

A notification about a successful payment will be sent to the webhook URL.

Get list of saved cards

  1. Save cards in the sandbox mode.
  2. Call the Get saved accounts API method.

You will get masked data in the response.
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Rate this page
Rate this page
Is there anything we can improve?

Don’t want to answer

Thank you for your feedback!
Last updated: January 31, 2024

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!