Developers

Webhooks

Get notified the moment a checkout is paid, expired or cancelled.

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

  1. Add the endpoint

    In Dashboard → Developers, add an HTTPS URL on your server and choose its events.

  2. Copy the signing secret

    Each endpoint has a secret starting with whsec_. Use it to verify signatures.

  3. Send a test event

    Send test event delivers a ping right away and shows your server's response.

Events

EventSent when
checkout.createdA checkout was created: from your dashboard, the API, or a payment link.
checkout.processingThe customer's payment arrived and is being converted to ZEC.
checkout.paidThe payment settled to your shielded address. Fulfil the order.
checkout.cancelledThe checkout was cancelled.
checkout.expiredThe 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: false in production; they come from test terminals.
Webhook URLs must be public https addresses. URLs pointing to private or local networks are rejected.