SwiftPay exposes four integration modes. They are intentionally different in ownership, speed, and customization so you can start quickly and scale without re-architecting.Documentation Index
Fetch the complete documentation index at: https://docs.swiftpay.finance/llms.txt
Use this file to discover all available pages before exploring further.
REST API
Production-ready and server-controlled invoice flow.
x402
HTTP 402 per-request payments for any API endpoint.
Hosted Checkout
UI-complete checkout flow managed by SwiftPay.
Embedded iFrame
In-app payment surface with event callbacks.
REST API
Status: Available now. Use this when you want ownership of the payment lifecycle. It is the best default for most integrations because you control request timing, idempotency strategy, invoice metadata, and reconciliation logic.What you build
- Create an invoice from your backend.
- Persist the returned invoice and map it to your internal order object.
- Render amount, token, chain, and expiry to your users.
- Listen and act on invoice state changes via polling or webhooks.
- Finalize fulfillment only after your backend confirms payment status.
Authentication and keys
Get both keys fromhttps://cockpit.swiftpay.finance → Settings (/settings):
sk_live_...(server secret key)pk_live_...(publishable key for public/checkout flows)
Example implementation pattern
id and externalRef together, then use either:
- periodic status checks for internal dashboards, or
- webhook-driven processing for automated order completion.
x402
Status: Available now. Use this when you want to charge per API request rather than per invoice. There is no checkout redirect — the payment happens in the HTTP round-trip itself. This is the right default for AI endpoints, data APIs, and machine-to-machine services.How it works
- Register a forwarder in the dashboard (one-time per merchant).
- Register each protected route as an endpoint via
POST /v1/x402/endpoints. - Add a middleware to your server that implements the two-round 402 gate.
The two-round flow
Hosted Checkout
Status: Available now. This is the low-friction mode. You generate invoices with the same REST API, then send users to a SwiftPay-hosted payment URL (https://pay.swiftpay.finance/{invoice_id}). The payment page handles chain/token selection, wallet connections, and payment signing — no frontend work required.
Best for:
- Minimal frontend effort — no custom checkout UI needed
- Mobile-first experiences — full-screen mobile optimization
- Email/SMS payments — shareable payment links
- Marketplace — independent checkout per invoice
- Link-based flows — QR codes, social sharing, print campaigns
- Create invoice using REST API
- Redirect user to hosted page
- User completes payment on SwiftPay’s interface
- User returns to your app via callback URL
- Webhook notifies your backend
Embedded iFrame
Status: Available now. This path is for teams that need a branded embedded checkout experience without building payment logic from scratch. SwiftPay handles payment orchestration; you control the page layout and surrounding UX. Best for:- Seamless checkout — users stay on your domain
- Custom page layout — full control over surrounding UX
- Single-page apps — no page redirects
- Modal checkouts — dialog or overlay
- White-label — branded payment experience
- Cart integration — checkout in cart summary page
- Create invoice on your backend
- Embed iframe with invoice ID
- User completes payment in iframe
- iFrame sends events via
postMessage - Handle payment confirmation events
Comparison Table
| Feature | REST API | x402 | Hosted | iFrame |
|---|---|---|---|---|
| Flow | Redirect + webhook | 2-round HTTP 402 | Redirect | Embedded |
| Checkout UI | You build | None | SwiftPay | SwiftPay |
| Mobile | ✅ | N/A | ✅ Optimized | ✅ |
| Custom layout | ✅ | — | — | ✅ |
| Implementation | Medium | Medium | Low | Medium |
| Setup time | ~1 day | ~1 day | ~30 min | ~2 hours |
| Best for | Full control | API paywalls | Fastest launch | White-label |
Recommendation by integration goal
- Invoice payments with full control → REST API
- Per-request API monetization → x402
- Launch speed with minimal work → Hosted Checkout
- Custom checkout experience → Embedded iFrame
- SDKs for frontend → See SDKs Overview
For implementation details and request payloads, start from the Quickstart.