Documentation Index Fetch the complete documentation index at: https://docs.withgale.com/llms.txt
Use this file to discover all available pages before exploring further.
Getting Started
This guide walks you through creating your first checkout session using Gale’s API. By the end, you’ll understand the full payment flow.
Base URL
https://api.withgale.com/v2
Use test API keys (prefix glm_test_) during development. All test transactions are processed in sandbox mode with no real charges.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer glm_test_YOUR_API_KEY
Get your API keys from Gale Dashboard under Settings > API Keys .
Quick Start
1. Sync a Product
Before creating a checkout, sync your product catalog so Gale can determine HSA/FSA eligibility.
curl -X POST https://api.withgale.com/v2/products \
-H "Authorization: Bearer glm_test_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Digital Blood Pressure Monitor",
"merchant_product_id": "BP-MONITOR-001",
"upc_code_or_gtin": "14567890123456",
"price": 4995,
"currency": "USD"
}'
The response includes eligibility status:
{
"success" : true ,
"data" : {
"id" : 12345 ,
"name" : "Digital Blood Pressure Monitor" ,
"merchant_product_id" : "BP-MONITOR-001" ,
"price" : 4995 ,
"eligibility" : {
"hsa_fsa_eligible" : true ,
"message" : "SIGIS verified - Medical device"
}
}
}
2. Create a Checkout Session
Create a checkout session and get a URL to redirect your customer to:
curl -X POST https://api.withgale.com/v2/checkout \
-H "Authorization: Bearer glm_test_YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reference_id": "your-order-123",
"customer": {
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe"
},
"line_items": [
{
"product_id": "BP-MONITOR-001",
"name": "Digital Blood Pressure Monitor",
"price": 4995,
"quantity": 1
}
],
"shipping_info": {
"address_line_1": "123 Main St",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
},
"shipping": 500,
"tax": 410,
"success_url": "https://yoursite.com/order/success",
"failure_url": "https://yoursite.com/order/failed"
}'
Response:
{
"success" : true ,
"checkout_id" : "01HXYZ..." ,
"checkout_url" : "https://checkout.withgale.com/checkout/01HXYZ..." ,
"status" : "open" ,
"expires_at" : "2026-02-26T14:30:00Z"
}
3. Redirect Customer
Send your customer to the checkout_url. Gale’s hosted checkout page handles:
HSA/FSA card collection
Eligibility verification
Letter of Medical Necessity (LMN) flow for dual-purpose items
Payment processing
After payment, the customer is redirected to your success_url or failure_url.
4. Confirm Payment
Option A: Webhooks (recommended)
Register a webhook endpoint in your Dashboard under Settings > Webhooks . Gale sends an order.created event when payment succeeds:
{
"type" : "order.created" ,
"data" : {
"id" : "ord_abc123" ,
"status" : "completed" ,
"checkout_id" : "01HXYZ..." ,
"reference_id" : "your-order-123" ,
"customer" : {
"email" : "jane@example.com"
}
}
}
Option B: Poll for status
Check the checkout status by querying the order:
curl https://api.withgale.com/v2/orders/{order_id} \
-H "Authorization: Bearer glm_test_YOUR_API_KEY"
Three Key IDs
ID What it is When you get it checkout_idThe checkout session you created Returned when you create a checkout order_idThe payment record after successful payment Returned in webhooks and order queries reference_idYour own order/cart ID for correlation You provide this when creating a checkout
Testing
Use test API keys (glm_test_*) during development. Test card numbers:
Card Number Result 4111 1111 1111 1111Successful payment 4000 0000 0000 0002Card declined
See Test Cards for the full list.
Next Steps
Integration Flow Full end-to-end integration walkthrough
Checkout Guide Detailed checkout integration guide
API Reference Complete API endpoint documentation
Webhooks Set up real-time event notifications