Skip to main content

How Lightning Enable Works

Lightning Enable is API middleware between your application and a Lightning payment provider. You call one REST API to create invoices, sell API access over L402, and receive signed webhooks; Lightning Enable talks to the provider you configured.

Your app → Lightning Enable → Payment provider or your wallet → Lightning Network
(API middleware) (custody and settlement)

What Lightning Enable does not do​

  • It does not hold funds. Your payment provider (Strike or OpenNode), or your own wallet over Nostr Wallet Connect, facilitates custody and settlement.
  • It does not control Bitcoin private keys or sign transactions.
  • It does not take a cut of payments. Revenue is a flat subscription; there are no per-transaction fees. Your provider may charge its own fees. See plans and pricing.
  • It does not interpret payments. Lightning Enable reports that an invoice settled. Whether that means an order, a subscription, or access to a resource is your application's decision.

Invoice lifecycle​

Every invoice moves through these status values, as returned by the Payments API and forwarded in webhooks:

StatusMeaningFinal
unpaidInvoice created, awaiting paymentNo
processingPayment detected, confirmingNo
paidPayment confirmedYes
expiredInvoice expired without paymentYes
refundedPayment was refundedYes

Invoices are cheap and short-lived: create one when you need it and let unused ones expire. You can set the lifetime with expiresInSeconds on POST /api/payments.

A paid Lightning invoice comes with a preimage, a 32-byte value whose SHA-256 hash equals the invoice's payment hash. Holding the preimage proves the invoice was paid; L402 uses it as the proof of payment.

The three settlement lanes​

Each merchant chooses a lane. Lightning Enable uses the same API and the same webhook format on all three.

LaneWho settlesHow Lightning Enable learns of a paymentNotes
Strike (default)Your Strike accountStrike webhookReturns preimages, so it supports L402. Refunds supported.
Nostr Wallet ConnectYour own Lightning walletPolling: Lightning Enable checks open invoices every minuteReceive-only: no refunds, BTC/sats amounts only.
OpenNode (legacy)Your OpenNode accountOpenNode webhookDoes not return preimages, so it can't complete L402 flows.

On every lane the flow is the same:

  1. Your app calls POST /api/payments. Lightning Enable creates the invoice on your lane and returns it with an invoiceId and a hosted payUrl.
  2. The customer pays the invoice from any Lightning wallet.
  3. Lightning Enable detects the payment (webhook or poll) and updates the status.
  4. Lightning Enable sends a signed webhook to your callback URL. Verify the X-LightningEnable-Signature header as described in Verifying webhooks.

You can also check status at any time with GET /api/payments/{invoiceId}.

L402 in one paragraph​

L402 puts the payment inside the HTTP request. A client requests a paid resource and gets 402 Payment Required with a Lightning invoice and a macaroon. It pays the invoice, receives the preimage, and retries with Authorization: L402 <macaroon>:<preimage>. The server checks that SHA256(preimage) equals the invoice's payment hash and serves the response. No accounts or API keys are needed on the buyer's side, which is what lets AI agents pay for APIs on their own. Lightning Enable can issue and verify these challenges for you through a hosted proxy, middleware for your own API, or the Producer API. See How L402 works for the full protocol.

Next steps​