Keygen+Paddle

Manage payments with Paddle, licensing with Keygen

In this example, we'll be working with a Node.js app that integrates Keygen and Paddle together using webhooks, allowing them to communicate with eachother, automating our entire payment and license creation flow. We'll create a client-side registration and payment form, while the rest will be handled server-side.

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.

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset='UTF-8'>
    <title>Purchase Software</title>
  </head>
  <body>
    <h1>Purchase Software</h1>
    <button id='checkout-button'>
      Subscribe to Pro
    </button>
    <script src='https://cdn.paddle.com/paddle/paddle.js'></script>
    <script type='text/javascript'>
      Paddle.Setup({
        vendor: <%= PADDLE_VENDOR_ID %>
      })
    </script>
    <script type='text/javascript'>
      const button = document.getElementById('checkout-button')
      button.addEventListener('click', event => {
        Paddle.Checkout.open({
          product: <%= PADDLE_PLAN_ID %>,
          allowQuantity: false
        })
      })
    </script>
  </body>
</html>