> ## Documentation Index
> Fetch the complete documentation index at: https://docs.appcharge.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Launch the Checkout

To launch the checkout, follow these steps:

1. From your server, call the [Create Checkout Session API](/../../api-reference/checkout/checkout-session/create-checkout-session) to create a checkout session.

   <Warning>
     * 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.
   </Warning>

2. After receiving the API response on your server, extract the values from the session object:

   ```json theme={"system"}
   {
       "checkoutSessionToken": "session_token_identifier",
       "purchaseId": "pr_purchase_id",
       "url": "https://checkout-v2-sandbox.appcharge.com",
       "parsedUrl": "https://checkout-v2-sandbox.appcharge.com/session_token_identifier#boot=checkout_boot_data"
   }
   ```

   | Parameter              | Description                                                   |
   | ---------------------- | ------------------------------------------------------------- |
   | `checkoutSessionToken` | A unique token to identify and validate the checkout session. |
   | `purchaseId`           | ID to track the purchase.                                     |
   | `url`                  | The base URL of the Appcharge checkout page.                  |
   | `parsedUrl`            | The base URL with data configurations.                        |

3. Use the values returned in the checkout session response to open the checkout on the client:

   <CodeGroup>
     ```kotlin Kotlin theme={"system"}
     BridgeAPI.openCheckout(
         purchaseId: "PURCHASE_ID",
         parsedUrl: "PARSED_URL"
     )
     ```
   </CodeGroup>

   <Danger>
     The session response values must be passed exactly as received. Modifying them may result in the checkout failing to load.
   </Danger>

4. You can also configure how the checkout page is opened (optional):

   <CodeGroup>
     ```kotlin Kotlin theme={"system"}
     // Open the checkout in the device’s default browser
     BridgeAPI.setBrowserMode("external")

     // Open the checkout with an internal custom Chrome tab
     BridgeAPI.setBrowserMode("cct")

     // Open the checkout with an internal Trusted Web Activity
     BridgeAPI.setBrowserMode("twa") // <-- Default
     ```
   </CodeGroup>

   <Warning>
     Running the checkout in an external browser may cause inconsistent behavior across devices and Android versions, including session loss, incomplete transactions, or app unexpected lifecycle behavior.
   </Warning>
