Finally: Auto-Renew Subscriptions on Bitcoin Lightning

Confirmation of Auto-Renewal activation for future payments

Written by

in

Recurring payments on the Lightning Network have been the holy grail for Bitcoin merchants. Lightning is inherently push-only — someone has to send sats. There’s no “pull” mechanism, no way to auto-charge a customer. Until now.

The Problem

Subscription merchants using Lightning have had two choices:

  1. Manual renewals — email the customer a new invoice every month and hope they pay it
  2. Custodial processors — hand over your keys to OpenNode, LNBits, or a similar third party

Neither is acceptable for a self-sovereign business. CLINK changes this with a radically simple protocol primitive: the ndebit.

What Is CLINK?

CLINK is a Nostr-native protocol for Bitcoin Lightning payment requests. Instead of HTTP, it uses Nostr events (kinds 21001–21003) to request invoices, authorize debits, and manage offers — all encrypted end-to-end via NIP-44. Your Lightning node doesn’t need a web server, a static IP, or a domain. It just needs a Nostr connection.

How the Ndebit Solves Auto-Renew

The key innovation is the ndebit1... bech32 string. Think of it as a signed authorization from the customer that says: “Merchant, you may pull up to X sats every Y days from my wallet.”

CLINK Gateway for WooCommerce implements the protocol across three layers:

1. The PHP gateway (WC_Gateway_CLINK) handles order creation, converts store currency to satoshis via CoinGecko (with a fixed-rate fallback), and manages the entire WordPress lifecycle — order status, refunds, settings.

2. The frontend (ClinkPaymentUI in clink-checkout.js) runs on the order-received page. It generates an ephemeral Nostr key pair, decodes the merchant’s noffer1... string, and uses the SDK to publish a kind:21001 event requesting a BOLT 11 invoice. It renders the QR code, polls the server for payment confirmation, and — crucially — handles the post-payment ndebit enrollment screen for subscriptions.

3. The subscription engine (WC_CLINK_Subscriptions) hooks into WooCommerce’s scheduled payment cron via woocommerce_scheduled_subscription_payment_clink. It reads the stored _clink_noffer and _clink_ndebit metadata from the subscription, copies them onto the renewal order, and marks it for auto-pay. The lifecycle is fully managed: canceling a subscription deletes the ndebit, putting it on hold moves it to _clink_ndebit_suspended, and reactivating restores it.

Payment confirmation is two-layered: the SDK’s receiptCallback captures the Nostr receipt event (kind:21001) from the merchant’s node in real time, while a fallback AJAX poll checks the server-side order status every 5 seconds. If either fires, the order is marked complete.

The ndebit itself is a bech32-encoded string (ndebit1...) containing the customer’s pubkey, relay, and optional spending constraints. It’s generated entirely in the customer’s CLINK-compatible wallet and pasted into the browser — the plugin never touches the customer’s keys.

Merchant Setup

A merchant can be accepting auto-renew subscriptions in under five minutes:

1. Install the plugin. Upload the ZIP, activate it in WordPress. No API keys, no webhook URLs, no third-party registrations.

2. Get a noffer. Open a CLINK-compatible wallet (ShockWallet, Lightning.Pub, ZEUS, Amethyst) and generate a noffer1... string. This is a Nostr offer — it advertises the merchant’s ability to receive Lightning payments, encoded with their pubkey, relay, and pricing rules.

3. Paste it in settings. WooCommerce > Settings > Payments > CLINK (Lightning). Paste the noffer string. Optionally set an invoice timeout, poll interval, and display format (sats, BTC, or bip-0177). Then save and Activate the Woo-CLINK payment gateway for Woocommerce.

supports recurring payments

That’s it. There is no server to run, no port to open, no SSL certificate to configure. The merchant’s Lightning node communicates solely through Nostr relays — the plugin never talks to the node directly. Price conversion happens automatically via CoinGecko, or the merchant can set a fixed BTC rate.

Here’s what the auto-renew flow looks like in practice for the customers:

