Create Checkout Session
create_checkout_sessionGenerate a checkout session URL to accept one-time payments, start subscriptions, or save payment methods through Stripe's hosted page.
Instructions
Create a Stripe Checkout session. Returns a URL to redirect customers to Stripe-hosted payment page.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | "payment" for one-time, "subscription" for recurring, "setup" for saving payment method | |
| line_items | No | Line items, max 20 (required for payment and subscription modes) | |
| success_url | Yes | URL to redirect after successful payment | |
| cancel_url | No | URL to redirect if customer cancels | |
| customer | No | Existing customer ID | |
| customer_email | No | Pre-fill email (ignored if customer is set) | |
| metadata | No | Session metadata | |
| allow_promotion_codes | No | Allow promotion code entry | |
| trial_period_days | No | Trial days (subscription mode only) | |
| payment_method_types | No | Payment methods (e.g. ["card", "us_bank_account"]) | |
| expires_at | No | Session expiration as Unix timestamp (30min to 24hr from now) | |
| idempotency_key | No | Optional idempotency key for safe retries |