Track order status
Notice
The SDK allows you to track order status on the client side of your application. However, we recommend setting up a Payment webhook handler to receive order information in the back end of your application. This allows you to implement additional validation of completed purchases.
After a user makes a purchase, your application can perform the following actions:
- show the order status in the application UI
- credit a user’s balance after a successful payment
- grant the purchased items after a successful payment
To implement the logic of these actions, track the order status using the CheckPendingOrder
SDK method. Pass the following parameters to the method:
AuthToken
— user authorization tokenOrderId
— order ID received from the purchase via the shopping cart, one-click purchase, or purchase for virtual currencySuccessCallback
— callback in case the order moves to thedone
statusErrorCallback
— callback in case Xsolla server returns an error
SDK reference documentation
Learn more about SDK methods and its parameters.
This method encapsulates several methods for tracking the order status. Tracking is performed according to the following algorithm:
- A web socket connection is established.
- If the order status hasn’t changed to
done
orcancel
within 5 minutes, the web socket connection is re-established. If the order status is changed todone
orcancel
, tracking stops.
Note
If a web socket connection fails, the order status is tracked using short-polling. Once every 3 seconds, a simple HTTP order status request is sent. Tracking stops if:
- order status changed to
done
orcancel
- the order status does not change to
done
orcancel
within 10 minutes
CheckOrder
SDK method.Was this article helpful?
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.Useful links
Last updated:
January 22, 2024
Found a typo or other text error? Select the text and press Ctrl+Enter.