- From your server, call the Create Checkout Session API to create a checkout session.
-
After receiving the API response on your server, extract the values from the session object:
Parameter Description checkoutSessionTokenA unique token to identify and validate the checkout session. purchaseIdID to track the purchase. urlThe base URL of the Appcharge checkout page. parsedUrlThe Parsed URL of the Appcharge checkout page. -
Use the values returned in the checkout session response to open the checkout on the client. Depending on your integration version, use one of the following methods:
Recommended integration
Use the following values from the session response:Legacy integration (deprecated)
Use the following values from the session response:The session response values must be passed exactly as received. Modifying them may result in the checkout failing to load. -
Control whether the Android foreground Checkout Service is enabled (optional):
The foreground service is enabled by default and helps keep your app prioritized while checkout is open, reducing the risk of Android closing or deprioritizing it during payment and network operations. You can enable or disable the service during runtime using:The foreground service runs only if the required manifest permissions and service declaration are properly configured. If you don’t want to use the foreground service, removeCheckoutServicedeclaration from your manifest file and disable it during runtime using the method above. The foreground permissions can remain, as they may be used by other services in your app. -
You can also override in run-time how the checkout page is opened (optional):
-
External browser
Open the checkout in the device’s default browser. This flow will redirect the player back to the app. -
Non-external browser (default)
Open the checkout in a non-external browser. This flow will use the URL scheme provided in the configuration file to return back to the app.
For Android, choose whether the Checkout opens in a Trusted Web Activity (TWA), or in a Custom Chrome Tab (CCT). For iOS, the checkout opens via SFSafariViewController. For more information regarding iOS, see Sell Outside IAP.
-
External browser
-
For Unity iOS only, you can force the Checkout page to display in portrait orientation, even if the app is currently in landscape mode (optional):
