Embedded Checkout Integration
Embed Gale’s secure checkout directly on your website using an iframe. Customers stay on your domain while Gale handles payment processing, eligibility verification, and compliance.When to Use Embedded Checkout
Perfect for you if:
- You want customers to stay on your website during checkout
- You need a branded checkout experience
- You’re building a platform or multi-tenant solution
- You want Gale to handle checkout UI and compliance
- You can integrate via API to create checkout sessions
How It Works
- Customer adds items to cart on your website
- Your site creates a checkout session via
POST /v2/checkout - Gale API returns a
checkout_url - Your site embeds the checkout URL in an iframe
- Customer completes payment in the iframe (stays on your domain)
- Gale processes the payment securely
- Gale sends webhook notification with
order.createdevent - Your site shows confirmation to customer
Implementation Steps
1
Create Checkout Session via API
When customer is ready to checkout, create a checkout session with their items
2
Embed the Checkout Iframe
Use the returned
checkout_url in an iframe on your checkout page3
Handle Payment Confirmation
Listen for webhooks or postMessage events to confirm payment
4
Fulfill the Order
Process the order and show confirmation to customer
Step 1: Create Checkout Session
Create a checkout session with customer info and line items:Step 2: Embed Checkout
Use thecheckout_url in an iframe on your page:
- HTML
- React
- Next.js
Step 3: Handle Payment Confirmation
Option A: Webhooks (Recommended)
Option B: PostMessage Events
Listen for iframe postMessage events:Option C: Polling (Not Recommended)
Check order status via webhooks instead of polling. If you must poll, use the Order API:Subscription Support
Embedded checkout fully supports subscriptions:Customization
Iframe Styling
Success/Cancel URLs
Customize where customers land after checkout:{CHECKOUT_SESSION_ID}- Checkout session identifier{ORDER_ID}- Order identifier (after payment){CUSTOMER_EMAIL}- Customer’s email
Platform Integration Examples
Multi-Tenant Platform
Shopify App Example
Security Best Practices
Verify Webhooks
Always verify webhook signatures before processing
Use HTTPS
Only embed checkout on HTTPS pages
Validate Origins
Check event.origin in postMessage listeners
Secure API Keys
Never expose API keys in frontend code
Testing
Test Mode
Use test API keys for development:Test the Flow
- Create a test cart
- Embed checkout iframe
- Use test HSA card:
4111111111111111 - Complete payment
- Verify webhook received
Troubleshooting
Iframe not loading
Iframe not loading
Possible causes:
- Incorrect checkout_url
- Missing
allow="payment"attribute - HTTPS required
- Content Security Policy blocking iframe
Not receiving postMessage events
Not receiving postMessage events
Solution: Verify origin check matches
https://checkout.withgale.com exactlyCheckout shows 'Session Expired'
Checkout shows 'Session Expired'
Solution: Checkout sessions expire after 24 hours. Create a new checkout session.
Mobile iframe issues
Mobile iframe issues
Solution: Some mobile browsers have iframe limitations. Consider using redirect flow (payment links) for mobile.
API Reference
Complete API documentation:Next Steps
Webhooks Setup
Configure real-time payment notifications
Custom API
Need more control? Try custom API integration
Subscriptions
Learn about subscription management
Test Cards
Test your integration with test HSA cards
Support
Questions about embedded checkout?- 📧 Email: support@withgale.com
- 📚 API Reference
- 💬 Contact Support
