Receive Pandascrow escrow webhook events
Access: No user token. The request is verified by its signature header.
Server-to-server endpoint called by Pandascrow (the escrow provider); not for client use. It is mounted on the app root, outside /api/v1, and its responses use Pandascrow's { status: boolean, message? } shape rather than the standard envelope.
Verification. The raw request bytes are captured before JSON parsing (any content type, 1 MB limit). X-Pandascrow-Signature must be the hex HMAC-SHA256 of that raw body keyed with the Pandascrow secret key; the header is trimmed and lower-cased and compared in constant time. If X-Pandascrow-Timestamp (Unix seconds) is present and numeric, it must be within 5 minutes of server time; a missing timestamp is tolerated. The event name is read from the body's event, falling back to the X-Pandascrow-Event header.
Events. The escrow is looked up by EscrowTransaction.pandascrowEscrowId = data.escrow_id (or data.escrow_data._id). EscrowTransaction.status is one of pending, funded, completed, disputed, cancelled.
escrow.paid:pending->fundedonly (so a late or repeated delivery never rolls a completed/disputed escrow back) andpaymentNotifiedAtis set. The buyer, seller and commission-earning agent get anescrow_fundednotification, and the buyer's socket room receivesescrow:status_updatedwith{ escrowTxId, status: "funded" }.escrow.completed: status ->completedwithcompletedAt, from any previous status.escrow_completednotifications go out only if it was not already completed. Disbursement is then triggered in the background (records the seller's release, pays the agent commission and platform fee; idempotent), and the buyer receivesescrow:status_updatedwithstatus: "completed".escrow.dispute.opened/escrow.disputed: status ->disputedunless already disputed; parties get anescrow_disputednotification once.escrow.payout.completed: records the outcome of Pandascrow's release to the seller's bank fromdata.payouton the seller-proceedsPayoutrow:bank_succeeded->success; bank failed but the platform wallet was credited (wallet_succeeded) ->failed, which returns the proceeds to the seller's withdrawable balance; anything else staysprocessingfor manual review. Ignored when the escrow is unknown or was opened without a seller bank account; a payout already recorded assuccessis never downgraded.milestone.paid: escrow (id fromdata._idordata.escrow_id) ->fundedwithpaymentNotifiedAt, with no status guard and no notification.recurring.payment: logged only (not implemented).escrow.created,invoice.paid,wallet.deposit.success: acknowledged, no action.- Any other event: logged as unknown and still acknowledged.
Every verified delivery is answered with exactly { "status": true }, including unknown events and escrow ids that match nothing, because Pandascrow treats any other body as a failed delivery and retries. A handler error returns 500 so Pandascrow retries.
X-Pandascrow-Signature*stringHex HMAC-SHA256 of the raw request body, keyed with the Pandascrow secret key.
X-Pandascrow-Timestamp?integerUnix time in seconds; rejected when more than 5 minutes from server time.
X-Pandascrow-Event?stringEvent name, used when the body has no event field.
application/json- body
event?stringEvent name: escrow.paid, escrow.completed, escrow.dispute.opened, escrow.disputed, escrow.payout.completed, milestone.paid, recurring.payment, escrow.created, invoice.paid or wallet.deposit.success. Falls back to the X-Pandascrow-Event header.
data*Event payload. The handler reads escrow_id (or escrow_data._id), escrow_data.amount / currency (logging only) and, for escrow.payout.completed, the payout object (bank_succeeded, wallet_succeeded, recipient_uuid, amount, reference, provider_reference, failure_reason, status).
timestamp?integerEvent time as sent by Pandascrow. Only logged; replay protection uses the header.
Delivery verified and handled (or acknowledged with no action).
application/json- response
status*booleancurl -X POST 'http://localhost:4000/webhooks/pandascrow' \ -H 'X-Pandascrow-Signature: string' \ -H 'Content-Type: application/json' \ -d '{ "event": "escrow.paid", "timestamp": 1764062561, "data": { "escrow_id": 48213, "escrow_data": { "_id": 48213, "status": "funded", "amount": 4500000, "currency": "NGN" } }}'{ "status": true}