woo-CLINK_payments-options

Customer’s First Purchase

1. Checkout. Customer fills their cart, selects “Bitcoin Lightning (via CLINK)” as payment, and places the order. No different from any other gateway.

2. First Invoice request. Behind the scenes, the browser creates an ephemeral Nostr key, decrypts the merchant’s noffer1... string, and publishes a kind:21001 event to the merchant’s relay. The merchant’s Lightning node responds with a BOLT 11 invoice — encrypted, over Nostr.

3. Pay. Customer scans the QR code with any Lightning wallet (Phoenix, Zeus, Blixt — doesn’t matter) and pays.

4. Ndebit setup. Now the magic. After payment confirmation, the customer sees an auto-renewal prompt:

“Auto-renewal keeps your subscription active without manual payments. Generate an ndebit in your CLINK wallet and paste it below.”

The customer opens their CLINK-compatible wallet (ShockWallet, Lightning.Pub, ZEUS, Amethyst), navigates to Send > CLINK Ndebit, and generates an ndebit1... authorization. They paste it into the field, click save, and the ndebit is stored as metadata on their WooCommerce subscription.

Subsequent Auto-Renewals

5. Scheduled renewal. WooCommerce’s cron fires woocommerce_scheduled_subscription_payment_clink. The plugin reads the stored _clink_noffer and _clink_ndebit, creates a renewal order, and copies the ndebit into it.

6. Automatic payment. The frontend requests a new invoice from the merchant’s node (via kind:21001). Because the ndebit is present, the customer’s CLINK wallet auto-pays — no manual intervention needed. The UI shows: “Auto-renewal in progress. Your wallet should pay this automatically.”

7. Done. The renewal order is marked complete. The customer receives their product. Nobody had to open a wallet, scan a QR code, or even think about it.

2. First invoice request as a BOLT11 invoice.

Customer payt the first instalment immediately
Customer payt the first instalment immediately as a BOLT11 Lightning invoice.

5. Scheduled renewal request for nDebit string.

Activate Auto-Renewal pasting nDebit string from any CLINK-enabled wallet
After first instalment is paid, customers can now activate Auto-Renewal simply by pasting their nDebit string from any CLINK-enabled wallet.

6. Automatic Auto-Renewal payments activated.

Confirmation of Auto-Renewal activation for future payments
Confirmation of Auto-Renewal activation for future payments. From now on, any future payment instalment will be deducted from the linked CLINK-enabled wallet.

7. Done. The renewal order is marked complete.

When Auto-Renewal is activated, the customer has the option to pay next instalment enytime
When Auto-Renewal is activated, the customer has the option to pay next instalment anytime in advance.

Customer Management

Customers can disable auto-renewal at any time from My Account > Subscriptions with a single click. Suspending a subscription moves the ndebit to a _suspended meta field; reactivation restores it. No extra logins, no support tickets.

Why This Matters

The ndebit mechanism solves something that has eluded Bitcoin Lightning since its inception: scheduled, recurring payments without a middleman. There is no third-party processor in the flow. There is no webhook URL. There is no secret API key stored on a server.

The merchant controls their own keys. The customer authorizes once and walks away. The entire payment lifecycle — invoice request, payment, renewal — happens over Nostr relays with ephemeral keys and end-to-end encryption.

Try It

CLINK Gateway for WooCommerce is available now (v1.0.5, GPLv2). Works with WooCommerce Subscriptions, YITH Subscription, Flexible Subscriptions, and any plugin implementing WC_Subscription. The only requirement: a CLINK-compatible wallet to generate your first noffer1... string.

Auto-renew subscriptions on Bitcoin Lightning are no longer a dream. They’re a Nostr event away.

Bitcoin Lightning payment Gateway (via CLINK) in WooCommerce > Settings page

Woo-CLINK Gateway is developed following CLINK protocol specs by ShockNet. Compatible wallets: ShockWallet, Lightning.Pub, ZEUS, Amethyst, etc.