Create Checkout Session
Create a checkout session for a customer. Returns a checkout URL where the customer completes payment on Gale’s hosted page. Gale handles card collection, eligibility detection, and LMN flow automatically.Authentication
Request Body
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
customer | object | Yes | Customer information |
customer.email | string | Yes | Customer email |
customer.first_name | string | Yes | Customer first name |
customer.last_name | string | Yes | Customer last name |
customer.phone | string | No | Phone number (E.164 format) |
line_items | array | Yes | Products being purchased |
line_items[].merchant_product_id | string | Yes | Your product ID |
line_items[].name | string | Yes | Product name |
line_items[].quantity | integer | Yes | Quantity |
line_items[].price_cents | integer | Yes | Unit price in cents |
shipping_info | object | Yes | Shipping address |
billing_info | object | No | Billing address (defaults to shipping) |
amounts | object | No | Additional amounts |
amounts.shipping_cents | integer | No | Shipping cost in cents |
amounts.tax_cents | integer | No | Tax in cents |
amounts.discount_cents | integer | No | Discount in cents |
success_url | string | Yes | Redirect URL after successful payment |
cancel_url | string | No | Redirect URL if customer cancels |
metadata | object | No | Custom key-value pairs |
payment_type | enum | No | one_time or subscription |
subscription | object | No | Required if payment_type is subscription |
Response
Examples
Basic Checkout
With JavaScript
Subscription Checkout
Checkout Status
| Status | Description |
|---|---|
open | Checkout session created, awaiting customer |
complete | Customer completed payment |
expired | Session expired (24 hours) |
Webhooks
When payment is complete, receive webhook:Errors
| Status Code | Error Code | Description |
|---|---|---|
| 400 | invalid_request | Missing or invalid parameters |
| 401 | unauthorized | Invalid API key |
| 422 | validation_error | Field validation failed |
