Skip to Content
HomeLink Hub
Transactions & Payments

Receive Paystack webhook events

POST
/api/v1/transaction/webhook/paystack

Access: No user token. The request is verified by its signature header.

Server-to-server endpoint called by Paystack; not for client use. There is no bearer auth. The request is authenticated with the x-paystack-signature header: the handler computes an HMAC-SHA512 of the request body with the Paystack secret key and compares the hex digest to the header. Note that the digest is taken over JSON.stringify(req.body) (the parsed and re-serialised JSON, not the raw bytes) and compared with plain string equality. A missing or wrong signature gets HTTP 401 with the plain-text body Invalid signature.

Only charge.success does anything; every other event is acknowledged and ignored. The branch depends on data.metadata.type:

  • inspection: applies the payment to the inspection in metadata.inspectionId, exactly as GET /transaction/inspection/verify/{reference} does (paymentStatus -> paid, status -> scheduled, paymentReference, agentId and agentFee set, Google Calendar event created for the payer). Idempotent; skipped when the inspection is unknown, already paid, for a different property, or underpaid.
  • PROPERTY_BOOKING (with metadata.propertyId): runs Booking.findOneAndUpdate({ propertyId, tenantId: metadata.userId }, { status: "confirmed", paymentStatus: "paid", paymentReference }, { upsert: true }). Be aware of what that really does: it confirms whichever single booking of that tenant on that property MongoDB matches first, regardless of its type or current status; paymentStatus and paymentReference are not fields of the Booking schema, so they are not persisted; and if no booking matches, the upsert inserts a bare booking without landlordId, type or dates. No notification or booking:updated event is sent.

Success is HTTP 200 with { "received": true } (not the standard envelope).

Header Parameters

x-paystack-signature*string

Hex HMAC-SHA512 of the JSON body, keyed with the Paystack secret key.

Request Body

application/json
  1. body
event*string

Paystack event name. Only charge.success is acted on.

data*

Paystack transaction object. The handler reads reference, amount (kobo) and metadata (type, inspectionId, propertyId, userId, quotedFee).

Response Body

Signature valid; event processed or ignored.

application/json
  1. response
received*boolean
Example Request
curl -X POST 'http://localhost:4000/api/v1/transaction/webhook/paystack' \  -H 'x-paystack-signature: string' \  -H 'Content-Type: application/json' \  -d '{  "event": "charge.success",  "data": {    "id": 4099260516,    "status": "success",    "reference": "INS-1764062400000-K3F9QZ",    "amount": 500000,    "currency": "NGN",    "channel": "card",    "gateway_response": "Successful",    "paid_at": "2026-11-25T09:22:41.000Z",    "metadata": {      "userId": "663d9a1c5e4b2a0012cd7f10",      "propertyId": "664a0b7e3f2c1d0012ef5a01",      "inspectionId": "6660a2d47c3e5b0012de8f31",      "type": "inspection",      "quotedFee": 5000    },    "customer": {      "email": "chinedu.okafor@example.com"    }  }}'
Example Response
{  "received": true}