Leverine · Licensing · Documentation
Webhooks
How a deployment receives Paddle Billing events and turns them into licences: signature verification over the raw body, exactly-once processing, and semantics that never kill a licence on the spot.
Webhooks
The endpoint
/v1/webhooks/paddle
Each deployment exposes one webhook endpoint, and its Paddle notification destination points at it. The order of operations is the security property:
- The signature is verified over the raw body before anything is parsed or stored. An unsigned, forged, or stale delivery changes no state at all — it is not even recorded.
- A verified event is recorded, keyed by Paddle’s event id, and then processed exactly once. A redelivery of an already-processed event is a
200no-op returning the original outcome. - Processing maps the event to one action (below) and writes audit events on the licence.
Fail-closed: while a deployment’s webhook secret is unset, the endpoint answers 503 { "error": "webhook_not_configured" } and accepts nothing — nothing can verify, so nothing is taken on trust.
Signature verification
Paddle’s scheme, as implemented by the receiver:
| Header | Paddle-Signature: ts=<unix seconds>;h1=<hex> |
|---|---|
| Signed payload | <ts>:<raw request body> — the raw body, never re-serialized. |
| Algorithm | HMAC-SHA256 (hex), keyed with the notification destination’s endpoint secret. |
| Freshness | The timestamp must be within ±5 seconds of the receiver’s clock — the same tolerance Paddle’s own SDKs apply, symmetric in both directions. This is the replay protection. |
| Rotation | During secret rotation the header may carry more than one h1; any match verifies. Comparison is constant-time. |
| Failure | HTTP | Body |
|---|---|---|
| Header missing | 400 | { "error": "missing_header" } |
| Header malformed | 400 | { "error": "malformed_header" } |
| Timestamp outside ±5s | 408 | { "error": "stale_timestamp" } |
No h1 matches | 401 | { "error": "bad_signature" } |
| Verified, but not a well-formed event | 400 | { "error": "malformed_event" } or { "error": "invalid_json" } |
Event envelope
The receiver reads three fields from Paddle’s envelope:
{
"event_id": "evt_…",
"event_type": "transaction.completed",
"occurred_at": "2026-12-04T00:00:00.000Z",
"data": { "…": "the transaction or subscription object" }
}
Successful processing answers 200 { "received": true, "outcome": "…" }; a duplicate answers 200 { "received": true, "duplicate": true, "outcome": "…" } with the original outcome.
Webhooks
What each event does
| Event | Action | Outcome |
|---|---|---|
| transaction.completed | The transaction’s item prices are mapped to a product + tier through the deployment’s price table. If the subscription has no licence yet, one is issued (kind paid, linked to the Paddle customer, subscription, and transaction ids). If it already has one, the payment is a renewal: recorded as a paddle.renewal_payment audit event — the record refresh uses to clear grace. |
licence_issued · renewal_recorded |
| transaction.past_due | The matching licence enters grace: stored status grace, grace deadline now + 7 days. Only the first past-due moves the dates — repeats cannot extend grace indefinitely. Nothing is revoked and nothing stops working on the spot. |
licence_marked_grace |
| subscription.canceled | The licence is flagged, never deleted: it stays valid for the period already paid for. If Paddle reports the paid-through date (current_billing_period.ends_at), the licence’s expiry is capped at it — shortening only, never extending — and the grace deadline moves with it (paid-through + 7 days). |
licence_flagged_canceled |
| anything else | Recorded, not acted on. | ignored_event_type |
Other outcomes
| Outcome | Meaning |
|---|---|
| unknown_price | A completed transaction carried no mappable price (no items, or a price id with no active mapping). No licence is issued. |
| ambiguous_items | The transaction’s items map to more than one (product, tier). No licence is issued — a human sorts out the catalogue. |
| no_matching_licence | A past-due or cancellation named a subscription/transaction with no licence on this deployment. |
| issue_failed:<code> | Issuance failed deterministically (e.g. the mapping points at a tier the product doesn’t have). Retrying cannot change it, so the event is recorded with this as its final outcome and acknowledged — the record is the alert. |
Retries
If processing fails transiently, the event is left unprocessed and the endpoint answers 500 { "error": "processing_failed" } so Paddle retries; the retry re-enters processing because the event was never marked processed. Combined with the event-id record, delivery is effectively exactly-once: duplicates return the original outcome, and failures are retried until they land or fail deterministically.
What an integrating customer needs to know
- Your deployment’s destination is configured at onboarding; the endpoint secret lives only as a deployment secret, and the endpoint fails closed without it.
- Enforcement bites at refresh time: the rows and events written here are what refresh and status read. A past-due buyer keeps full function through grace; a cancelled buyer keeps what they paid for; a renewed buyer’s grace clears on their next refresh.
- No webhook ever deletes a licence, and none shortens a licence past the paid-through date.