SDKs for Unity / Track order status
  Back to Docs

SDKs for Unity

Track order status

Notice
The SDK allows you to track the 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
Order tracking logic is included in the following SDK methods:
  • Cart.Purchase — used to buy a cart
  • Cart.PurchaseFreeCart — used to purchase free items via cart
  • Catalog.Purchase — used to purchase items in one click
  • Catalog.PurchaseForVirtualCurrency — used to purchase items for virtual currency
  • Catalog.PurchaseFreeItem — used to purchase free items in one click
SDK reference documentation
Learn more about SDK methods and its parameters.

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 to done or cancel, 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:

    1. A web socket connection is established.
    2. If the order status does not change to done or cancel within 5 minutes, the web socket connection is closed. If the order status changes to done or cancel, tracking stops.
    3. 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 or cancel
      • the order status does not done or cancel within 10 minutes
Note
If a web socket connection fails, the order status is tracked using short-polling.
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?
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.
Rate this page
Rate this page
Is there anything we can improve?

Don’t want to answer

Thank you for your feedback!

Useful links

Last updated: January 22, 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!