Acompanhamento do status do pedido
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, you need to track the order status using the OrderTracking.Instance.AddOrderForTracking
SDK method. Pass the following parameters to the method:
projectId
— project ID from the Publisher AccountorderId
— order ID received from the purchase via the shopping cart, one-click purchase, or purchase for virtual currencyonSuccess
— callback in case the order transitions to thedone
statusonError
— callback in case Xsolla server returns an error
This method encapsulates 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
Observação
If a web socket connection fails, the order status is tracked using short-polling.
You can also implement:
- requesting the order status and order contents using the
CheckOrderStatus
SDK method - webhook handling on the server side of your application for Xsolla transaction events
Este artigo foi útil?
Obrigado pelo seu feedback!
Avaliaremos sua mensagem e a usaremos para melhorar sua experiência.Links úteis
Última atualização:
10 de Outubro de 2023
Encontrou um erro de texto ou digitação? Selecione o texto e pressione Ctrl+Enter.