Prerequisites
Before you begin, you’ll need:- A Cryptlex account with API access
- A Stripe account (or FastSpring/Paddle for other integrations)
- Node.js 22 or later installed
- Git for cloning the repository
Installation
Configure environment variables
Create a For FastSpring:For Paddle:
.env file in the project root with your configuration:For Stripe:Your Cryptlex access token needs the following permissions:
license:read, license:write, user:read, user:writeBuild the server
Build the webhook server for your chosen platform:This compiles TypeScript and bundles the application into
./dist/index.node.js.Testing with a webhook
Now that your server is running, let’s test it with a webhook event.Expose your local server
Use a tool like ngrok to expose your local server to the internet:Copy the HTTPS forwarding URL (e.g.,
https://abc123.ngrok.io).Configure webhook in your payment platform
Add the webhook endpoint in your payment platform’s dashboard:Stripe:
- Go to Developers → Webhooks in the Stripe Dashboard
- Click “Add endpoint”
- Enter your URL:
https://abc123.ngrok.io/v1 - Select events:
checkout.session.completed,invoice.paid,customer.created - Copy the webhook signing secret to your
.envfile
- Go to Integrations → Webhooks in FastSpring
- Add your webhook URL:
https://abc123.ngrok.io/v1 - Generate an HMAC secret and add it to your
.envfile - Subscribe to:
order.completed,subscription.charge.completed,subscription.payment.overdue,subscription.deactivated
- Go to Developer Tools → Notifications in Paddle
- Add webhook destination:
https://abc123.ngrok.io/v1 - Copy the webhook secret to your
.envfile - Select events:
transaction.completed,subscription.paused,customer.created
Trigger a test event
Use your payment platform’s test mode to trigger a webhook event:Stripe:FastSpring/Paddle:
- Use the Stripe CLI to trigger a test event:
- Create a test order in their respective dashboards
Deployment
Once you’ve tested locally, deploy to production:Deploy with Docker
Build and run the Docker container:stripe with fastspring or paddle for other integrations.
Deploy to AWS Lambda
The repository includes a GitHub Actions workflow for AWS Lambda deployment:- Review
.github/workflows/aws.ymlfor setup instructions - Configure AWS credentials as GitHub secrets
- Build using the AWS target:
npm run build:stripe:aws - Deploy using the GitHub Actions workflow
For detailed deployment guides specific to each platform, see the individual integration documentation.
What happens next
Once deployed, your webhook server will:- Automatically create users - When customers complete payments, they become Cryptlex users
- Issue licenses - Each purchase or subscription generates a license
- Manage lifecycle - Renewals, suspensions, and cancellations are handled automatically
- Verify security - All webhooks are cryptographically verified before processing
Next steps
Stripe integration
Detailed guide for Stripe setup and configuration
FastSpring integration
Complete FastSpring integration documentation
Paddle integration
Full Paddle integration setup guide
Deployment options
Learn about AWS Lambda, Docker, and Node.js deployments
Troubleshooting
Webhook verification fails:- Double-check that your webhook secret matches the one from your payment platform
- Ensure you’re using the correct secret for test vs. production mode
- Verify that the webhook signature header is being sent correctly
- Check that your Cryptlex access token has the required permissions
- Verify that the
CRYPTLEX_PRODUCT_IDis correct (for Stripe) - Look at server logs for detailed error messages
- Make sure your
.envfile is in the correct location - If using Docker, ensure environment variables are passed with
-eflags - For AWS Lambda, configure environment variables in the Lambda console
For additional support, contact [email protected] or consult the platform-specific integration guides.