Documentation
Create a payment, send your customer to checkout, and get a signed webhook when they have paid. About ten minutes to a working test integration.
Using an AI coding assistant? Copy a ready-made integration prompt or give it /llms.txt.
How it works
RESIV lets your customers pay you by bank transfer, and pays the money out to your bank account automatically. You never withdraw anything.
- Your server creates a payment with
POST /payments. You get back acheckout_url. - You send the customer to the
checkout_url. They see a bank account to transfer to. - The customer pays from their banking app. RESIV confirms it within seconds.
- RESIV sends your server a signed
payment.successwebhook, then pays your business bank account.
All amounts are whole numbers in kobo. ₦15,000.00 is 1500000. Never send decimals.
Quickstart
- Sign in to your dashboard, open Developers, and create a test secret key (
resiv_sk_test_…). It is shown once. Store it in an environment variable calledRESIV_SECRET_KEY. - Add your site's address under Developers → Return URLs so customers can be sent back to it.
- Create a payment (next section) and open its
checkout_url. - In test mode the checkout shows a Simulate payment button. Press it to see the full flow without moving money.
Keep secret keys on your server. Never put them in a mobile app, a web page or a public repository.
Create a payment
POST /payments with Authorization: Bearer <secret key>. Add an Idempotency-Key header so a retried request never creates a second payment.
| Field | Type | Notes |
|---|---|---|
amount | integer, required | Kobo. Minimum and maximum depend on your business limits. |
reference | string, required | Your own unique id for this payment (letters, numbers, . _ : -, up to 100). You look the payment up by it. |
customer.name | string, required | The payer's name. |
customer.email | string, required | The payer's email. |
customer.phone | string | Optional. |
return_url | https URL | Where to send the customer afterwards. Its address must be on your Return URLs list. |
description | string | Up to 200 characters. Optional. |
metadata | object | Up to 20 flat keys (text, number or true/false). Echoed back to you. |
Create a payment
// amount is in KOBO: 1500000 = ₦15,000.00
const res = await fetch("https://api.resiv.cc/payments", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.RESIV_SECRET_KEY,
"Content-Type": "application/json",
"Idempotency-Key": "order-1001", // a retry never creates a second payment
},
body: JSON.stringify({
amount: 1500000,
reference: "order-1001",
customer: { name: "Ada Obi", email: "ada@example.com" },
return_url: "https://yourshop.com/thanks",
}),
});
const { data } = await res.json();
// Send the customer to data.checkout_url{
"success": true,
"data": {
"id": "665f1c2e9b1f4a0012ab34cd",
"reference": "order-1001",
"status": "pending",
"amount": 1500000,
"amount_paid": null,
"currency": "NGN",
"customer": { "email": "ada@example.com", "name": "Ada Obi", "phone": null },
"checkout_url": "https://pay.resiv.cc/pay/…",
"return_url": "https://yourshop.com/thanks",
"livemode": false,
"expires_at": "2026-01-01T10:30:00.000Z",
"paid_at": null,
"created_at": "2026-01-01T10:00:00.000Z"
}
}A checkout stays open for a limited time (shown in expires_at). Use the same call with a new reference for a new attempt. To cancel an unpaid payment: POST /payments/{reference}/cancel. To list payments: GET /payments?page=1&limit=20&status=succeeded&q=….
Check a payment
GET /payments/{reference} returns the payment (you can also use the id). Always check on your server before you give the customer what they paid for. Do not rely on the browser redirect alone.
Verify before fulfilling
const res = await fetch("https://api.resiv.cc/payments/" + encodeURIComponent(reference), {
headers: { Authorization: "Bearer " + process.env.RESIV_SECRET_KEY },
});
const { data } = await res.json();
if (data.status === "succeeded" && data.amount_paid === expectedKobo) {
// safe to fulfil the order
}Webhooks
Add an endpoint in Developers → Webhooks (https only). RESIV sends a POST with a JSON body for each event, and a signing secret you keep on your server.
| Event | When |
|---|---|
payment.success | The customer paid in full. Fulfil the order. |
payment.expired | The checkout timed out unpaid. |
payout.sent | Your money was sent to your bank account. |
payout.failed | A payout could not be sent. We are already looking at it. |
{
"id": "evt_9f2c…",
"type": "payment.success",
"created": 1767261600,
"livemode": false,
"data": { "object": { /* the payment, as returned by the API */ } }
}Each request has the header X-Resiv-Signature: t=<unix time>,v1=<hex>, where v1 is the HMAC-SHA256 of "<t>.<raw body>" using your signing secret. Compute it from the raw body, compare in constant time, and reject anything older than 5 minutes.
Verify the signature
import crypto from "node:crypto";
// IMPORTANT: use the RAW body string, exactly as received (not re-serialised JSON).
export function isValidResivWebhook(rawBody, header, secret, toleranceSeconds = 300) {
const parts = Object.fromEntries(String(header).split(",").map((p) => p.split("=")));
const t = Number(parts.t);
if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false; // too old: replay
const expected = crypto.createHmac("sha256", secret).update(t + "." + rawBody).digest("hex");
const given = String(parts.v1 ?? "");
return expected.length === given.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(given));
}- Answer with any
2xxwithin 10 seconds. Do slow work after replying. - Failed deliveries retry after 1 min, 5 min, 15 min, 1 h, 3 h, 6 h and 12 h, then stop. You can resend any delivery from the dashboard.
- The same event can arrive more than once. Use the event
id(or the paymentreference) so fulfilling twice does nothing.
Return redirect
When the customer finishes, we send their browser to your return_url with ?reference=…&status=…&sig=…. status is success, expired, cancelled, failed or review. sig is the HMAC-SHA256 of "<reference>.<status>" with your return secret (Developers → Return URLs).
The redirect is for showing the customer a page. It is not proof of payment. Confirm with GET /payments/{reference} or the webhook before fulfilling.
Check the signature
import crypto from "node:crypto";
// On the page customers return to: /thanks?reference=order-1001&status=success&sig=...
const { reference, status, sig } = req.query;
const expected = crypto.createHmac("sha256", process.env.RESIV_RETURN_SECRET)
.update(reference + "." + status).digest("hex");
const looksGenuine = sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
// Even if it looks genuine, confirm with GET /payments/:reference before fulfilling.Payment statuses
| Status | Meaning | What you do |
|---|---|---|
pending | Waiting for the transfer. | Wait. |
succeeded | Paid in full. A payout is scheduled. | Fulfil the order. |
expired | Nothing arrived before the checkout closed. | Offer a new payment. |
cancelled | You cancelled it. | Nothing. |
failed | The payment could not complete. | Offer a new payment. |
underpaid, overpaid, late, needs_review | Money arrived but not as expected (wrong amount, after expiry, or a second transfer). It is held and RESIV staff review it. | Do not fulfil and tell the customer not to pay again. It resolves to succeeded or refunded. |
refunded | A held payment was returned to the customer. | Nothing. |
Fees and payouts
You pay one fee to RESIV: a percentage of each collection plus a flat fee per payout. Your rates are on your dashboard. The rest is paid to your business bank account automatically, a few minutes after each successful payment.
Example at a 2% collection rate and a ₦50 payout fee: customer pays ₦10,000.00, the collection fee is ₦200.00, and your account receives ₦9,750.00. Each paid payment carries a fees object (resiv_fee, merchant_payout) in kobo.
Payout account changes need RESIV approval. Payouts go only to approved accounts in your own name.
Test and live
| Test | Live | |
|---|---|---|
| Key prefix | resiv_sk_test_… | resiv_sk_live_… |
| Money moves | No | Yes |
| Checkout | Has a Simulate payment button | Real bank account to pay |
| Data | Separate from live | Separate from test |
The mode comes from the key, never from the request. Live keys work once your business is approved and has a verified payout account.
Errors and limits
{
"success": false,
"error": {
"code": "validation_error",
"message": "Some fields are invalid",
"details": [{ "path": "amount", "message": "…" }],
"requestId": "req_…"
}
}| HTTP | Meaning |
|---|---|
| 400 | Something in your request is wrong. See details. |
| 401 | Missing, wrong or revoked secret key. |
| 403 | The key or your business can't do this (for example live mode before approval). |
| 404 | No such payment. |
| 409 | Conflict, such as reusing an Idempotency-Key with a different body. |
| 429 | Too many requests (240 per minute per key). Wait and retry. |
| 5xx | Our side. Retry with the same Idempotency-Key. |
Quote the requestId when you contact support.
Go-live checklist
- Your business is approved and your payout account shows as approved.
- You swapped the test key for a live key, stored in an environment variable on your server.
- Your return URL and your webhook endpoint use your live site over https.
- Webhook signatures are verified on the raw body, with a time limit.
- Fulfilment happens once per payment, from
payment.successor a server-sideGET /payments/{reference}. - You tested a real small payment end to end.