Skip to main content
This guide will get you from zero to a running webhook server that creates Cryptlex users and licenses from payment events. We’ll use the Stripe integration as an example, but the process is similar for FastSpring and Paddle.

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

1

Clone the repository

Clone the integration repository to your local machine:
git clone https://github.com/cryptlex/third-party-integrations.git
cd third-party-integrations
2

Install dependencies

Install the required npm packages:
npm install
3

Configure environment variables

Create a .env file in the project root with your configuration:For Stripe:
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret_here
CRYPTLEX_PRODUCT_ID=your-cryptlex-product-id
CRYPTLEX_ACCESS_TOKEN=your-cryptlex-access-token
CRYPTLEX_WEB_API_BASE_URL=https://api.cryptlex.com/v3
For FastSpring:
FASTSPRING_WEBHOOK_SECRET=your-hmac-secret
CRYPTLEX_ACCESS_TOKEN=your-cryptlex-access-token
CRYPTLEX_WEB_API_BASE_URL=https://api.cryptlex.com/v3
For Paddle:
PADDLE_WEBHOOK_SECRET=your-paddle-webhook-secret
CRYPTLEX_ACCESS_TOKEN=your-cryptlex-access-token
CRYPTLEX_WEB_API_BASE_URL=https://api.cryptlex.com/v3
Your Cryptlex access token needs the following permissions: license:read, license:write, user:read, user:write
4

Build the server

Build the webhook server for your chosen platform:
npm run build:stripe:node
This compiles TypeScript and bundles the application into ./dist/index.node.js.
5

Run the server

Start the webhook server:
node dist/index.node.js
The server starts on port 9890 by default and listens for webhooks at /v1.
The server expects environment variables to be available. You can use a tool like dotenv or set them directly in your shell.

Testing with a webhook

Now that your server is running, let’s test it with a webhook event.
1

Expose your local server

Use a tool like ngrok to expose your local server to the internet:
ngrok http 9890
Copy the HTTPS forwarding URL (e.g., https://abc123.ngrok.io).
2

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 .env file
FastSpring:
  • Go to Integrations → Webhooks in FastSpring
  • Add your webhook URL: https://abc123.ngrok.io/v1
  • Generate an HMAC secret and add it to your .env file
  • Subscribe to: order.completed, subscription.charge.completed, subscription.payment.overdue, subscription.deactivated
Paddle:
  • Go to Developer Tools → Notifications in Paddle
  • Add webhook destination: https://abc123.ngrok.io/v1
  • Copy the webhook secret to your .env file
  • Select events: transaction.completed, subscription.paused, customer.created
3

Trigger a test event

Use your payment platform’s test mode to trigger a webhook event:Stripe:
  • Use the Stripe CLI to trigger a test event:
stripe trigger checkout.session.completed
FastSpring/Paddle:
  • Create a test order in their respective dashboards
4

Verify the integration

Check your server logs to see the webhook being processed:
Stripe webhook event:evt_test_123 with type:checkout.session.completed verified.
Created user: [email protected]
Created license: license-key-abc123
Then verify in your Cryptlex dashboard that the user and license were created.
Make sure to update your webhook secret in the .env file if you’re testing with the Stripe CLI. The CLI uses a different webhook secret than your Stripe Dashboard webhooks.

Deployment

Once you’ve tested locally, deploy to production:

Deploy with Docker

Build and run the Docker container:
# Build for your chosen platform
docker build --build-arg PAYMENT_PLATFORM=stripe -t cryptlex-stripe .

# Run the container with environment variables
docker run -p 9890:9890 \
  -e STRIPE_WEBHOOK_SECRET=whsec_your_secret \
  -e CRYPTLEX_PRODUCT_ID=your_product_id \
  -e CRYPTLEX_ACCESS_TOKEN=your_token \
  -e CRYPTLEX_WEB_API_BASE_URL=https://api.cryptlex.com/v3 \
  cryptlex-stripe
Replace stripe with fastspring or paddle for other integrations.

Deploy to AWS Lambda

The repository includes a GitHub Actions workflow for AWS Lambda deployment:
  1. Review .github/workflows/aws.yml for setup instructions
  2. Configure AWS credentials as GitHub secrets
  3. Build using the AWS target: npm run build:stripe:aws
  4. 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:
  1. Automatically create users - When customers complete payments, they become Cryptlex users
  2. Issue licenses - Each purchase or subscription generates a license
  3. Manage lifecycle - Renewals, suspensions, and cancellations are handled automatically
  4. Verify security - All webhooks are cryptographically verified before processing
You can monitor webhook activity in your payment platform’s dashboard and see the resulting users and licenses in Cryptlex.

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
User or license not created:
  • Check that your Cryptlex access token has the required permissions
  • Verify that the CRYPTLEX_PRODUCT_ID is correct (for Stripe)
  • Look at server logs for detailed error messages
Environment variables not found:
  • Make sure your .env file is in the correct location
  • If using Docker, ensure environment variables are passed with -e flags
  • For AWS Lambda, configure environment variables in the Lambda console
For additional support, contact [email protected] or consult the platform-specific integration guides.

Build docs developers (and LLMs) love