Skip to main content
Webhooks let your application react to events happening in Borga without polling the API. When something significant occurs — a payment succeeds, a subscription is canceled, an invoice is paid — Borga sends an HTTP POST request to a URL you control. Your server receives the event, verifies its authenticity using the HMAC signature, and takes whatever action your application requires.
1

Create a webhook endpoint

Register a publicly reachable HTTPS URL with Borga and specify which event types you want to receive.
The response includes a secret (prefixed whsec_…). Store this secret securely — you will use it to verify the signature on every incoming delivery. Borga only shows the secret once at creation time.
Webhook endpoints must be reachable over HTTPS. Borga will not deliver events to plain HTTP URLs or to localhost. During development, use a tunnel such as ngrok or a similar tool to expose a local server.
2

Verify webhook signatures

Borga signs every delivery with an HMAC-SHA256 signature computed from the raw request body and a timestamp. Verify the signature before processing any event to ensure the delivery genuinely came from Borga.Each delivery includes two headers:Compute the expected signature and compare it to the one in the header:
Node.js
Also check that the timestamp is recent (within 5 minutes) to protect against replay attacks:
Node.js
3

Handle events

Build a route in your application to receive deliveries, verify the signature, and dispatch on the event type.
Node.js (Express)
Always return a 2xx response immediately after verifying the signature, even if your processing logic fails or is queued asynchronously. If Borga does not receive a 2xx within 30 seconds, it marks the delivery as failed and will retry. Returning a non-2xx status will trigger unnecessary retries and may cause duplicate processing.
4

Retry failed deliveries

If your endpoint is down or returns a non-2xx response, Borga marks the delivery as failed. You can trigger a manual retry from the API once your endpoint is back online.
curl
Borga also retries failed deliveries automatically on an exponential backoff schedule. Check the delivery log to see the current status.
5

List delivery history

Inspect past deliveries for a specific endpoint to debug failures or confirm that events were received.
curl
Each delivery record includes the event type, the HTTP response code your endpoint returned, and the response latency. Use this to diagnose endpoints that are timing out or returning errors.

Event reference

The following events are available to subscribe to:

Event object shape

Every delivery is a POST with a JSON body in this shape:
The data object is the full resource that triggered the event.

Manage existing endpoints

You can update or delete webhook endpoints at any time:
List endpoints
Update events list
Delete endpoint

Next steps

  • Accept a payment — build the payment flow that generates payment.succeeded events
  • Subscriptions — trigger subscription.created and invoice.paid events with recurring billing
  • Accounting link — automatically sync invoices to your accounting software when invoice.paid fires