PaymonetraDocs

Card payments

A naira payment is approved by us in real time. A dollar payment spends the card’s own balance.

A transaction
{
  "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:

reasonWhy
insufficient_balanceYour NGN spendable balance can't cover it
card_frozenThe card is frozen or closed
channel_offOnline, POS or ATM is switched off for the card
limitYour daily spend limit is reached
unavailableWe couldn't approve it in time
declined_by_youYour server said no (see Approve payments yourself)
no_answerYour 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, /simulate asks 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.

What we send
{
  "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" }.

Approve
{ "approved": true }
  • approved must be JSON true or false. Anything else, a status other than 2xx, or no answer within 2 seconds counts as no answer, and your default applies.
  • reason is optional, up to 100 characters, and is kept on the transaction for you.
  • data.id is the transaction id you then see in card.transaction.approved or card.transaction.declined and in GET /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 }, where answer is approved, declined or no_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.

Node.js
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' })
})

#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

GEThttps://api.paymonetra.com/v1/card_transactionsSecret key
GEThttps://api.paymonetra.com/v1/card_transactions/{id}Secret key
GEThttps://api.paymonetra.com/v1/cards/{card_ref}/transactionsSecret key

GET /card_transactions?status=&currency=&channel=&card_ref=&from=&to= lists them across all cards; GET /card_transactions/{id} reads one.