Skip to content

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.

  1. Your server creates a payment with POST /payments. You get back a checkout_url.
  2. You send the customer to the checkout_url. They see a bank account to transfer to.
  3. The customer pays from their banking app. RESIV confirms it within seconds.
  4. RESIV sends your server a signed payment.success webhook, then pays your business bank account.

All amounts are whole numbers in kobo. ₦15,000.00 is 1500000. Never send decimals.

Quickstart

  1. 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 called RESIV_SECRET_KEY.
  2. Add your site's address under Developers → Return URLs so customers can be sent back to it.
  3. Create a payment (next section) and open its checkout_url.
  4. 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.

FieldTypeNotes
amountinteger, requiredKobo. Minimum and maximum depend on your business limits.
referencestring, requiredYour own unique id for this payment (letters, numbers, . _ : -, up to 100). You look the payment up by it.
customer.namestring, requiredThe payer's name.
customer.emailstring, requiredThe payer's email.
customer.phonestringOptional.
return_urlhttps URLWhere to send the customer afterwards. Its address must be on your Return URLs list.
descriptionstringUp to 200 characters. Optional.
metadataobjectUp to 20 flat keys (text, number or true/false). Echoed back to you.

Create a payment

Node.js
// 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
Response (201)
{
  "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

Node.js
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.

EventWhen
payment.successThe customer paid in full. Fulfil the order.
payment.expiredThe checkout timed out unpaid.
payout.sentYour money was sent to your bank account.
payout.failedA payout could not be sent. We are already looking at it.
Body
{
  "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

Node.js
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 2xx within 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 payment reference) 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

Node.js
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

StatusMeaningWhat you do
pendingWaiting for the transfer.Wait.
succeededPaid in full. A payout is scheduled.Fulfil the order.
expiredNothing arrived before the checkout closed.Offer a new payment.
cancelledYou cancelled it.Nothing.
failedThe payment could not complete.Offer a new payment.
underpaid, overpaid, late, needs_reviewMoney 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.
refundedA 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

TestLive
Key prefixresiv_sk_test_…resiv_sk_live_…
Money movesNoYes
CheckoutHas a Simulate payment buttonReal bank account to pay
DataSeparate from liveSeparate 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

Error format
{
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "Some fields are invalid",
    "details": [{ "path": "amount", "message": "…" }],
    "requestId": "req_…"
  }
}
HTTPMeaning
400Something in your request is wrong. See details.
401Missing, wrong or revoked secret key.
403The key or your business can't do this (for example live mode before approval).
404No such payment.
409Conflict, such as reusing an Idempotency-Key with a different body.
429Too many requests (240 per minute per key). Wait and retry.
5xxOur 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.success or a server-side GET /payments/{reference}.
  • You tested a real small payment end to end.