Webhooks
Verify and parse Recur webhook payloads using @recur/sdk.
Webhooks
Recur posts signed JSON to your webhook URL on every subscription event. Use verifyWebhookSignature and parseWebhookPayload from @recur/sdk to validate and parse incoming requests.
Signing scheme
| Header | Value |
|---|---|
X-Recur-Signature | sha256= + hex HMAC of "${timestamp}.${rawBody}" |
X-Recur-Timestamp | Unix seconds at dispatch time |
The HMAC key is your per-app webhook secret from the Recur dashboard. Requests older than 5 minutes (default tolerance) are rejected.
verifyWebhookSignature
parseWebhookPayload
Express example
Next.js App Router example
Event types
| Event | Trigger |
|---|---|
subscription_created | Subscription registered after on-chain initialize |
payment_success | Keeper pulled and confirmed a payment |
payment_failed | Payment attempt failed (insufficient funds, delegation exhausted) |
cancel_requested | request_cancel called by subscriber or merchant |
cancel_finalized | Prepaid period elapsed, PDA closed |
cancel_forced | Merchant called force_cancel |
delegation_revoked | Subscriber manually revoked SPL Token delegation |
platform_pro_activated | Platform pro subscription activated |
platform_pro_past_due | Platform pro payment overdue |
platform_pro_downgraded | Platform pro downgraded due to non-payment |
Retry policy
Recur retries failed deliveries at 1m, 5m, 30m, 2h, 12h. Your endpoint should:
- Respond
2xxwithin 5 seconds - Deduplicate on
event.data.id