Webhooks — Node.js
Receive and process DigetPay payment notifications in Node.js.
DigetPay sends HTTP POST notifications to your configured webhook URL when payment events occur. This stub shows the minimum Node.js handler pattern.
Full guide: Handle Webhooks. Configure URLs via Webhook Configuration.
DigetPay may deliver the same event more than once. Always deduplicate by
transactionId+type.
Critical: Return
200 OKwithin a few seconds. Slow handlers cause retries and duplicate processing.
Flow
sequenceDiagram participant DigetPay as DigetPay participant Shop as Your Node Server DigetPay->>Shop: POST JSON payload Shop-->>DigetPay: 200 OK Note over Shop: Process async — mark order paid
Handler stub
// routes/webhooks.js
import express from 'express';
const router = express.Router();
router.post('/webhooks/digetpay', express.raw({ type: 'application/json' }), (req, res) => {
const payload = JSON.parse(req.body.toString());
res.status(200).send('OK');
const { transactionId, orderId, status, type } = payload;
// TODO: Idempotent update — skip if already processed
console.log('DigetPay webhook:', payload);
});
export default router;Example payload
{
"transactionId": "2232e99b-0257-47d5-bbfd-022c8951767f",
"orderId": "PAY-1781872369616",
"amount": 0.2,
"currencyCode": "682",
"status": "Approved",
"type": "Sale",
"cardScheme": "Mada",
"channel": "Payment Gateway"
}See Webhook Events and Webhook Security for signature verification.
Next steps
Updated about 1 month ago
Did this page help you?
