Skip to main content
To launch the checkout, follow these steps:
  1. From your server, call the Create Checkout Session API to create a checkout session.
    • When calling the Create Checkout Session API, don’t pass the redirectUrl parameter. The SDK already handles the redirect automatically using the configuration file.
    • Call the API from your server to ensure session integrity and security. Never invoke this endpoint from your client-side code.
  2. After receiving the API response on your server, extract the relevant values and pass them to the openCheckout method on the client:
    ParameterDescription
    checkoutSessionTokenA unique token to identify and validate the checkout session.
    purchaseIdID to track the purchase.
    urlThe base URL of the Appcharge checkout page.
    ACBridgeAPI.openCheckout(
        sessionToken: "SESSION_TOKEN",
        purchaseId: "SESSION_PURCHASE_ID",
        url: "CHECKOUT_URL"
    )
    
    You can configure how the checkout page is opened:
    • External browser
      Open the checkout in the device’s default browser. This flow will use the redirectUrl provided in the initialization to return back to the app.
      ACBridgeAPI.useExternalBrowser = true
      
      Running the checkout in an external browser may cause inconsistent behavior across devices, incomplete transactions, or app unexpected lifecycle behavior.
    • Non-external browser (default)
      The checkout opens in the device’s internal browser or SFSafariViewController. This flow will use the url scheme provided in the plist file to return back to the app. For more information, see Sell Outside IAP.
      ACBridgeAPI.useExternalBrowser = false