Webhooks
Alguna provides webhooks to notify you about events that happen in your account. Use webhooks to receive real-time notifications when customers subscribe, invoices are paid, payments fail, and more.Webhooks are delivered via Svix for reliable delivery with automatic retries.
Webhook Format
All webhooks follow the Standard Webhooks specification:| Field | Type | Description |
|---|---|---|
type | string | Event type (e.g., invoice.paid) |
timestamp | string | When the event occurred (RFC3339 format) |
data | object | Event-specific payload |
Supported Events
| Event | Description | Use Case |
|---|---|---|
subscription.activated | Subscription becomes active | Grant product access |
subscription.started | Subscription period starts | Reset usage counters |
subscription.cancelation_scheduled | Cancellation scheduled | Send retention offers |
subscription.canceled | Subscription ends | Revoke product access |
invoice.issued | Invoice finalized | Send custom notifications |
invoice.paid | Invoice fully paid | Confirm continued access |
payment.created | Payment initiated | Track payment attempts |
payment.updated | Payment status changed | Handle success/failure |
refund.updated | Refund status changed | Sync refund status |
line_item.deleted | Line item removed | Update entitlements |
checkout.session.completed | Checkout completed | Provision new customers |
account.credits.granted | Credits added to account | Track credit grants |
account.credits.balance_depleted | Credit balance reached zero | Prompt credit purchase |
Event Payloads
Subscription Events
subscription.activateddraft, active, canceled
Invoice Events
invoice.issued / invoice.paidPayment Events
payment.created / payment.updatedpending_client_action- Requires customer actionpending_authorization- Awaiting authorizationprocessing- Being processedcompleted- Successfully processedfailed- Payment failed
Checkout Events
checkout.session.completedCredit Events
account.credits.grantedmonetary, units
Setting Up Webhooks
- Navigate to Settings → Webhooks in the dashboard
- Click Add Endpoint
- Enter your endpoint URL
- Select which events to receive
- Copy the signing secret for verification
- Save
Responding to Webhooks
Return a 2xx status code (200-299) within 15 seconds to acknowledge receipt. If using a framework with CSRF protection, disable it for your webhook endpoint.Verifying Webhook Signatures
Always verify webhook signatures to ensure they’re from Alguna. Use the Svix SDK:svix-idsvix-timestampsvix-signature
Retry Policy
Failed webhook deliveries are retried with exponential backoff:| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 5 seconds |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
| 6 | 5 hours |
| 7 | 10 hours |
| 8 | 10 hours |
IP Whitelist
If your endpoint is behind a firewall, allow these Svix IP addresses:Best Practices
Respond Quickly
Return 2xx within 15 seconds. Process asynchronously if needed.
Handle Duplicates
Use event IDs for idempotency. Events may be delivered multiple times.
Verify Signatures
Always verify webhook signatures using the Svix SDK.
Log Everything
Log event IDs for debugging and audit trails.