Card webhooks
Card events go to the same webhook URL and are signed the same way as the rest of the API.
{
"event": "card.transaction.approved",
"mode": "live",
"created_at": "2026-11-20T14:02:11+01:00",
"data": {
"id": "ctx_4f1c9a20b7e3d518",
"card_ref": "crd_8a31f0c2d9b4e7",
"card_reference": "card-1001",
"cardholder_ref": "chd_51c0e9a3f7d2b8",
"amount": 12500,
"fee": "...",
"currency": "NGN",
"merchant": { "name": "SHOPRITE LEKKI", "category": "5411", "country": "NG" },
"channel": "pos",
"status": "approved",
"card_balance": { "spendable": 737485 }
}
}#The events
| Event | When |
|---|---|
card.created | A card is active |
card.failed | A card we were confirming (202 pending_confirmation) couldn't be created; everything taken for it is back in your balance |
card.transaction.approved | A payment was approved |
card.transaction.declined | A payment was declined, or "reversed": true when declined after approval and the money came back |
card.transaction.refunded | A shop refunded a payment |
card.funded | A dollar load landed |
card.withdrawn | A dollar withdrawal landed in your USD balance |
card.frozen | A card was frozen, with reason |
card.terminated | A card was closed, with returned |
card.otp | An online payment needs a one-time code: code, card_ref, card_reference, cardholder_ref, last4. Sent once |
card_balance.funded | Money arrived in a card balance, with amount (what arrived), fee (your top-up fee), net (what was credited) and, for bank deposits, the payer and session_id |
balance.low | Spendable fell below your alert line, with the currency |
#Verifying it
Card events go to the webhook URL you set on the dashboard, signed the same way as your other webhooks (HMAC-SHA512 of the body with your webhook secret). Answer with a 2xx. We retry anything else for about a day, so the same event can arrive twice: use the transaction or card id to ignore repeats.
$secret = getenv('PAYMONETRA_WEBHOOK_SECRET');
$raw = file_get_contents('php://input');
$sent = $_SERVER['HTTP_X_PAYMONETRA_SIGNATURE'] ?? '';
$expected = hash_hmac('sha512', $raw, $secret);
// Compare in constant time, and never decode the body first.
if (!hash_equals($expected, $sent)) {
http_response_code(401);
exit;
}
$event = json_decode($raw, true);
// $event['data']['customer_reference'] is your own id for the customer.
http_response_code(200);const crypto = require('crypto')
// express.raw keeps the bytes. express.json would re-encode them and
// every signature would fail.
app.post('/paymonetra', express.raw({ type: 'application/json' }), (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 event = JSON.parse(req.body.toString())
// event.data.customer_reference is your own id for the customer.
res.sendStatus(200)
})import hmac, hashlib, os
from flask import request, abort
@app.post('/paymonetra')
def paymonetra():
raw = request.get_data() # bytes, not request.json
sent = request.headers.get('X-Paymonetra-Signature', '')
expected = hmac.new(
os.environ['PAYMONETRA_WEBHOOK_SECRET'].encode(),
raw,
hashlib.sha512,
).hexdigest()
if not hmac.compare_digest(expected, sent):
abort(401)
event = request.get_json()
# event['data']['customer_reference'] is your own id for the customer.
return '', 200#Which to handle first
card.transaction.approvedandcard.transaction.declinedare the two your users will ask you about.card.createdis how a202finishes. Nothing is usable until it arrives.balance.lowis the one that prevents declines. Fund on it.
The signature header and the retry schedule are the same as webhooks.