To launch the checkout, follow these steps:
- Create a checkout session using the Create Checkout Session API. The API response includes
url
,sessionToken
, andpurchaseId
. Save these values for the next step. - Open the checkout using this function, passing the saved values as arguments:
`CheckOutController.Instance.OpenCheckout(url, sessionToken, purchaseId)
The checkout opens in a new window and guides the player through the purchase process. If the request is successful, theOnPurchaseSuccess
callback is triggered, indicating that the purchase was successful. If the request fails, the OnPurchaseFailed
callback is triggered with an error code. Follow the instructions in the WebGL SDK troubleshooting article and try to re-initialize again based on the error.
For more details on the callbacks you need to implement and how to handle them, refer to the Implement the WebGL SDK Callbacks article.
Important:
The checkout can only be launched if the SDK initialization is successful and the
OnInitialize
callback is triggered. If the initialization fails and theOnInitializeFailed
callback is triggered with an error code, refer to the WebGL SDK troubleshooting article for guidance. Follow the instructions to re-initialize the SDK based on the specific error.