Complete reference for all plugin configuration options. ## Basic Configuration ```typescript // medusa-config.ts { resolve: "medusa-plugin-bitcoin-lightning-via-clink", id: "clink", options: { noffer: "noffer1...", // Required // ... other options } } ``` ## Required Options ### noffer **Type:** `string` Your CLINK offer string. This is how the plugin communicates with your Lightning node. **How to get it:** - ShockWallet: Receive → CLINK Offer - Lightning.Pub: Dashboard → Offers - ZEUS: Settings → CLINK **Format:** `noffer1qvqsyq...` --- ## Currency Options ### currencySource **Type:** `"coingecko" | "kraken" | "fixed" | "manual"` **Default:** `"coingecko"` Exchange rate source for fiat-to-satoshi conversion. | Source | API Key Required | Rate Limit | Notes | |--------|------------------|------------|-------| | `coingecko` | No | 10-50/min | Most popular, free | | `kraken` | Optional | 15/min | More accurate | | `fixed` | No | None | You set the rate | | `manual` | No | None | Enter sats directly | **Example:** ```typescript currencySource: "kraken" ``` ### fixedBtcRate **Type:** `number` Fixed BTC/fiat rate. Only used when `currencySource: "fixed"`. **Example:** ```typescript currencySource: "fixed", fixedBtcRate: 65000 // 1 BTC = 65,000 USD ``` --- ## Payment Options ### invoiceTimeout **Type:** `number` **Default:** `600` (10 minutes) Invoice expiry time in seconds. After this time, the invoice is no longer valid. **Valid range:** 60 - 86400 (1 minute to 24 hours) **Example:** ```typescript invoiceTimeout: 300 // 5 minutes ``` ### pollInterval **Type:** `number` **Default:** `5000` (5 seconds) How often to check for payment confirmation (in milliseconds). **Example:** ```typescript pollInterval: 3000 // Check every 3 seconds ``` ### maxPollAttempts **Type:** `number` **Default:** `120` Maximum number of times to poll for payment confirmation. With default settings: 120 attempts × 5 seconds = 10 minutes (matches invoiceTimeout) **Example:** ```typescript maxPollAttempts: 60 // Stop after 60 attempts ``` --- ## Subscription Options ### enableSubscriptions **Type:** `boolean` **Default:** `false` Enable auto-renewal subscriptions via CLINK Debits (nDebit). **Example:** ```typescript enableSubscriptions: true ``` --- ## Refund Options ### refundContactEmail **Type:** `string` Email address for refund requests. Displayed to customers after payment. **Example:** ```typescript refundContactEmail: "support@yourstore.com" ``` ### refundContactNostr **Type:** `string` Nostr pubkey for refund requests. Displayed to customers after payment. **Example:** ```typescript refundContactNostr: "npub1..." ``` --- ## Debug Options ### debug **Type:** `boolean` **Default:** `false` Enable detailed logging for troubleshooting. **Example:** ```typescript debug: true ``` **Logs include:** - Payment initiation - Currency conversion - Webhook events - Errors --- ## Complete Example ```typescript { resolve: "medusa-plugin-bitcoin-lightning-via-clink", id: "clink", options: { // Required noffer: "noffer1qvqsyqjqxuurvwpcxc6rvvrxxsurqep5vfjk2wf4v33nsenrxumnyvesxfnrswfkvycrwdp3x93xydf5xg6rzce4vv6xgdfh8quxgct9x5erxvspremhxue69uhhgetnwskhyetvv9ujumrfva58gmnfdenjuur4vgqzpccxc30wpf78wf2q78wg3vq008fd8ygtl4qy06gstpye3h5unc47xmee6z", // Currency currencySource: "coingecko", // Payment invoiceTimeout: 600, pollInterval: 5000, maxPollAttempts: 120, // Subscriptions enableSubscriptions: true, // Refunds refundContactEmail: "support@mystore.com", refundContactNostr: "npub1...", // Debug debug: false } } ``` --- ## Environment Variables You can use environment variables for sensitive configuration: ```typescript { noffer: process.env.CLINK_NOFFER, refundContactEmail: process.env.CONTACT_EMAIL, debug: process.env.NODE_ENV === "development" } ``` --- ## Validation The plugin validates configuration on startup: - `noffer` must start with `noffer1` - `invoiceTimeout` must be between 60 and 86400 - `fixedBtcRate` is required when using `fixed` source Invalid configuration will throw an error at startup. --- ## Next Steps - [Subscriptions](Subscriptions.md) - Auto-renewal setup - [Currency Sources](Currency-Sources.md) - Detailed comparison - [Troubleshooting](Troubleshooting.md) - Common issues