-
Notifications
You must be signed in to change notification settings - Fork 0
Guide for Subscriptions
Complete guide for setting up auto-renewal subscriptions using CLINK Debits (nDebit).
CLINK Debits (nDebit) enable automatic recurring payments without QR code scanning. Once set up, future subscription payments process automatically.
- 🔄 Automatic - No manual intervention needed
- ⚡ Instant - Payments process immediately
- 🔒 Secure - Cryptographically authorized
- ❌ Revocable - Customers can cancel anytime
First Payment (Manual):
Customer → Scans QR → Pays → Order Confirmed
Setup Auto-Renewal:
Customer → Gets nDebit → Pastes in Settings → Auto-Renewal Enabled
Future Payments (Automatic):
Subscription Due → Plugin sends nDebit request → Wallet auto-pays → Renewal Complete
Add to your medusa-config.ts:
{
resolve: "medusa-plugin-bitcoin-lightning-via-clink",
id: "clink",
options: {
noffer: "noffer1...",
enableSubscriptions: true, // Enable this!
// ... other options
}
}In Medusa Admin:
- Create a product
- Set as "Subscription" type
- Configure billing interval (monthly, yearly, etc.)
Configure when renewal reminders are sent:
{
// Days before expiry to remind customer
renewalReminderDays: 3
}Customer pays normally via QR code scan.
After first payment, customer needs their ndebit1... string.
From ShockWallet:
- Open ShockWallet
- Go to Settings → nDebit
- Copy the
ndebit1...string
From ZEUS:
- Open ZEUS
- Go to Settings → CLINK → nDebit
- Copy the
ndebit1...string
- After first payment, on the order confirmation page
- Look for "Setup Auto-Renewal" section
- Paste
ndebit1...string - Click "Enable Auto-Renewal"
┌─────────────────────────────────────────────┐
│ Setup Auto-Renewal for Future Payments │
│ │
│ Your subscription will renew automatically │
│ using Lightning payments. │
│ │
│ 1. Open your Lightning wallet │
│ 2. Get your nDebit string │
│ 3. Paste it below: │
│ │
│ [ndebit1qvqsyqjqxuurvwpcxc6rvv...] │
│ │
│ [Enable Auto-Renewal] │
│ │
└─────────────────────────────────────────────┘
Customer can verify in My Account → Subscriptions:
- Status: "Auto-Renewal Active"
- Next renewal date shown
- Option to disable
When a customer provides their ndebit1... string:
-
Plugin decodes the string to get:
- Nostr public key
- Relay URL
- Permission scope
-
Stored securely (encrypted at rest)
-
On renewal date:
- Plugin sends CLINK Debit request (kind 21002)
- Customer's wallet auto-authorizes payment
- Invoice is paid automatically
- nDebit strings are encrypted in storage
- Each payment requires cryptographic signature
- Customers can revoke authorization anytime
- No pre-shared secrets required
- Amount must match subscription price
- Cannot exceed wallet balance
- Cannot exceed channel capacity
-
Check nDebit is valid
- Ensure
ndebit1...string is complete - Verify it's from a compatible wallet
- Ensure
-
Check wallet connectivity
- Customer's wallet must be online
- Relay must be accessible
-
Check payment limits
- Sufficient wallet balance
- Channel capacity adequate
Guide them to:
- ShockWallet: Settings → nDebit
- ZEUS: Settings → CLINK → nDebit
- my.shockwallet.app/lapps
- Check logs with
debug: true - Verify Nostr relay connection
- Customer may need to re-authorize
Customer can:
- Go to My Account → Subscriptions
- Click "Disable Auto-Renewal"
- Confirm action
Yes! You can update it anytime from My Account → Subscriptions.
The renewal will fail. You'll receive a notification to top up.
Yes! Disable auto-renewal and pay via QR code each time.
Yes! It's cryptographically signed and encrypted. The merchant can only use it for your authorized subscription.
Yes! Each subscription can have its own nDebit or share one.