Test the payment process

After successfully configuring the asset, test the payment process. By default, all payments are in the sandbox mode and you can use a test bank card to simulate a successful payment process.

Your application receives information about a completed purchase using an API request, without using webhooks. The purchase process consists of the following steps:

  1. When you open the Pay Station on the client, a UUID is generated for the transaction.
  2. The UUID is passed as part of access_data in the request to open Pay Station as the external identifier of the current transaction.
  3. The client application with the specified frequency requests the current transaction status by the UUID. The response to the request contains the current status of the transaction, the external transaction identifier, and the name and quantity of the purchased product.
  4. Once receipt of a successful transaction is received, purchased items can be credited to the player's inventory according to in-game logic.

Example:

Copy
Full screen
Small screen
GET https://api.xsolla.com/merchant/projects/<Publisher Project ID>/transactions/external/<generated UUID>/status
{
"id":558357638,
"external_id":"647e9698-8ab3-11ea-ab8f-38f9d30e0dd3",
"status":"created",
"purchase": {
"checkout": null,
"virtual_currency": {
"name": "Money",
"quantity": 2
},
"virtual_items": null
}
}



{
"id": 558357634,
"external_id": "647e9698-8ab3-11ea-ab8f-38f9d30e0dd3",
"status": "processing",
"purchase": {
"checkout": null,
"virtual_currency": {
"name": "Money",
"quantity": 2
},
"virtual_items": null
}
}



{
"id": 556094258,
"external_id": "647e9698-8ab3-11ea-ab8f-38f9d30e0dd3",
"status": "canceled",
"purchase": {
"checkout": null,
"virtual_currency": null,
"virtual_items": [
{
"sku": "1468",
"quantity": 1
}
]
}
}
{
"id": 498415945,
"external_id": "647e9698-8ab3-11ea-ab8f-38f9d30e0dd3",
"status": "done",
"purchase": {
"checkout": {
"amount": -0.4,
"currency": "USD"
},
"virtual_currency": null,
"virtual_items": null
}
}

Test the payment process by making real payments:

  • Make sure that you have signed a contract with Xsolla.
  • In your Unity project, uncheck the Enable sandbox box in the Inspector window.

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.