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.Base URL
https://carts.withgale.comAuthentication
Request Body
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
plugin_version | string | Yes | Plugin or integration version |
test_mode | boolean | Yes | Process transaction in test mode |
merchant_cart_id | string | Yes | Unique cart ID from your platform |
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 | Customer phone number |
customer.timezone | string | No | Customer timezone (e.g., "America/Chicago") |
line_items | array | Yes | Products being purchased |
line_items[].merchant_product_id | string or number | No | Your product ID (nullable for some platforms) |
line_items[].name | string | Yes | Product name |
line_items[].product_picture | string | No | Image URL of the product |
line_items[].product_amount | integer | Yes | Unit price of the product in cents |
line_items[].quantity | integer | Yes | Quantity |
line_items[].currency_code | string | Yes | Currency (e.g., "USD") |
shipping_info | object | Yes | Shipping address |
shipping_info.address_line_1 | string | Yes | Address line 1 |
shipping_info.address_line_2 | string | No | Address line 2 |
shipping_info.state | string | Yes | State |
shipping_info.city | string | Yes | City |
shipping_info.zip | string | Yes | ZIP/Postal code |
shipping_info.country | string | Yes | Country code (e.g., "US") |
billing_info | object | Yes | Billing Address |
billing_info.address_line_1 | string | Yes | Address line 1 |
billing_info.address_line_2 | string | Yes | Address line 2 |
billing_info.state | string | Yes | State |
billing_info.city | string | Yes | City |
billing_info.zip | string | Yes | Zip/postal code |
billing_info.country | string | Yes | Country code (e.g., "US") |
shipping_amount | integer | No | Shipping fee amount in cents |
discount | integer | No | Discount amount in cents |
tax_amount | integer | No | Tax amount in cents |
success_url | string | Yes | Redirect URL after successful payment |
failure_url | string | Yes | Redirect URL if payment fails |
metadata | object | No | Custom key-value pairs |
metadata.platform | string | No | Platform name (e.g., SHOPIFY) |
metadata.webhook_url | string | No | URL to receive payment status webhook (recommended) |
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 |
