Webhooks
Real-time, signed notifications for every payment status change.
Register an endpoint
Register one for every MID, before creating payments.
POST /api/v1/product-apis/psp/webhooks{
"mId": "MID-ABCDEFGHIJ",
"url": "https://your-app.example/webhooks/bxnk",
"secret": "whsec_my_signing_secret",
"isActive": true
}If you omit secret, BXNK generates one. It's returned only on create and rotate. Store it then.
| Action | Call |
|---|---|
| List endpoints | GET /psp/webhooks |
| Enable / disable | PATCH /psp/webhooks/{endpointId}/status |
| Rotate secret | POST /psp/webhooks/{endpointId}/rotate-secret |
Events
payment.created · payment.awaiting_otp · payment.processing · payment.completed · payment.failed · payment.expired · payment.refunded · payment.partially_refunded · payment.cancelled
payment.refunded is emitted only when the completed refunds cover the payment's full amount; a refund that leaves an amount refundable emits payment.partially_refunded instead. Both carry refundId, refundAmount, refundStatus, refundedAmount, remainingRefundableAmount and isFullyRefunded, so use the totals rather than the event name alone.
Non-crypto payloads include paymentId, status, amount, currency, paymentMethod and declineReason when present; the same fields are also sent in snake_case (payment_id, payment_method, and so on). Crypto payloads include the indexed on-chain transfer fields.
Verify the signature
Each request is a JSON POST signed with HMAC-SHA256 over the raw body, sent in x-psp-signature.
const crypto = require('crypto');
app.post('/webhooks/bxnk', express.raw({ type: 'application/json' }), (req, res) => {
const signature = req.headers['x-psp-signature'];
const expected = crypto
.createHmac('sha256', process.env.BXNK_WEBHOOK_SECRET)
.update(req.body)
.digest('hex');
const a = Buffer.from(expected, 'hex');
const b = Buffer.from(signature || '', 'hex');
if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
return res.status(401).send('Invalid signature');
}
const event = JSON.parse(req.body.toString('utf8'));
// handle event.status …
res.sendStatus(200);
});Best practice
- Respond
200quickly and process asynchronously. - Make handlers idempotent: the same event can arrive more than once.
- Treat the webhook as the trigger, and
GET /payments/{paymentId}as the source of truth.
Updated 16 days ago

