Integration Examples
Working webhook handlers for Node.js and Python, and payloads for the chargeback, funding and statement events. The Webhooks Overview explains the envelope, the signature, duplicates and retries.
Each handler does four things, in this order:
- Checks the signature against the raw body and responds
401if it doesn’t match. - Skips the event if its
metadata.idempotency_keyhas already been handled. - Saves the event, then records the key. If saving fails, it responds
500so the event is retried. - Responds
200straight away. Do any slow work later, from what you saved.
isValidSignature and is_valid_signature are the functions from Verifying Signatures. The alreadyHandled, saveEvent and markHandled functions stand in for your own storage.
Node.js / Express
Python / Flask
Reporting Event Payloads
These are the payload objects for the reporting events. They arrive in the standard envelope, and source_id is the Run merchant ID. Dates in these payloads are strings in MM/DD/YYYY format.
chargeback.entered
Sent when a chargeback is recorded for a merchant.
funding.entered
Sent when funding information is recorded for a merchant.
statement.entered
Sent when a merchant statement is available.