- Native Flexprice Webhooks: Simple, direct POST to your endpoint.
- Svix Webhooks: Advanced, robust delivery with retries, history, signatures, and more (powered by Svix).
Webhook Event Types
You can receive webhook notifications for a range of events:Invoice Events
invoice.create.drafted
- Fired when a new invoice is created in draft stateinvoice.update.finalized
- Fired when an invoice is finalized and ready for paymentinvoice.update.payment
- Fired when a payment is recorded on an invoiceinvoice.update.voided
- Fired when an invoice is voidedinvoice.payment.overdue
- Fired when an invoice payment is overdue
Subscription Events
subscription.created
- Fired when a new subscription is createdsubscription.updated
- Fired when a subscription is updatedsubscription.paused
- Fired when a subscription is pausedsubscription.cancelled
- Fired when a subscription is cancelledsubscription.resumed
- Fired when a paused subscription is resumed
Feature Events
feature.created
- Fired when a new feature is createdfeature.updated
- Fired when feature details are updatedfeature.deleted
- Fired when a feature is deleted
Entitlement Events
entitlement.created
- Fired when a new entitlement is createdentitlement.updated
- Fired when entitlement details are updatedentitlement.deleted
- Fired when an entitlement is deleted
Wallet Events
wallet.created
- Fired when a new wallet is createdwallet.updated
- Fired when wallet details are updatedwallet.terminated
- Fired when a wallet is terminatedwallet.transaction.created
- Fired when a new wallet transaction is created
Payment Events
payment.created
- Fired when a new payment is createdpayment.updated
- Fired when payment details are updatedpayment.failed
- Fired when a payment attempt failspayment.success
- Fired when a payment is successfulpayment.pending
- Fired when a payment is awaiting processing
Customer Events
customer.created
- Fired when a new customer is createdcustomer.updated
- Fired when customer information is updatedcustomer.deleted
- Fired when a customer is deleted
Webhook Payload Format
Every webhook payload follows this structure:- All event types use this base schema
- The payload field contains event-specific data
How Webhook Delivery Works
Native Webhook System
- Default mode.
- When a subscribed event occurs, Flexprice makes a simple HTTP POST to your provided webhook URL.
- A JSON payload with event data is sent.
- If your endpoint responds with a
2xx
status, the event is marked as delivered. - If your endpoint fails (non-2xx, timeout, etc.), Flexprice attempts retries with the following configuration:
- Maximum retries: 3 (default)
- Initial interval: 1 second
- Maximum interval: 10 seconds
- Multiplier: 2.0
- Maximum elapsed time: 2 minutes
Svix Webhook System
- Advanced mode (opt-in; see Svix docs for more on their delivery system).
- When enabled, Flexprice hands off event delivery to Svix.
- Svix provides:
- Robust retries: Automatic, exponential backoff, no event lost due to transient issues
- Delivery guarantees: At-least-once delivery, dead-letter queues for persistent failures
- Message history and logs: Track every delivery, status, and error online
- Signature verification: Every request is signed with HMAC-SHA256 for security
- Versioning & secret management: Change secrets or endpoint URLs safely without missed events
- 5 minutes after the first failure
- 30 minutes after the second failure
- 2 hours after the third failure
- 5 hours after the fourth failure
- 10 hours after the fifth failure
Setting Up Webhooks
To enable webhooks on flexprice:- Go to the Webhooks section in your Flexprice dashboard
- Click the Add Endpoint button
- Enter your endpoint URL (e.g.,
https://play.svix.com/in/e_...
) - The endpoint will be created with a 0.0% error rate initially
- You can monitor message delivery, view logs, and track activity in the dashboard
- View the error rate for message delivery
- Access message logs with detailed delivery information
- See historical delivery attempts and statistics
- Monitor webhook activity in real-time
- Event type
- Message ID
- Timestamp
- Delivery status
- Detailed error information if delivery fails
Security & Verification
- Every payload is signed using HMAC-SHA256 (default) or Ed25519
- Verify signatures using:
- Svix’s official SDKs
- Manual verification using
svix-signature
,svix-id
, andsvix-timestamp
headers
- Automatic timestamp validation prevents replay attacks
- Optional IP address validation
Best Practices
- Use Svix for Production: If you’re building a production system, use Svix for its reliability and security features.
- Always Verify Signatures: Whether using native or Svix webhooks, always verify the authenticity of incoming webhooks.
- Process Asynchronously: Handle webhook processing in the background to avoid timeouts.
- Be Idempotent: Design your handlers to safely process duplicate events.
- Use HTTPS: Always use HTTPS endpoints for webhook delivery.
- Monitor Deliveries: Regularly check webhook logs for failed deliveries.
- Quick Response: Your endpoint should respond within 5 seconds to avoid timeouts.