Card payments
A naira payment is approved by us in real time. A dollar payment spends the card’s own balance.
{
"id": "ctx_4f1c9a20b7e3d518",
"card_ref": "crd_8a31f0c2d9b4e7",
"amount": 12500,
"fee": "...",
"currency": "NGN",
"merchant": { "name": "SHOPRITE LEKKI", "category": "5411", "country": "NG" },
"channel": "pos",
"status": "approved",
"reason": null,
"refunded": 0,
"at": "..."
}status is approved, declined, reversed (declined by the card network after we approved it; the money and fee came back to you) or refunded (the shop refunded it).
#Naira cards
Naira cards are approved by us in real time against your NGN spendable balance, then charged the payment fee. A payment is declined when:
reason | Why |
|---|---|
insufficient_balance | Your NGN spendable balance can't cover it |
card_frozen | The card is frozen or closed |
channel_off | Online, POS or ATM is switched off for the card |
limit | Your daily spend limit is reached |
unavailable | We couldn't approve it in time |
declined_by_you | Your server said no (see Approve payments yourself) |
no_answer | Your server didn't answer within 2 seconds and your default is decline |
#Approve payments yourself (optional)
Turn this on if you keep each user's money in your own system and want the final say on every naira card payment, for example to stop a user spending more than they hold with you.
- Save an https address under Cards > Payment approval on the dashboard, and choose what happens if your server doesn't answer in time: decline (the default) or approve. Test and live have their own setting.
- For each naira card payment we run our own checks first: card active, channel on, your NGN spendable balance, your daily limit. If we'd decline, we decline without asking you. If we'd approve, we POST to your address and wait up to 2 seconds.
- You can decline a payment we'd approve. You can't approve one we'd decline.
- Dollar cards aren't asked: the card network decides them from the card's own balance. You control dollar spending by how much you load.
- In test mode,
/simulateasks your test address the same way.
We send this, signed like your webhooks: X-Paymonetra-Signature is the HMAC-SHA512 of the raw body with your webhook secret for that mode, and X-Paymonetra-Event is card.authorization.request.
{
"event": "card.authorization.request",
"mode": "live",
"created_at": "2026-11-20T14:02:10+01:00",
"data": {
"id": "ctx_4f1c9a20b7e3d518",
"card_ref": "crd_8a31f0c2d9b4e7",
"card_reference": "card-1001",
"cardholder_ref": "chd_51c0e9a3f7d2b8",
"last4": "4821",
"amount": 12500,
"fee": "...",
"currency": "NGN",
"merchant": { "name": "SHOPRITE LEKKI", "category": "5411", "country": "NG" },
"channel": "pos",
"card_balance": { "spendable": 750010 }
}
}Answer with HTTP 200 and { "approved": true }, or { "approved": false, "reason": "wallet_empty" }.
{ "approved": true }{ "approved": false, "reason": "wallet_empty" }approvedmust be JSONtrueorfalse. Anything else, a status other than 2xx, or no answer within 2 seconds counts as no answer, and your default applies.reasonis optional, up to 100 characters, and is kept on the transaction for you.data.idis the transaction id you then see incard.transaction.approvedorcard.transaction.declinedand inGET /card_transactions.- Check the signature before you trust a request. Answer fast: one lookup, then reply. Anything slower, do after you answer.
- A transaction you were asked about carries
your_server:{ "answer": "approved", "reason": null, "response_ms": 120 }, whereanswerisapproved,declinedorno_answer. - Send test on the dashboard posts a sample with
"test": true. Nothing is approved or charged.
#Checking it and answering
Check the signature the same way as a webhook, then answer from one lookup. Use the webhook secret for the mode this address is saved under.
const crypto = require('crypto')
app.post('/card-approval', express.raw({ type: 'application/json' }), async (req, res) => {
const sent = req.get('X-Paymonetra-Signature') || ''
const expected = crypto
.createHmac('sha512', process.env.PAYMONETRA_WEBHOOK_SECRET)
.update(req.body)
.digest('hex')
const a = Buffer.from(sent)
const b = Buffer.from(expected)
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) return res.sendStatus(401)
const { data } = JSON.parse(req.body.toString())
// One lookup, then answer. Do anything slower after you reply.
const wallet = await wallets.byCardRef(data.card_ref)
if (wallet && wallet.available >= data.amount) return res.json({ approved: true })
res.json({ approved: false, reason: 'wallet_empty' })
})$secret = getenv('PAYMONETRA_WEBHOOK_SECRET');
$raw = file_get_contents('php://input');
$sent = $_SERVER['HTTP_X_PAYMONETRA_SIGNATURE'] ?? '';
if (!hash_equals(hash_hmac('sha512', $raw, $secret), $sent)) {
http_response_code(401);
exit;
}
$data = json_decode($raw, true)['data'];
// One lookup, then answer. Do anything slower after you reply.
$wallet = find_wallet_by_card_ref($data['card_ref']);
header('Content-Type: application/json');
if ($wallet && $wallet['available'] >= $data['amount']) {
echo json_encode(['approved' => true]);
} else {
echo json_encode(['approved' => false, 'reason' => 'wallet_empty']);
}#Dollar cards
Dollar cards spend from their own balance.
Payment codes. When an online payment asks for a one-time code, we send it to you at once as card.otp, for your app to show your user. If you have no webhook URL, or your server doesn't answer, we text it to the cardholder's phone instead. Codes are never retried and never logged; the copy in your delivery log shows ******.
#Reading them
GET /card_transactions?status=¤cy=&channel=&card_ref=&from=&to= lists them across all cards; GET /card_transactions/{id} reads one.