Receive Bitcoin via Lightning

Accept instant Bitcoin payments by generating Lightning invoices. Payments settle in seconds with near-zero fees.

Flow

  1. Your server creates a transaction (Neutron returns a Bolt11 invoice)
  2. Confirm the transaction to activate the invoice
  3. Display the invoice to your customer (QR code or copy-paste)
  4. Customer pays -- funds arrive instantly
  5. Webhook notifies your server

Create an Invoice

curl -X POST https://api.neutron.me/api/v2/transaction/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -d '{
    "sourceReq": {
      "ccy": "BTC",
      "method": "lightning",
      "reqDetails": {}
    },
    "destReq": {
      "ccy": "BTC",
      "method": "neutronpay",
      "amtRequested": 0.0001,
      "reqDetails": {}
    }
  }'

Response:

{
  "txnId": "5e25d2f4-9bca-4b7a-a1ad-2cf056100cb6",
  "txnState": "quoted",
  "sourceReq": {
    "ccy": "BTC",
    "method": "lightning",
    "reqDetails": {
      "paymentRequest": "lnbc100u1pn9x..."
    },
    "expiresAt": 1770345600000
  }
}

Confirm

curl -X PUT https://api.neutron.me/api/v2/transaction/5e25d2f4-9bca-4b7a-a1ad-2cf056100cb6/confirm \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

The invoice is now active and payable.

Complete E-Commerce Example

const express = require('express');
const app = express();

app.post('/create-payment', async (req, res) => {
  const { amount, orderId } = req.body;

  // Create transaction
  const txn = await fetch('https://api.neutron.me/api/v2/transaction/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${ACCESS_TOKEN}`,
    },
    body: JSON.stringify({
      extRefId: orderId,
      sourceReq: { ccy: 'BTC', method: 'lightning', reqDetails: {} },
      destReq: { ccy: 'BTC', method: 'neutronpay', amtRequested: amount, reqDetails: {} },
    }),
  }).then(r => r.json());

  // Confirm
  await fetch(`https://api.neutron.me/api/v2/transaction/${txn.txnId}/confirm`, {
    method: 'PUT',
    headers: { 'Authorization': `Bearer ${ACCESS_TOKEN}` },
  });

  // Return invoice to frontend
  res.json({
    txnId: txn.txnId,
    invoice: txn.sourceReq.reqDetails.paymentRequest,
    expiresAt: txn.sourceReq.expiresAt,
  });
});

// Webhook handler
app.post('/webhooks/neutron', express.json(), (req, res) => {
  res.status(200).send('OK');
  if (req.body.txnState === 'completed') {
    fulfillOrder(req.body.extRefId);
  }
});

Tips

  • Use extRefId to link transactions to your order system
  • Invoices expire (typically 1 hour) -- show a countdown
  • No KYC required for Lightning receives
  • Use webhooks in production instead of polling