Checkout sessions
Read the catalogue, open a checkout session, send the buyer to the hosted page, verify the result, and make payment links from your server.
A checkout needs only the app's publishable key (pk_ followed by 32 characters; below written as pk_YOUR_KEY). The flow:
Your site reads the catalogue:
GET /api/public/{pk}/catalog.When the buyer clicks Buy, your site opens a session:
POST /api/public/{pk}/checkout.You send the buyer to the session's
hosted_url.The buyer pays at the gateway; REM Payments records it and redirects to your
success_url.Your server confirms: it reads the session, or acts on the signed webhook.
1. Catalogue
curl https://rempayments.com/api/public/pk_YOUR_KEY/catalog{
"app": {"name": "Your App", "slug": "your-app", "theme": {"accent": "#3938b0"}, "default_currency": "INR", "collect": ["email", "name"]},
"plans": [
{"id": 12, "slug": "starter", "name": "Starter", "amount": 79900, "currency": "INR", "display": "799.00 INR",
"prices": {"INR": 79900}, "interval": "month", "interval_count": 1, "recurring": true, "trial_days": 0,
"setup_fee": 0, "features": ["1 workspace", "Email support"], "metadata": {}}
],
"currencies": ["INR"],
"payment_methods": ["card", "netbanking", "upi", "wallet"],
"checkout_url": "https://rempayments.com/api/public/pk_YOUR_KEY/checkout",
"hosted_url_template": "https://rempayments.com/pay/?s={session_id}"
}Only active plans appear. The response is cacheable and carries CORS headers.
2. Open a checkout
curl -X POST https://rempayments.com/api/public/pk_YOUR_KEY/checkout \
-H "Content-Type: application/json" -H "Idempotency-Key: order-8812" \
-d '{"plan": "starter",
"buyer": {"email": "jane@example.com", "external_id": "u_42", "country": "IN"},
"client_reference_id": "order-8812",
"success_url": "https://yourapp.com/thanks?cs={CHECKOUT_ID}"}'Field | Meaning |
|---|---|
| Plan slug or id (required) |
| One of the plan's |
| 1 to 1000 |
|
|
| A coupon code; an invalid one fails the call with 400 |
| Override the app's; |
| Your order id; searchable; copied onto the payment |
| Up to 4,000 bytes, returned on the session and in events |
The answer is the session: id (cs_...), status: "open", the quote (subtotal, discount, tax, total, display_total), the chosen gateway, expires_at (30 minutes) and hosted_url. The same Idempotency-Key again returns the same session instead of opening a second order at the gateway.
Tax is computed from the plan or organization rules and the buyer's country. Example: a ₹1,999 plan with a 10 % coupon and 18 % GST added on top gives subtotal 199900, discount -19990, tax 32384, total 212294.
3. Send the buyer to the hosted page
const s = await fetch("https://rempayments.com/api/public/pk_YOUR_KEY/checkout", {
method: "POST", headers: { "Content-Type": "application/json" },
body: JSON.stringify({ plan: "starter", buyer: { email: user.email, external_id: user.id },
success_url: location.origin + "/thanks?cs={CHECKOUT_ID}" }),
}).then(r => r.json());
location.href = s.hosted_url;4. Verify on your server
The {STATUS} in the redirect is typed by the buyer's browser: never grant access on it alone. Either:
poll
GET /api/public/checkout/{cs_id}untilstatusiscompleted(orfailed,expired,cancelled); a completed session also carriespaymentandinvoice; oract on the signed
checkout.completed/payment.captured/subscription.activatedwebhooks.
The webhook is what finalizes a payment even when the buyer closes the tab.
Payment links from your server
When your backend already knows the buyer, use an API token with write scope instead of the public key:
curl -X POST https://rempayments.com/api/orgs/1/sessions \
-H "Authorization: Bearer $PTK" -H "Content-Type: application/json" -H "Idempotency-Key: order-8813" \
-d '{"app_id": 3, "plan_id": 12, "buyer": {"email": "jane@example.com", "external_id": "u_42"},
"client_reference_id": "order-8813", "success_url": "https://yourapp.com/thanks?cs={CHECKOUT_ID}"}'The answer includes hosted_url: e-mail it or put it behind a button. This is what the dashboard's Payment Link does.
Paying an invoice
Renewal and manual invoices carry pay_url = https://rempayments.com/pay/?invoice={invoice id}. The page opens a checkout for exactly that invoice; paying marks that invoice paid.
Last updated 18 Nov 2026