Webhooks tell your server when something happens to a checkout, so you can fulfil orders automatically. PetraPay sends each event as a signed JSON POST.
Set up an endpoint
Add the endpoint
In Dashboard → Developers, add an HTTPS URL on your server and choose its events.
Copy the signing secret
Each endpoint has a secret starting with
whsec_. Use it to verify signatures.Send a test event
Send test event delivers a
pingright away and shows your server's response.
Events
| Event | Sent when |
|---|---|
| checkout.created | A checkout was created: from your dashboard, the API, or a payment link. |
| checkout.processing | The customer's payment arrived and is being converted to ZEC. |
| checkout.paid | The payment settled to your shielded address. Fulfil the order. |
| checkout.cancelled | The checkout was cancelled. |
| checkout.expired | The checkout expired before it was paid. |
Payload
POST /webhooks/petrapay
Content-Type: application/json
PetraPay-Signature: t=1791190800,v1=5f2b…
PetraPay-Event-Id: evt_7Hq2cPx1…
PetraPay-Event-Type: checkout.paid
{
"id": "evt_7Hq2cPx1…",
"object": "event",
"type": "checkout.paid",
"created": 1791190800,
"data": {
"object": { "object": "checkout", "id": "G8VN5idaQDX6", "status": "paid", "reference": "order_1001", … }
}
}data.object is the full checkout object at the time of the event.
Delivery and retries
Reply with any 2xx status within 10 seconds. Anything else is retried after 1 minute, 5 minutes, 30 minutes, then 2, 5, 10 and 24 hours, about two days in all. Every attempt is shown in the dashboard with the request and response, and you can resend any delivery.
Best practices
- Reply quickly, then do slow work (emails, fulfilment) in the background.
- Events can arrive more than once or out of order. Skip ones you've seen by their
id. - When in doubt, fetch the checkout for its latest state.
- Ignore events with
livemode: falsein production; they come from test terminals.