Websites11 min read

Verify a Paystack webhook signature in Node.js in Lagos in 2026

Mohamed Bah·Fondateur, Kolonell
August 25, 2026
Share:
Verify a Paystack webhook signature in Node.js in Lagos in 2026

Verify a Paystack webhook signature in Node.js in Lagos in 2026

Websites

The verdict in three sentences

A Paystack webhook must be signature-verified, idempotent and protected by an exponential retry — otherwise a payment can be double-counted or spoofed. In Lagos in 2026, local collection runs around 1.5%, with automatic retries on failed deliveries. Settlement is typically T+1 for local transactions, which still demands strict server-side reconciliation.

The three pillars of a reliable webhook

In Node.js, you read the raw body, recompute the HMAC-SHA512 signature with your secret key, then store the transaction reference to reject duplicates. You respond 200 fast and process in the background.

PillarMechanismEffect
AuthenticityHMAC-SHA512 on raw bodyRejects fake events
IdempotencyUnique key (reference) in DBPrevents double-counting
RobustnessExponential retry + queueAbsorbs redeliveries
TraceabilityTimestamped log per eventEases auditing
Fast responseImmediate 200, async workAvoids timeouts

Error codes and settlement delays

Paystack returns statuses you must map precisely so you never fulfil an order on a pending payment.

Code / statusMeaningServer action
successPayment confirmedFulfil after idempotency
pendingAwaiting confirmationWait, do not fulfil
failedCard/PIN declinedMark failed, notify
reversedCharge reversedRoll back fulfilment
duplicateEvent already receivedIgnore (idempotency)
settlement T+1Funds paid outReconcile with statement

These values are a 2026 order of magnitude; exact labels depend on your merchant contract.

Need a professional website?

Kolonell builds websites that attract clients, optimized for the Sénégalese market. Free quote in 2 minutes.

Mini case study

Chidi runs an online shop in Lagos collecting ₦3,000,000 per month via Paystack. Before hardening, an idempotency bug made him ship 12 duplicate orders in one month, roughly ₦180,000 lost. After adding a unique constraint on reference and signature verification, duplicates dropped to zero, with a stable collection cost near ₦45,000/month (~1.5%).

FAQ

Why read the raw body instead of parsed JSON? Because the signature is computed over the exact bytes received. If middleware reformats the JSON, the hash no longer matches and every check fails.

How do I guarantee idempotency? Store the reference with a unique constraint. On receipt, attempt the insert: if it fails on duplicate, respond 200 without reprocessing.

What should I do on a pending status? Nothing on the order side. Wait for a verified success event before fulfilling anything.

Why does settlement timing matter? A success status does not mean funds are available. Reconcile your successes daily against the settlement statement to catch discrepancies.

Let's talk about your project. We harden your Paystack webhook in Node.js with signature checks, idempotency and retries. WhatsApp +221 77 596 93 33.

Tags:#paystack#webhook#node.js#security#lagos#nigeria#idempotency#2026
Share:

Mohamed Bah

Fondateur, Kolonell

Passionate about digital and entrepreneurship in Africa, Mohamed has been helping Sénégalese businesses with their digital transformation since 2020. Founder of Kolonell, he believes every SME deserves a professional and accessible online présence.