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.
Selling a cheap lifetime license for an app that should work offline? See Sell offline apps: Commerce, a static page and self-serve offline activation, with no server of your own.
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

Offline apps

If your app uses self-serve offline activation, create perpetual licenses (expiresAt: null, so omit license_duration above) with several seats (for example maxHwidSlots: 5). Licenses with an expiry or unlimited seats cannot activate offline. The seat count is also the number of machines the license can ever activate, so leave room for hardware changes. Revoking on a refund or dispute still works for online apps. A refund or chargeback revokes the license online but cannot reach files already issued. For a lifetime file, that means the buyer keeps the app. Full walkthrough: Sell offline apps.

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