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

# Create Guest Checkout Session

Create a checkout session for a new customer (guest checkout). No authentication required. Returns a URL to redirect the customer to complete their purchase.

<ParamField body="orgSlug" type="string" required>
  Your organization's slug identifier.
</ParamField>

<ParamField body="planId" type="string" required>
  The plan ID the customer is subscribing to.
</ParamField>

<ParamField body="successUrl" type="string">
  URL to redirect the customer after successful checkout.
</ParamField>

<ParamField body="cancelUrl" type="string">
  URL to redirect the customer if they cancel checkout.
</ParamField>

<ParamField body="email" type="string">
  Pre-fill the customer's email address.
</ParamField>

<ParamField body="metadata" type="object">
  Optional metadata to attach to the subscription.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.alguna.io/portal/guest-checkout-session \
    -H "Content-Type: application/json" \
    -d '{
      "orgSlug": "acme-corp",
      "planId": "plan_pro_monthly",
      "successUrl": "https://yourapp.com/checkout/success",
      "cancelUrl": "https://yourapp.com/pricing",
      "email": "customer@example.com"
    }'
  ```

  ```javascript Node.js theme={null}
  const session = await alguna.checkout.createGuestSession({
    orgSlug: 'acme-corp',
    planId: 'plan_pro_monthly',
    successUrl: 'https://yourapp.com/checkout/success',
    cancelUrl: 'https://yourapp.com/pricing',
    email: 'customer@example.com'
  });

  // Redirect customer to session.redirectUrl
  window.location.href = session.redirectUrl;
  ```
</RequestExample>

<ResponseExample>
  ```json theme={null}
  {
    "checkoutSessionId": "cs_abc123xyz",
    "sessionToken": "tok_checkout_abc123...",
    "redirectUrl": "https://checkout.alguna.io/cs/cs_abc123xyz..."
  }
  ```
</ResponseExample>

<ResponseField name="checkoutSessionId" type="string">
  Unique identifier for the checkout session.
</ResponseField>

<ResponseField name="sessionToken" type="string">
  Session token for the checkout.
</ResponseField>

<ResponseField name="redirectUrl" type="string">
  URL to redirect the customer to complete checkout.
</ResponseField>

<Note>
  This endpoint does not require authentication and is designed for public-facing checkout flows. The checkout page is hosted by Alguna and handles payment collection, account creation, and subscription activation.
</Note>
