Skip to main content
The supported way to sell licenses through Stripe is Commerce: paste keys in the dashboard, map prices to license templates, and AuthForge verifies webhooks, deduplicates events, issues keys, and can email buyers for you. This guide is the fallback: integrate Stripe yourself by receiving webhooks on your server and calling POST /v1/licenses (and related endpoints). Reach for it when you need full control over Checkout sessions (custom line items, bundled purchases, bespoke metadata), or a flow Commerce does not cover yet.

Prerequisites

  • An AuthForge account with an app created
  • An AuthForge Developer API key
  • A Stripe account with API keys
  • A Node.js backend (examples use Express.js)

One-time purchases

Flow overview

1. Create a Stripe Checkout session

2. Handle the Stripe webhook

3. Generate the license key

4. Deliver the key

Options for delivering the license key to the customer:
  • Email: Send an automated email with the key after payment.
  • Success page: Redirect to a page that displays the key (retrieve it by session ID).
  • Customer portal: Store keys in your database and let users view them in their account.

Subscriptions

For recurring payments, you’ll generate a license when the subscription starts and revoke it when the subscription ends.

Events to handle

Complete subscription handler

Subscription created; generate license

Subscription deleted; revoke license

Subscription updated; extend expiry on renewal

Payment failed; optional revocation

Idempotency

Stripe retries webhook deliveries on failure. Guard against duplicate license creation by:
  1. Storing the Stripe session/subscription ID alongside each license in your database.
  2. Checking for an existing record before creating a new license.
  3. Returning early if a license already exists for that payment.

Next steps