An example Node.js app that integrates Keygen with Paddle for accepting payments.
Switch branches/tags
Nothing to show
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
views initial commit Jan 12, 2018
.gitignore initial commit Jan 12, 2018
LICENSE initial commit Jan 12, 2018 initial commit Jan 12, 2018
index.js update paddle signature error message Sep 14, 2018
package.json initial commit Jan 12, 2018
yarn.lock initial commit Jan 12, 2018

Example Keygen + Paddle integration

The following web app is written in Node.js and shows how to integrate Keygen and Paddle together using webhooks. This example app utilizes Paddle subscriptions to showcase how to create a concurrent/per-seat licensing system, where the customer is billed for each active machine that is associated with their license.

The licensing model is implemented by utilizing Paddle's subscription quantity feature. Each time a new machine is associated with a customer's license, the subscription's quantity is incremented by 1; likewise, each time a machine is removed, the subscription's quantity is decremented by 1.

See our Electron example application for ideas on how to integrate this type of licensing into your product.

This example application is not 100% production-ready, but it should get you 90% of the way there. You may need to add additional logging, error handling, as well as listening for additional webhook events.

Running the app

First up, configure a few environment variables:

# Your Paddle vendor ID (available at under "Integrations")

# Your Paddle API key (available at under "Integrations")

# Your Paddle public key (available at under "Public Key")
export PADDLE_PUBLIC_KEY=$(printf %b \
  '-----BEGIN PUBLIC KEY-----\n' \
  'zdL8BgMFM7p7+FGEGuH1I0KBaMcB/RZZSUu4yTBMu0pJw2EWzr3CrOOiXQI3+6bA\n' \
  'efK41Ml6OwZB3tchqGmpuAsCEwEAaQ==\n' \
  '-----END PUBLIC KEY-----')

# Paddle plan ID to subscribe customers to

# Keygen product token (don't share this!)

# Your Keygen account ID

# The Keygen policy to use when creating licenses for new customers
# after they successfully subscribe to a plan

You can either run each line above within your terminal session before starting the app, or you can add the above contents to your ~/.bashrc file and then run source ~/.bashrc after saving the file.

Next, install dependencies with yarn:


Then start the app:

yarn start

Testing webhooks locally

For local development, create an ngrok tunnel:

ngrok http 8080

Next up, add the secure ngrok URL to your Paddle and Keygen accounts to listen for webhooks.

  1. Paddle: add https://{YOUR_NGROK_URL}/paddle-webhooks to under "Alerts", subscribe to subscription_created, subscription_updated, and subscription_cancelled
  2. Keygen: add https://{YOUR_NGROK_URL}/keygen-webhooks to

Testing the integration

Visit the following url: http://localhost:8080 and fill out the Paddle checkout form to subscribe.


Reach out at if you have any questions or concerns!