Architecture
The Cryptlex Payment Platform Integrations use a webhook-based architecture to synchronize payment events with your Cryptlex account. Each integration is a standalone HTTP server built with the Hono framework that listens for webhooks from payment platforms and makes authenticated API calls to Cryptlex.How it works
Customer completes payment
A customer completes a purchase or subscription payment in your payment platform (Stripe, FastSpring, or Paddle).
Webhook event sent
The payment platform sends a webhook event to your deployed integration server with details about the transaction.
Signature verification
The webhook server verifies the cryptographic signature to ensure the request is authentic and hasn’t been tampered with.
User management
The server checks if a Cryptlex user exists with the customer’s email. If not, it creates a new user account.
License management
Based on the event type, the server creates a new license, renews an existing one, or updates the license status (suspend, resume, delete).
Supported payment platforms
Each integration supports specific webhook events that trigger license operations:Stripe
The Stripe integration handles checkout sessions and recurring invoice payments. Supported events:checkout.session.completed- Creates a user and issues a license when checkout completesinvoice.paid- Renews or creates a license when an invoice is paidcustomer.created- Creates a Cryptlex user when a Stripe customer is created
STRIPE_WEBHOOK_SECRET- Webhook signing secret from StripeCRYPTLEX_PRODUCT_ID- The Cryptlex product ID for licensesCRYPTLEX_ACCESS_TOKEN- API token withlicense:read,license:write,user:read,user:writepermissionsCRYPTLEX_WEB_API_BASE_URL- Base URL for the Cryptlex API
FastSpring
The FastSpring integration manages orders and subscription lifecycle events. Supported events:order.completed- Creates a user and license for completed orderssubscription.charge.completed- Renews a license when a subscription charge succeedssubscription.payment.overdue- Suspends a license when payment is overduesubscription.deactivated- Deletes the license when a subscription is deactivated
FASTSPRING_WEBHOOK_SECRET- HMAC secret for webhook verificationCRYPTLEX_ACCESS_TOKEN- API token withlicense:read,license:write,user:read,user:write, and optionallylicenseTemplate:readfor add-on supportCRYPTLEX_WEB_API_BASE_URL- Base URL for the Cryptlex API
Paddle
The Paddle integration handles transactions and subscription pauses. Supported events:transaction.completed- Creates or renews a license when a transaction completessubscription.paused- Suspends a license when a subscription is pausedcustomer.created- Creates a Cryptlex user when a Paddle customer is created
PADDLE_WEBHOOK_SECRET- Webhook secret for signature verificationCRYPTLEX_ACCESS_TOKEN- API token withlicense:read,license:write,user:read,user:writepermissionsCRYPTLEX_WEB_API_BASE_URL- Base URL for the Cryptlex API
Paddle webhook verification uses the official Paddle SDK (
paddle.webhooks.unmarshal), so no Paddle API key is required.Webhook verification
All integrations verify webhook authenticity before processing events: Stripe: UsesStripe.webhooks.constructEventAsync() to verify the stripe-signature header
FastSpring: Computes HMAC-SHA256 signature and compares with the x-fs-signature header
Paddle: Uses the Paddle SDK to unmarshal and verify the Paddle-Signature header
If verification fails, the webhook is rejected with a 400 error response.
Deployment options
The integrations can be deployed to multiple environments:AWS Lambda
Deploy serverless functions to AWS Lambda using the provided GitHub Actions workflow. Each integration has abuild:*:aws script that bundles the code for Lambda deployment.
Benefits:
- Serverless, scales automatically
- Pay only for actual webhook processing
- Managed infrastructure
Docker containers
Use the includedDockerfile to containerize the webhook server. The multi-stage build produces a minimal Alpine-based image.
Build example:
- Run anywhere Docker is supported
- Consistent deployment environment
- Easy local development and testing
Node.js server
Run directly on any Node.js 22+ environment using thebuild:*:node scripts.
Benefits:
- Simple deployment to VPS or PaaS
- Full control over the runtime
- Standard Node.js debugging tools
API client architecture
All integrations useopenapi-fetch with Cryptlex’s OpenAPI types for type-safe API calls:
- Full TypeScript autocomplete for all Cryptlex API endpoints
- Compile-time validation of request and response types
- Automatic authentication via middleware
- Type-safe error handling
Error handling
Each integration includes comprehensive error handling:- Missing environment variables are detected on startup
- Webhook signature verification failures return 400 errors
- Unsupported event types are logged and rejected
- Cryptlex API errors are caught and logged
- All errors include descriptive messages for debugging
Next steps
Quick start
Deploy your first integration in minutes
Stripe integration
Detailed Stripe setup guide