When you initialize the iOS Payment Links SDK for Unity, you need to provide a customerId. This allows the SDK to handle cases where the player closes the browser during checkout and later returns to the game. In such cases, the SDK begins validating the order using the customerId from initialization and the purchaseId from the checkout session. It then contacts the Appcharge server to check the order status, and responds to the app with the next step. Use the following function to initialize the SDK:
CheckoutController.Instance.Init("YOUR_CUSTOMER_ID", callback)
ArgumentTypeDescription
Customer IDstringPlayer ID.
CallbackICheckoutPurchaseInterface callback.
If you didn’t configure the Checkout Public Key and Environment in the AppchargeiOSConfig file, you need to add it here manually in the SDK initialization:
CheckoutController.Instance.Init("CHECKOUT_PUBLIC_KEY", "ENVIRONMENT", "YOUR_CUSTOMER_ID", callback)
ArgumentTypeDescription
EnvironmentstringThe checkout environment.
One of:
- sandbox: For testing.
- production: For live operations.
Checkout Public KeystringThe checkout public key, located in the Publisher Dashboard. In the sidebar menu, click Settings, then select the Integration tab. Copy the Checkout Public Key value.
Customer IDstringPlayer ID.
CallbackICheckoutPurchaseInterface callback.

Re-initialize the SDK

If the customerId changes, such as when the session context is different, you’ll need to re-initialize the SDK to ensure accurate order tracking:
CheckoutController.Instance.Init("CHECKOUT_PUBLIC_KEY", "ENVIRONMENT", "YOUR_CUSTOMER_ID", callback)