Платёжный модуль Bitcoin Lightning для Medusa через протокол CLINK
Bitcoin Lightning payment module for MedusaJS eCommerce via the CLINK protocol.
| Component | Description |
|---|---|
| Core payment provider with CLINK SDK integration | |
| Fiat-to-sats conversion (CoinGecko, Kraken, Fixed, Manual) | |
| Recurring payments via nDebit protocol | |
| Admin Settings Widget | Configure noffer, currency source, subscriptions, refunds |
| Storefront Component | QR code + copy + countdown timer + payment status polling |
| Webhook Endpoint | Real-time payment confirmations from CLINK relay |
| Status Endpoint | Backup polling for payment verification |
Add to your :
Customers can now pay with Lightning at checkout.
Full documentation lives on the GitHub Wiki:
No web server needed for your Lightning node. All communication flows over Nostr. See the Wiki architecture page for the full data flow.
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
| string | Yes | - | Your CLINK offer string | |
| string | No | Exchange rate source | ||
| number | No | - | Fixed BTC rate (if using source) | |
| number | No | Invoice expiry in seconds | ||
| number | No | Polling interval in ms | ||
| boolean | No | Enable nDebit subscriptions | ||
| string | Only for subscriptions | - | Merchant Nostr pubkey (64-hex); required when | |
| string | No | - | HMAC secret to verify webhook payloads (see Security below) | |
| string | No | - | Merchant email for refunds | |
| string | No | - | Merchant Nostr for refunds | |
| boolean | No | Enable debug logging |
v1.0.2 hardened the plugin against common payment and network attacks:
Two ways to set it (env var takes precedence):
If no secret is configured, webhook signatures are not checked (single-tenant setups behind a firewall). Configure one in production. See the Configuration Wiki page for details.
See the Configuration Wiki page for details on each option.
For Merchants (to get your ):
For Customers (to pay):
Contributions are welcome! Please see CONTRIBUTING.md for details.
GPL-3.0 - See LICENSE for details.
npm install medusa-plugin-bitcoin-lightning-via-clink1import { Modules } from "@medusajs/framework/utils"2
3module.exports = defineConfig({4 modules: [5 {6 resolve: "@medusajs/medusa/payment",7 options: {8 providers: [9 {10 resolve: "medusa-plugin-bitcoin-lightning-via-clink",11 id: "clink",12 options: {13 noffer: "noffer1...", // Your CLINK offer string14 currencySource: "coingecko",15 invoiceTimeout: 600,16 debug: false17 }18 }19 ]20 }21 }22 ]23})1┌─────────────────────────────────────────────────────────────────┐2│ CHECKOUT FLOW │3├─────────────────────────────────────────────────────────────────┤4│ │5│ Customer selects "Pay with Lightning" │6│ │ │7│ ▼ │8│ Medusa requests invoice │9│ │ │10│ ▼ │11│ CLINK SDK decodes nOffer → requests BOLT11 from your node │12│ │ │13│ ▼ │14│ QR code + invoice displayed to customer │15│ │ │16│ ▼ │17│ Customer scans QR with Lightning wallet │18│ │ │19│ ▼ │20│ Payment confirmed via Webhook (primary) OR Polling (backup) │21│ │ │22│ ▼ │23│ Order confirmed! ⚡ │24│ │25└─────────────────────────────────────────────────────────────────┘1# Option 1: environment variable2CLINK_WEBHOOK_SECRET=your-secret npm start1// Option 2: plugin option2options: {3 webhookSecret: "your-secret"4}1# Install dependencies2npm install3
4# Run tests5npm test6
7# Build8npm run build9
10# Watch mode11npm run dev