Track order status
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
Cart.Purchase
— used to buy a cartCart.PurchaseFreeCart
— used to purchase free items via cartCatalog.Purchase
— used to purchase items in one clickCatalog.PurchaseForVirtualCurrency
— used to purchase items for virtual currencyCatalog.PurchaseFreeItem
— used to purchase free items in one click
To handle a successful purchase, you only need to pass a function that is called when the order transitions to the done
status in the onSuccess
parameter.
Purchase methods encapsulate several methods for tracking the order status. The mechanism differs depending on the platform for which the application is built:
- For WebGL builds, tracking is based on the
postMessage
events of the payment interface widget. If the Pay Station widget sends a message that the order status changed todone
orcancel
, tracking stops.
- For builds for other platforms, tracking uses simple HTTP requests (short-polling) and WebSocket requests. Tracking is performed according to the following algorithm:
- A web socket connection is established.
- If the order status does not change to
done
orcancel
within 5 minutes, the web socket connection is closed. If the order status changes todone
orcancel
, tracking stops. - Order status tracking continues with short-polling. A simple HTTP order status request is sent once every 3 seconds. Tracking stops if:
- order status changes to
done
orcancel
- the order status does not
done
orcancel
within 10 minutes
- order status changes to
You can also implement processing an order content data that is passed to the onSuccess
callback function of the purchase methods.
Was this article helpful?
Rate this page
Don’t want to answer
Thank you for your feedback!
Useful links
Found a typo or other text error? Select the text and press Ctrl+Enter.