Paying via Lightning

A BOLT 11 compatible invoice is required to make payments through the Lightning Network.



Payment stuck

Sometimes payments are not instantly processed by the Lightning Network. For instance, if a node included the payment route suddenly goes offline the payment will be stuck until the HTLC expires.

Since a Lightning Network payment can be stuck, or take longer than an HTTP request timeout, we recommend you subscribe to withdrawal events. You can subscribe to withdrawal events by passing url endpoint on the callback_url parameter.
Withdrawals Webhooks



Paying 0 sat invoices

If the invoice you're paying has a 0 sat payment associated, you'll need to pass an amount to pay.

const opennode = require('opennode');
opennode.setCredentials('MY_API_KEY', 'live');

const withdrawal = {
  type: 'ln',
  address: 'lntb100n1pw0fl34pp5p8u6alsp6vr7ngevp82lu6kz7j4ryla0dgpg9es0jq70shs39xzsdqqcqzpgxqyz5vqm5egyvdadnnvrecqdzamwl6guhhvkpja0s9e0vu6g0ay75kegzfnhjykdveagfj8rt9nay0yvu8j94shsvj3ghxu306y2pac02nq85qq7m8tsc',
  //amount: 120, - Required if the invoice has no amount set (amount = 0)
  callback_url: ''

 .then(withdrawal => {
 .catch(error => {
  console.error(`${error.status} | ${error.message}`);
curl \
	-X POST \
	-H "Content-Type: application/json" \
	-H "Authorization: YOUR_API_KEY" \
	-d '{"type": "ln", "amount": 5000, "address": "", "callback_url": ""}'

If the request was correctly sent, the API will reply with a 201 status code a withdrawal object. The endpoint provided on callback_url parameter will be notified when the withdrawal either succeeds or fails.

    "data": {
        "id": "3f50999e-f21f-4981-b67c-ea9c075be7d6",
        "type": "ln",
        "amount": 10,
        "reference": "lntb100n1pw0fl34pp5p8u6alsp6vr7ngevp82lu6kz7j4ryla0dgpg9es0jq70shs39xzsdqqcqzpgxqyz5vqm5egyvdadnnvrecqdzamwl6guhhvkpja0s9e0vu6g0ay75kegzfnhjykdveagfj8rt9nay0yvu8j94shsvj3ghxu306y2pac02nq85qq7m8tsc",
        "fee": 0,
        "status": "pending",
        "processed_at": 1559559748