LNPay Docs
Search…
⌃K

Pay Invoice

Generate an LN invoice from the specified wallet
post
https://api.lnpay.co/
v1/wallet/:wallet_key/withdraw
PostWalletSend
FAILURE_REASON_NO_ROUTE is a common error that means one of two things
  • There is no route because the fee_limit_msat is too low or the default 5% is too low (this is usually the issue)
  • There is no route because the lightning node cannot find a path (sometimes this happens with private nodes, or new nodes)
Check the QueryRoutes endpoint for help in determining what the issue is.
cURL
Node.js
Python
JavaScript
curl -u sak_XXXXXXX: \
-H "Content-Type: application/json" \
-X POST \
-d '{"payment_request":"lnbc50n1p0qjf84p..."}' \
https://api.lnpay.co/v1/wallet/wal_XXXXX/withdraw
const lnpay = LNPay({
secretKey: 'sak_XXXXX',
walletAccessKey: 'wal_XXXXX',
});
const payInvoice = await lnpay.payInvoice({
payment_request: 'lnbc50n1p0qjf84p...',
passTru: {
order_id: '100',
},
});
lnpay_py.initialize('sak_XXXXXXX')
from lnpay_py.wallet import LNPayWallet
my_wallet = LNPayWallet('wal_XXXXXXX')
invoice_params = {
'payment_request': 'lnbc....'
}
pay_result = my_wallet.pay_invoice(invoice_params)
print(pay_result)
LNPay.Initialize('pak_XXXXXXX');
let myWallet = new LNPayWallet('waka_XXXXXXX');
let invoiceParams = {"payment_request":"lnbc1111..."};
myWallet.payInvoice(invoiceParams,
function(result) {
console.log(result);
}
);
The Content-Type: application/json header is required for all POST request with a JSON body!