Skip to main content

Quick Start Guide

Get up and running with Lightning Enable in under 10 minutes. This guide walks you through creating your first Lightning Network payment for an e-commerce / checkout integration (invoice → QR → confirmation flow).

Building an L402-paid API instead?

If your goal is to monetize an API for AI agents (pay-per-request gating, not checkout) you want the L402 walkthrough, not this page: Monetize Your API in 10 Minutes.

The two flows use different endpoints. This page covers checkout; L402 is the API-monetization path.

Don't have an API key yet?

Start the Free Producer Sandbox (no card) or see the plans to get your merchant API key.

Provider Verification Required

Before accepting real payments, you must complete verification with your payment provider (Strike or OpenNode).

Prerequisites​

Before you begin, ensure you have:

  1. Payment Provider Account with a production API key (the hosted platform connects to provider production APIs; sandbox and testnet keys don't work)

  2. Lightning Enable account with your merchant API key

  3. HTTP Client - curl, Postman, or any programming language

Step 1: Test Authentication​

Verify your API key by calling an authenticated endpoint:

curl -X GET https://api.lightningenable.com/api/merchant/me \
-H "X-API-Key: your-api-key-here"

Step 2: Configure Your Payment Provider​

Lightning Enable creates invoices with your own provider credential. Save it in the dashboard under Settings, or with the merchant settings API:

# Configure Strike (recommended) — saving the key also defaults you to the Strike provider
curl -X PUT https://api.lightningenable.com/api/merchant/strike-key \
-H "X-API-Key: your-merchant-api-key" \
-H "Content-Type: application/json" \
-d '{"strikeApiKey": "your-strike-api-key"}'

# Or configure OpenNode
curl -X PUT https://api.lightningenable.com/api/merchant/opennode-key \
-H "X-API-Key: your-merchant-api-key" \
-H "Content-Type: application/json" \
-d '{"openNodeApiKey": "your-opennode-api-key"}'

# Set the active provider explicitly: "strike", "opennode", or "nwc"
curl -X PUT https://api.lightningenable.com/api/merchant/payment-provider \
-H "X-API-Key: your-merchant-api-key" \
-H "Content-Type: application/json" \
-d '{"provider": "strike"}'

# Optional: register a callback URL for webhook notifications
curl -X PUT https://api.lightningenable.com/api/merchant/webhook-url \
-H "X-API-Key: your-merchant-api-key" \
-H "Content-Type: application/json" \
-d '{"webhookUrl": "https://yourapp.com/webhooks/lightning", "webhookSecret": "your-signing-secret"}'

Step 3: Create Your First Payment​

Create a Lightning invoice for a customer purchase:

curl -X POST https://api.lightningenable.com/api/payments \
-H "X-API-Key: your-api-key-here" \
-H "Content-Type: application/json" \
-d '{
"orderId": "ORDER-12345",
"amount": 25.00,
"currency": "USD",
"description": "Premium Widget",
"customerEmail": "customer@example.com",
"successUrl": "https://yourapp.com/order/success"
}'

Response:

{
"invoiceId": "1042",
"providerChargeId": "charge_xyz789",
"status": "unpaid",
"amount": 25.00,
"currency": "USD",
"lightningInvoice": "lnbc250000n1p...",
"onchainAddress": "bc1q...",
"hostedCheckoutUrl": "https://checkout.opennode.com/charge_xyz789", // OpenNode only
"payUrl": "https://api.lightningenable.com/pay/AbC...xyz",
"createdAt": "2026-07-03T12:00:00Z",
"expiresAt": "2026-07-03T13:00:00Z"
}
Invoice expiry varies by provider

Always read the expiresAt field rather than assuming a fixed window: it's the deadline encoded in the BOLT11 invoice. Without expiresInSeconds, Strike invoices (the recommended default) live about 24 hours, OpenNode uses its default TTL, and demo invoices (amount: 0) expire in 10 minutes. Send expiresInSeconds (60 to 86400) to set the lifetime yourself; see Invoice Expiration.

Step 4: Display Payment Options​

You have three options for accepting payment:

Option A: Hosted Checkout​

Redirect the customer to payUrl, the Lightning Enable hosted payment page for this invoice (every provider). Treat it as a payment link: anyone holding it can see the invoice. On OpenNode, hostedCheckoutUrl is OpenNode's own page.

window.location.href = response.payUrl;

Option B: Lightning Invoice (QR Code)​

Display the Lightning invoice as a QR code:

<div id="qr-code"></div>
<script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.3/build/qrcode.min.js"></script>
<script>
QRCode.toCanvas(
document.getElementById('qr-code'),
'lnbc250000n1p...', // lightningInvoice from response
{ width: 256 }
);
</script>

Option C: On-Chain Bitcoin Address​

Display the Bitcoin address for on-chain payment (slower, higher fees):

<p>Send Bitcoin to: <code>bc1q...</code></p>

Step 5: Check Payment Status​

Poll the payment status endpoint:

