parse_webhook
Verify the Wayl webhook signature, parse the payload, and determine whether the order is paid—all locally with no network call. Reads the correct paymentStatus field for accurate results.
Instructions
Verify a Wayl webhook and summarise what it says about the order.
Use this for any incoming delivery: it authenticates the signature, parses the
payload and reports whether the order is paid, all locally with no network call.
Use `verify_webhook` when a bare valid/invalid boolean is enough, and
`check_order_paid` when polling by reference ID rather than handling a push.
The webhook's `paymentStatus` is a different vocabulary from the REST API's link
`status` — it reports "Paid", which is not one of the eight link statuses. This
tool reads the right field so you do not have to.
Never act on a payload where `verified` is false; that result carries no order
details. `paid` and `safeToFulfil` are deliberately different: while this server is
in test mode a settled payment is simulated, so `safeToFulfil` stays false even when
`paid` is true. Branch on `safeToFulfil`.
Deduplicate on `eventId` before delivering — Wayl retries, and the signature has no
timestamp, so a replayed request stays valid forever. A verified body that is not a
JSON object raises an error rather than returning a false verdict.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| secret | No | The webhookSecret used when this link was created. Wayl scopes secrets per link, so pass the one matching this order. | |
| headers | No | The webhook's headers; the signature header is found automatically. | |
| raw_body | Yes | The webhook request body exactly as received, byte for byte. Wayl sends it with Content-Type: text/plain, so read the raw body rather than relying on a JSON body parser. | |
| signature | No | Value of the x-wayl-signature-256 header. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||