Skip to main content
When you initialize the Unity Payment Links SDK, you need to provide a customerId. This ID allows the SDK to manage cases where a player closes the browser during checkout and later returns to the game. In such scenarios, the SDK uses the customerId from initialization and the purchaseId from the checkout session to validate the order. It then communicates with the Appcharge server to determine the order status, and responds to the app with the appropriate next step. Additionally, the customerId ensures proper validation even when multiple players share the same device. For example, if multiple players log into the same game on one phone, the SDK uses customerId to correctly identify each player and validate their purchases with the Appcharge server. Use the following function to initialize the SDK:
PaymentLinksController.Instance.Init("YOUR_CUSTOMER_ID", callback)
ArgumentTypeDescription
Customer IDstringCustomer ID.
CallbackICheckoutPurchaseImplementation of the callback interface.
This initialization method is sufficient if you’ve already set the Environment and Checkout Public Key fields in the configuration file.

Re-initialize the SDK

You may need to re-initialize the SDK in the following cases:
  1. When switching environments at runtime, for example, when testing the SDK.
  2. When a new player logs in and replaces the current session.
  3. When certain configuration details are managed manually instead of being defined in the configuration file.
In such cases, re-initialize the SDK using the extended method below:
PaymentLinksController.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 public key from the Publisher Dashboard.Go to Settings → Integration and copy the Checkout Public Key.
Customer IDstringThe player’s unique ID.
CallbackICheckoutPurchaseImplementation of the callback interface.
Always ensure the correct environment, checkoutPublicKey and customerId are used when re-initializing. Incorrect values can cause failed checkout validations.