Set up item purchase
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.
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.
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.
- Open the payment UI in sandbox mode.
- Choose the Bank card payment method.
- 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.
- Click Pay.
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 detailed information, including fees, about transactions made in sandbox mode:
- Open your Publisher Account.
- Go to Accounting > Transaction registry.
- 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.
Found a typo or other text error? Select the text and press Ctrl+Enter.