Set up item purchase

Note
Use test web applications as an implementation example:

Create order on the server side of application

To create an order with user and item data on the Xsolla side, use the Create payment token for purchase API call. The method will return a payment token, which is required to open the payment UI and make a payment. To use sandbox mode, pass the “sandbox”: true parameter in the body of the request for getting a token.

Limitations:

  • You need to pass either the user country or the user’s IP address when requesting the payment token. Using these data, the system determines the purchase currency, the language for localizing the payment interface and calculates taxes.
  • If you don’t pass the currency in the token, it is determined by the country.
  • If you pass the currency in the token, the user pays in this currency.
  • In the user_id parameter you need to pass the user ID from your authentication system. This ID is used to validate the user before making a purchase. When testing, you can pass any symbol in this parameter.
Note
By default, the token lifetime is 24 hours. If you want to change this value, contact your Customer Success Manager or send an email to csm@xsolla.com. The new value will be enabled for all your company’s projects created in Publisher Account.

Open payment UI

Make test payment

To test the payment process, you can use sandbox mode. Sandbox mode is a standalone environment that supports all features of a live environment, except real and declined payments. You can access sandbox mode by sending “sandbox”: true when you create an order.

Note

Before you sign a contract with Xsolla, testing the payment process is only available in sandbox mode.

Testing does not require withdrawing money from real bank accounts.

  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.

Notice
In sandbox mode, you can test a one-time payment and payment with saved payment methods using bank cards and PayPal.

To see detailed information, including fees, about transactions made in sandbox mode:

  1. Open your Publisher Account.
  2. Go to Accounting > Transaction registry.
  3. Check the Show test transactions box.

Additionally, you can see the transactions’ details and request refunds in Publisher Account in the Support > Transaction search section.

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.
Last updated: November 1, 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!