Create a license key for every Stripe payment
Stripe takes the payment but does not create license keys. Connect a Stripe webhook to Licers and each successful Checkout or Payment Link creates a license key and emails it to the buyer. Subscriptions keep the key valid while they are paid, and a refund revokes it. No server code and no Zapier.
Updated by the Licers team
Connect Stripe in five minutes
- In Licers, open Store & Portal, add a Stripe connection and copy its endpoint URL.
- In Stripe, open Developers → Webhooks → Add endpoint and paste the URL.
- Select these events:
checkout.session.completed,checkout.session.async_payment_succeeded,invoice.paid,customer.subscription.deleted,charge.refunded. - Save, reveal the endpoint’s signing secret (
whsec_…) and paste it into Licers. - Add a rule: which product the key belongs to, how many devices, when it expires, and any entitlements.
How a payment is matched to a product
- A Payment Link id (
plink_…), or - the value you put in the Checkout Session metadata as
licers_product, or - a price (
price_…) or product (prod_…) id, if you add an optional restricted key with read access to Checkout Sessions.
Never paste a Stripe secret key (sk_…) into any third-party service. Licers does not need one.
Why not write the webhook yourself?
You can, and the API makes it short. The work is in the edges: verifying signatures, repeated deliveries, payments that succeed later, renewals, refunds that arrive before the sale, resending a lost email. Those are handled here.
Then check the key in your app
import { LicenseClient, NetworkError } from '@licers/sdk'; const client = new LicenseClient('YOUR_PUBLIC_KEY', { // safe to ship inside your app productId: 'YOUR_PRODUCT_ID', // your product: refuses keys for your other products appVersion: '2.4.1', // shows in Analytics -> App versions});const key = 'XXXX-XXXX-XXXX-XXXX'; // the customer's license key let result;try { result = await client.validate(key);} catch (err) { if (err instanceof NetworkError) { // Offline, or the server is down. That is not "unlicensed": try again, or // allow a few days since the last good check. console.error('Could not reach the license server. Please try again.'); } else { // A forged or replayed answer, or a key for another of your products. console.error('License check failed:', err.message); } process.exit(1);} if (!result.valid) { // Expired, revoked, device limit reached... the server says which. console.error('Not licensed:', result.error); process.exit(1);} console.log('Licensed. Expires:', result.expiresAt ?? 'never');Using something else? See all seven SDKs.
Questions and answers
Does Stripe have built-in license keys?
No. Stripe handles payments. A webhook has to create and deliver the key.
Does it work with Payment Links?
Yes. Match on the Payment Link id.
What happens when a subscription payment fails?
The key stays valid until the end of the paid period plus your grace days. If no renewal arrives, it expires.
Can I test it first?
Yes. Use Stripe’s test mode with a separate connection and its own signing secret.