Receive Paystack webhook events
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 inmetadata.inspectionId, exactly asGET /transaction/inspection/verify/{reference}does (paymentStatus->paid,status->scheduled,paymentReference,agentIdandagentFeeset, Google Calendar event created for the payer). Idempotent; skipped when the inspection is unknown, already paid, for a different property, or underpaid.PROPERTY_BOOKING(withmetadata.propertyId): runsBooking.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;paymentStatusandpaymentReferenceare not fields of the Booking schema, so they are not persisted; and if no booking matches, the upsert inserts a bare booking withoutlandlordId,typeor dates. No notification orbooking:updatedevent is sent.
Success is HTTP 200 with { "received": true } (not the standard envelope).
x-paystack-signature*stringHex HMAC-SHA512 of the JSON body, keyed with the Paystack secret key.
application/json- body
event*stringPaystack 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).
Signature valid; event processed or ignored.
application/json- response
received*booleancurl -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" } }}'{ "received": true}List my transaction history GET
Returns a page of Transaction records where the caller is parties.from or parties.to, newest first, with propertyId populated (title, location, media, pricing).
Get a transaction by ID GET
Returns one Transaction record with propertyId populated (title, location, media, pricing), but only when the caller is parties.from or parties.to; someone else's transaction is...