Introduction
checkoutOs is a redirect-based, SDK-less payment orchestration API for Indian payment gateways, with idempotent creation, verified webhooks and refunds.
checkoutOs is a redirect-based, SDK-less HTTP API that wraps Indian payment gateways behind a single unified contract. Razorpay, Paytm, PayU and Cashfree all speak different status strings and ship different SDKs; checkoutOs exposes one stable surface and makes switching between the implemented gateways an environment-variable change.
V1.0 ships with Razorpay and Paytm implemented and registered. PayU and Cashfree exist as
registry stubs only — setting either as ACTIVE_GATEWAY exits at startup rather than failing
on the first payment.
The one principle
A verified webhook is the only source of truth
POST /payments returns PENDING and a paymentUrl. Polling can move a payment through
intermediate states, but it can never set SUCCESS. Only a gateway webhook that passes
signature verification advances a payment to a terminal captured state.
That invariant is what makes the state machine honest across every gateway. It also means the
webhook endpoint is load-bearing, not a convenience: if your gateway dashboard is not pointed
at checkoutOs, payments will be created and completed but nothing will ever reach SUCCESS.
What V1 includes
- Payment creation via one API, returning a
paymentUrl. Idempotency-Keyon payment creation, with 24-hour replay.- A second deduplication dimension on merchant
orderId. - Status polling with a 10-second staleness window.
- Full and partial refunds.
- Verified webhook ingestion and a normalized relay.
- Prometheus metrics, structured logs and opt-in OTLP traces.
- A deterministic mock gateway for local development.
Where to start
Quickstart
Run checkoutOs locally against a mock gateway in about five minutes.
Payment model
IDs, amounts, statuses and the response envelope every endpoint shares.
Gateways
Razorpay, Paytm, and the plugin contract a new gateway implements.
Roadmap
What is planned next — including agentic AI payments, which are not in V1.
What the API looks like
curl -X POST https://api.checkoutos.in/payments \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: 3f7d2a1e-9c4b-4f6a-8d2e-1b5c7a9e3f01' \
-d '{ "amount": 50000, "currency": "INR", "orderId": "order_abc123" }'{
"success": true,
"data": {
"paymentId": "chk_a1b2c3d4e5f6a7b8",
"paymentUrl": "https://api.checkoutos.in/checkout/chk_a1b2c3d4e5f6a7b8",
"status": "PENDING",
"amount": 50000,
"currency": "INR",
"gateway": "razorpay",
"orderId": "order_abc123",
"createdAt": "2026-10-18T09:12:44.000Z"
}
}Redirect the user to paymentUrl. The gateway hosts the checkout page, fires a webhook back
to checkoutOs when the payment completes, and checkoutOs relays a normalized event to your
own endpoint keyed by the chk_ identifier.
Endpoint surface
| Method | Path | Description |
|---|---|---|
POST | /payments | Create a payment, get a paymentUrl |
GET | /payments/:chkId | Check payment status |
POST | /payments/:chkId/refund | Refund a payment, fully or partially |
GET | /refunds/:refId | Check refund status |
POST | /webhooks/:gateway | Receive a gateway webhook |
GET | /checkout/:chkId | Serve the checkout page (HTML or redirect) |
GET | /health | Redis and active-gateway health |
Architectural contracts
These are load-bearing. A change that violates one is wrong even if it works.
| Layer | Rule |
|---|---|
| Controllers | HTTP only. No business logic, no Redis, no gateway-specific code. |
| Services | Own business logic. Orchestrate store and gateway via getActiveGateway(). Never import a gateway folder directly. |
| Store | The only layer permitted to touch Redis or a database. |
| Gateway | Implement GatewayPlugin and GatewayMapper. Never leak gateway-specific models upward. |
| Utils | Pure functions, no side effects. |
| Telemetry | A peer layer of Store; business code emits through the OTel API and never names an exporter. |
Adding a gateway must never change the service layer — a registry entry plus a plugin file is the whole job. If a gateway seems to require a service change, the abstraction is being modelled wrong; fix the plugin, not the service.
See Adding a gateway for the full checklist.
Future scope
Agentic AI payments — signed spending mandates, an authorization guard and an MCP payment tool — are future scope and not functional in V1. See the roadmap for the boundary between what ships today and what is planned.