curl -X GET https://api.lightningenable.com/api/payments/1042 \
-H "X-API-Key: your-api-key-here"

Response (Unpaid):

{
"invoiceId": "1042",
"orderId": "ORDER-12345",
"status": "unpaid",
"amount": 25.00,
"currency": "USD",
"paidAt": null
}

Response (Paid):

{
"invoiceId": "1042",
"orderId": "ORDER-12345",
"status": "paid",
"amount": 25.00,
"currency": "USD",
"paidAt": "2026-07-03T12:03:45Z"
}

Instead of polling, configure webhooks for instant payment notifications:

Webhook Payload:

{
"invoiceId": "1042",
"orderId": "ORDER-12345",
"status": "paid",
"amount": 25.00,
"currency": "USD",
"paidAt": "2026-07-03T12:03:45Z"
}

Verify Webhook Signature:

The X-LightningEnable-Signature header has the format t={unix_timestamp},v1={hmac_sha256_hex}. Compute HMAC-SHA256 of {timestamp}.{payload} using your webhook secret.

using System.Security.Cryptography;
using System.Text;

public bool VerifyWebhookSignature(HttpRequest request, string payload, string secret)
{
var header = request.Headers["X-LightningEnable-Signature"].ToString();
// Parse t={timestamp},v1={hmac} format
var parts = header.Split(',')
.Select(p => p.Split('=', 2))
.ToDictionary(p => p[0], p => p[1]);
var timestamp = parts["t"];
var receivedHmac = parts["v1"];

// Sign "{timestamp}.{payload}"
var signingInput = $"{timestamp}.{payload}";
using var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(signingInput));
var computedHmac = Convert.ToHexString(hash).ToLowerInvariant();
// Constant-time comparison to avoid leaking the signature under timing analysis
return CryptographicOperations.FixedTimeEquals(
Encoding.UTF8.GetBytes(computedHmac),
Encoding.UTF8.GetBytes(receivedHmac));
}

Payment Status Flow​

+---------+    Customer pays    +------------+    Confirmed    +------+
| unpaid |-------------------->| processing |---------------->| paid |
+---------+ +------------+ +------+
|
| expiry (provider-dependent — see expiresAt)
v
+---------+
| expired |
+---------+

Status Codes:

StatusDescription
unpaidInvoice created, awaiting payment
processingPayment detected, confirming
paidPayment confirmed, fulfill order
expiredInvoice expired without payment
underpaidInsufficient amount received
refundedPayment was refunded

Complete Example: Node.js​

const axios = require('axios');

const API_URL = 'https://api.lightningenable.com';
const API_KEY = 'your-api-key-here';

async function createPayment() {
// Create payment
const response = await axios.post(
`${API_URL}/api/payments`,
{
orderId: `ORDER-${Date.now()}`,
amount: 25.00,
currency: 'USD',
description: 'Premium Widget',
successUrl: 'https://yourapp.com/order/success'
},
{
headers: {
'X-API-Key': API_KEY,
'Content-Type': 'application/json'
}
}
);

console.log('Lightning Invoice:', response.data.lightningInvoice);
// hostedCheckoutUrl is only present when using OpenNode as provider
if (response.data.hostedCheckoutUrl) {
console.log('Hosted Checkout URL:', response.data.hostedCheckoutUrl);
}
return response.data;
}

createPayment();

Complete Example: C#​

using System.Net.Http;
using System.Net.Http.Json;

public class LightningEnableClient
{
private readonly HttpClient _httpClient;
private const string ApiUrl = "https://api.lightningenable.com";

public LightningEnableClient(string apiKey)
{
_httpClient = new HttpClient();
_httpClient.DefaultRequestHeaders.Add("X-API-Key", apiKey);
}

public async Task<CreatePaymentResponse> CreatePaymentAsync(
string orderId,
decimal amount,
string description)
{
var request = new
{
orderId,
amount,
currency = "USD",
description
};

var response = await _httpClient.PostAsJsonAsync(
$"{ApiUrl}/api/payments",
request
);

response.EnsureSuccessStatusCode();
return await response.Content.ReadFromJsonAsync<CreatePaymentResponse>();
}
}

Troubleshooting​

Problem: 401 Unauthorized response

Solution: Check that your API key is correct and included in the X-API-Key header.


Problem: 400 with "error": "payment_provider_not_configured"

Solution: Save your payment provider credential (Step 2). The response's docs link names the setup guide for your provider.


Problem: Payment stuck in unpaid status

Solution:

  • Check the invoice hasn't expired — read the expiresAt field (expiry is provider-dependent; see the note in Step 3)
  • Verify the Lightning invoice or Bitcoin address
  • To test the flow without paying, create a demo invoice (amount: 0); it auto-confirms. Otherwise test with a small real payment (about $1)

Next Steps​

Stuck?​

Start with Troubleshooting for the common failures and their fixes. If something's broken or not working, email support@lightningenable.com — a real person reads it.