Event Overview
The webhook server processes events from three payment platforms: Stripe, FastSpring, and Paddle. Each event triggers specific actions in the Cryptlex license management system.Stripe Events
Triggered when a Stripe invoice payment succeeds.Actions:
- New subscription (
billing_reason: subscription_create): Creates a new user and license - Renewal (
billing_reason: subscription_cycle): Renews existing license by extending expiry date
Triggered when a customer completes a Stripe Checkout session.Actions:
- Creates a new user (if doesn’t exist)
- Creates a new license with subscription ID stored in metadata
Triggered when a new customer is created in Stripe.Actions:
- Upserts user in Cryptlex (creates new or updates existing)
FastSpring Events
Triggered when a FastSpring order is completed.Actions:
- Creates a new user with customer details (first name, last name, company)
- Creates licenses for all items in the order
- Supports bundle products, add-ons, subscription-based, and one-time licenses
- Handles quantity mapping (license count or allowed activations)
Triggered when a subscription payment succeeds.Actions:
- Renews all licenses associated with the subscription
- Unsuspends licenses if they were previously suspended
Triggered when a subscription payment is overdue.Actions:
- Suspends all licenses associated with the subscription
Triggered when a subscription is deactivated (cancelled).Actions:
- Deletes all licenses associated with the subscription
Paddle Events
Triggered when a Paddle transaction completes. Handles multiple scenarios based on transaction origin.Actions by Origin:
weborapi: Creates new user and licenses for initial purchasesubscription-recurring: Renews licenses and unsuspends if neededsubscription-update: Resumes suspended licenses and updates expiry dates
Triggered when a Paddle subscription is paused.Actions:
- Suspends all licenses associated with the subscription
Triggered when a new customer is created in Paddle.Actions:
- Upserts user in Cryptlex with Paddle customer ID stored in metadata
Event Processing Flow
All webhook events follow this general flow:-
Signature Verification: Event payload is verified using platform-specific secrets
- Stripe:
stripe-signatureheader withSTRIPE_WEBHOOK_SECRET - FastSpring:
x-fs-signatureheader withFASTSPRING_WEBHOOK_SECRET(HMAC SHA256) - Paddle:
Paddle-Signatureheader withPADDLE_WEBHOOK_SECRET
- Stripe:
- Event Routing: Event type is extracted and routed to appropriate handler
- Handler Execution: Platform-specific handler processes the event
- Cryptlex API Interaction: Handler calls Cryptlex API to create/update users and licenses
- Response: Returns JSON response with status code and message
Event Registration
Events are registered in the main application files:- Stripe: stripe/lib/app.ts
- FastSpring: fastspring/lib/app.ts
- Paddle: paddle/lib/app.ts
Error Handling
All unsupported event types return a 400 error:- Event ID
- User ID (if created)
- License IDs (if created/modified)
- Specific failure reason