Launch the Checkout

To launch the checkout, follow these steps:

  1. Create a checkout session using the Create Checkout Session API. The API response includes url, sessionToken, and purchaseId. Save these values for the next step.
  2. 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 the OnInitializeFailed 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.