- 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:
OnPurchaseSuccess 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 theOnInitializecallback is triggered. If the initialization fails and theOnInitializeFailedcallback 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.
