Card quickstart
Five calls against a test key. No real cards and no real money.
#1. Add test money
curl https://api.paymonetra.com/v1/sandbox/card_funding \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{ "currency": "NGN", "amount": 50000 }'POST /sandbox/card_funding with currency and amount. NGN arrives at your test funding account and USD at your test USDT address, like real deposits.
#2. Verify a cardholder
BVN 22222222222 passes with any name in test mode.
curl https://api.paymonetra.com/v1/cardholders \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"reference": "user-1001",
"first_name": "Tunde",
"last_name": "Bakare",
"dob": "1990-05-14",
"phone": "08031234567",
"email": "tunde@example.com",
"address": {
"line1": "12 Allen Avenue",
"city": "Ikeja",
"state": "Lagos",
"postal_code": "100271"
},
"id_type": "bvn",
"id_number": "22222222222"
}'Keep the cardholder_ref that comes back. Every card is issued against one.
#3. Issue a naira card
curl https://api.paymonetra.com/v1/cards \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{
"cardholder_ref": "chd_51c0e9a3f7d2b8",
"currency": "NGN",
"reference": "card-1001",
"controls": { "web": true, "pos": true }
}'{
"card_ref": "crd_8a31f0c2d9b4e7",
"reference": "card-1001",
"cardholder_ref": "chd_51c0e9a3f7d2b8",
"holder_name": "Tunde Bakare",
"currency": "NGN",
"brand": "verve",
"last4": "4821",
"expiry": "11/29",
"status": "active",
"frozen_reason": null,
"balance": null,
"controls": { "web": true, "pos": true, "atm": false },
"next_fee_at": "2026-12-06",
"fee_unpaid_since": null,
"mode": "live",
"created_at": "...",
"issued_at": "...",
"terminated_at": null
}#4. Make a payment happen
curl https://api.paymonetra.com/v1/cards/crd_8a31f0c2d9b4e7/simulate \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{ "amount": 12500, "channel": "pos", "outcome": "approve" }'It runs the real approval against your test NGN balance and sends the real webhooks.
#5. Take the webhook
{
"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 }
}
}Verify the signature over the raw bytes before you trust the body:
$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 '', 200Answer any 2xx. Card webhooks has the event list and the retry schedule.
#Then
- Run it again with
decline_after_approval, so your ledger is right the first time a payment comes back. - Read card prices. Every fee is its own statement line.
- Ask us to review your test calls. Live follows.