Accept payments with Resbrotherx
One API for cards, Apple Pay, bank transfer, USSD and crypto. Your server creates a checkout; your customer pays in the Resbrotherx popup or payment page; your server gets a signed webhook.
Overview
Everything starts with a checkout session: the amount, currency, customer email and your own order reference. Your customer pays it in the Resbrotherx checkout, which you show in one of two ways:
| Popup | Add inline.js and call ResbrotherxPay.open({ session }). The checkout opens over your page. |
| Redirect | Send the customer to the session’s url. After paying they come back to your success_url. |
Either way, the payment is confirmed on our servers first, then you receive payment.succeeded. Give value (unlock the plan, ship the order) only after that webhook, or after verifying from your server.
Quick start
- Create an account. You start in test mode, with test keys in Dashboard → Developers.
- Put your secret key (
rbx_sk_test_…) in your server’s environment, for exampleRBX_SECRET_KEY. Never put it in browser or app code. - When the customer clicks Pay, your server creates a checkout session and returns its
idto the browser. - The browser opens the popup with that id (or redirects to its url).
- Add your webhook URL in Developers → Webhooks and handle payment.succeeded.
- Pay with a test card or simulated crypto, then ask Resbrotherx to switch on live mode and swap in your live keys.
Keys and modes
Each account has a test and a live key pair. Test and live have separate payments, webhooks and settings.
| rbx_pk_… | Public key. Safe in browsers; used only by inline.js when you create checkouts client-side. |
| rbx_sk_… | Secret key. Server only. Sent as Authorization: Bearer rbx_sk_…. It is shown once when created; roll it in the dashboard if it leaks. |
| whsec_… | Webhook signing secret, one per mode. Used to check that webhooks really came from us. |
Create a checkout
POST /api/v1/checkout/sessions with your secret key.
| Field | Required | Description |
|---|---|---|
| amount | yes | Whole number in the smallest unit: kobo or cents. 1500000 = ₦15,000.00. Minimum 100. |
| currency | no | NGN (default), USD, GHS, KES or ZAR. |
| yes | The customer’s email (or customer.email). Receipts go here. | |
| reference | no | Your unique order id (3–100 of A–Z a–z 0–9 . _ - :). We make one if you leave it out. A reference can only be used once. |
| description | no | Shown on the checkout, e.g. “Pro plan, 1 month”. |
| methods | no | Limit the methods: any of card, apple_pay, bank_transfer, ussd, crypto. |
| success_url | no | Where the redirect checkout sends the customer after paying, with ?reference=…&session=…&status=success added. |
| cancel_url | no | Where “Cancel and return” goes, with status=cancelled. |
| metadata | no | Your own JSON object (up to 4 KB), returned in webhooks. |
curl https://payment.resbrotherx.com/api/v1/checkout/sessions \ -H "Authorization: Bearer rbx_sk_test_…" \ -H "Content-Type: application/json" \ -d '{ "amount": 1500000, "currency": "NGN", "email": "[email protected]", "reference": "order_1042", "description": "Pro plan, 1 month", "success_url": "https://yourshop.com/thanks", "cancel_url": "https://yourshop.com/cart", "metadata": { "user_id": 77 } }'
The response is the session. It stays open for 2 hours.
{
"id": "cs_3q2mE…",
"object": "checkout.session",
"url": "https://payment.resbrotherx.com/pay/cs_3q2mE…",
"mode": "test",
"status": "open",
"amount": 1500000,
"currency": "NGN",
"reference": "order_1042",
"customer": { "email": "[email protected]", "name": "" },
"metadata": { "user_id": 77 },
"expires_at": "2026-11-24T20:15:00Z",
"payment": null
}Popup checkout
Load the script once, then call ResbrotherxPay.open() from a click. The checkout slides up over your page; card, Apple Pay, transfer and USSD details are entered in a secure form inside it, and crypto shows an address and QR code. Customers never leave your site.
<script src="https://payment.resbrotherx.com/v1/inline.js"></script> <button id="pay">Pay ₦15,000</button> <script> document.getElementById('pay').onclick = async () => { // Your server creates the session (see "Create a checkout") const { id } = await fetch('/api/create-checkout', { method: 'POST' }).then((r) => r.json()); ResbrotherxPay.open({ session: id, onSuccess: (result) => { // result = { reference, session, status: 'success', method } // Show "thank you", then confirm on your server before giving value. fetch('/api/confirm?reference=' + result.reference); }, onClose: () => console.log('Checkout closed'), }); }; </script>
| session | The id from your server (recommended). |
| onSuccess(result) | Called once the payment is confirmed. result.reference is your reference. Still confirm on your server. |
| onClose() | Called when the customer closes the popup without paying. |
| ResbrotherxPay.close() | Closes it from your code. |
Redirect checkout
Redirect the customer to session.url (or call ResbrotherxPay.redirect({ session })). The page at payment.resbrotherx.com/pay/cs_… takes the payment and sends them to your success_url, for example:
https://yourshop.com/thanks?reference=order_1042&session=cs_3q2mE…&status=successThe query string is only a hint. Look up the reference on your server before showing “paid”.
Verify a payment
GET /api/v1/verify/:reference returns the session with paid: true|false. If a card payment is still waiting, it checks with the network first, so it is safe to call right after onSuccess or the redirect.
curl https://payment.resbrotherx.com/api/v1/verify/order_1042 \ -H "Authorization: Bearer rbx_sk_test_…"
amount and currency are what you expected before giving value, especially for checkouts created with a public key.Webhooks
Add an HTTPS endpoint in Dashboard → Developers → Webhooks. We POST each event as JSON and expect a 2xx within 12 seconds. Failed deliveries are retried after 1 min, 5 min, 30 min, 2 h, 6 h and 24 h; you can resend any event from the dashboard.
| payment.succeeded | A checkout was paid. The one to act on. |
| payment.failed | An attempt was declined. The customer can still try again with the same checkout. |
| payment.duplicate | A checkout that was already paid was paid again (for example a late crypto transfer). Refund it or credit the customer. |
| ping | Sent by “Send test webhook”. |
Every request has a Resbrotherx-Signature: t=<unix time>,v1=<signature> header, where v1 is the hex HMAC-SHA256 of "<t>.<raw body>" with your webhook secret. Reject requests whose signature doesn’t match or whose t is more than 5 minutes old.
import crypto from 'node:crypto'; import express from 'express'; const app = express(); // Keep the raw body: the signature covers the exact bytes we sent. app.post('/webhooks/resbrotherx', express.raw({ type: 'application/json' }), (req, res) => { const header = req.get('Resbrotherx-Signature') || ''; // "t=1732471000,v1=5f2c…" const parts = Object.fromEntries(header.split(',').map((p) => p.split('='))); const expected = crypto.createHmac('sha256', process.env.RBX_WEBHOOK_SECRET) .update(`${parts.t}.${req.body}`).digest('hex'); const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300; if (!fresh || !parts.v1 || !crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1))) { return res.sendStatus(400); } const event = JSON.parse(req.body); if (event.type === 'payment.succeeded') { fulfil(event.data.reference, event.data.amount, event.data.currency); // make this idempotent } res.sendStatus(200); });
Webhooks can arrive more than once and out of order. Use data.reference to make fulfilment idempotent.
The payment object
POST https://yourshop.com/webhooks/resbrotherx Resbrotherx-Signature: t=1732471000,v1=5f2c9a… Resbrotherx-Event: payment.succeeded { "id": "evt_Q2x…", "object": "event", "type": "payment.succeeded", "mode": "live", "created_at": "2026-11-24T18:16:42Z", "data": { "id": "pay_8Hk2…", "object": "payment", "session": "cs_3q2mE…", "reference": "order_1042", "status": "succeeded", "method": "crypto", "amount": 1500000, "currency": "NGN", "customer": { "email": "[email protected]", "name": "" }, "metadata": { "user_id": 77 }, "crypto": { "coin": "USDT", "network": "Tron (TRC20)", "amount": "9.6837", "received": "9.6837", "txid": "8c1f…" }, "paid_at": "2026-11-24T18:16:41Z" } }
| status | pending, succeeded, failed, abandoned, expired or underpaid (crypto that arrived short). |
| charged | Present when the card was charged in another currency (e.g. a USD checkout charged in NGN). |
| card | Brand, last 4 digits, bank and channel, for card-family payments. |
| crypto | Coin, network, amount due, amount received and transaction hash. |
Methods and currencies
| Method | id | Notes |
|---|---|---|
| Card | card | Visa, Mastercard, Verve. 3-D Secure where the bank requires it. |
| Apple Pay | apple_pay | Shown on Safari and Apple devices that support it. |
| Bank transfer | bank_transfer | A one-time account number for the exact amount. |
| USSD | ussd | Bank short codes, no internet needed. |
| Crypto | crypto | USDT (TRC20, BEP20, ERC20), USDC, BTC, ETH, LTC, SOL. See below. |
Card-family payments are charged in naira. Checkouts in other currencies are converted at the live rate, and the customer sees the converted amount before paying.
Crypto payments
The customer picks a coin and network. The amount is the checkout’s US dollar value at the live price, plus a few hundredths of a cent that make it unique. They send exactly that amount to the address shown, from any wallet or exchange.
- The payment confirms by itself once the network credits it, usually within minutes. You get
payment.succeeded. - If an exchange took a fee out of the amount, the customer can paste their transaction ID; payments within 1% are accepted.
- Less than that is marked
underpaidand our team helps settle it. - The address is valid for 60 minutes; late payments within 6 hours still confirm.
Test mode
Test keys create test checkouts, shown with an orange “Test mode” bar. No real money moves.
| Cards | When the test card form opens, use 4084 0840 8408 4081, any future expiry, CVV 408, PIN 0000, OTP 123456. If it shows “Pay / Decline” buttons instead, choose the outcome. |
| Crypto | A sample address is shown with a “Simulate payment received” button. |
Try it now in the demo store.
API reference
Base URL https://payment.resbrotherx.com. JSON in and out. Authenticate with Authorization: Bearer rbx_sk_….
| Endpoint | What it does |
|---|---|
| POST /api/v1/checkout/sessions | Create a checkout session |
| GET /api/v1/checkout/sessions/:id | Retrieve a session |
| GET /api/v1/checkout/sessions?reference=… | Find sessions by reference |
| GET /api/v1/verify/:reference | Is this order paid? |
| GET /api/v1/payments?status=… | List payments (newest first, limit up to 100) |
| GET /api/v1/payments/:id | Retrieve a payment |
| GET /api/v1/merchant | Your account and the methods it can take in this mode |
Errors
Errors return a 4xx or 5xx status and { "error": { "code", "message" } }. The message is written to be shown to a person.
| 401 unauthorized | Missing, wrong or rolled key. |
| 400 invalid_amount / invalid_email / … | A field is wrong; the message says which. |
| 403 live_not_enabled | Live mode isn’t switched on for your account yet. |
| 409 duplicate_reference | That reference was already used. |
| 429 rate_limited | Too many requests; wait and retry. |