Pay Invoice

Generate an LN invoice from the specified wallet

post
PostWalletSend

https://lnpay.co/v1/wallet/:access_key/withdraw
Pay an invoice from this wallet
Request
Response
Request
Path Parameters
wallet_access_key
required
string
access key
Body Parameters
payment_request
required
string
passThru
optional
object
JSON object of custom data to pass thru
Response
201: Created
Payment successfully executed
# WTX OBJECT
{
"id": "wtx_dYeWXmMTrP1VH8XZMOhXdE1",
"created_at": 1582462278,
"num_satoshis": -1,
"user_label": "Test for DOCS",
"wal": {
"id": "wal_czDztN5eJ4r5sJ",
"created_at": 1582461859,
"updated_at": 1582462278,
"user_label": "My Postman Collection Wallet",
"balance": 19,
"statusType": {
"type": "wallet",
"name": "active",
"display_name": "Active"
}
},
"wtxType": {
"layer": "ln",
"name": "ln_withdrawal",
"display_name": "LN Withdrawal"
},
"lnTx": {
"id": "lntx_aB5lHY5ebFtei4SOByEQ8bnP",
"created_at": 1582462278,
"dest_pubkey": "02c16cca44562b590dd279c942200bdccfd4f990c3a69fad620c10ef2f8228eaff",
"payment_request": "lnbc10n1p09yafzpp5ens55wl8pfm6n2222pyyxjhx9rwcj4zl8pcyhsr2qzlklke4qfvsdq423jhxapqvehhygzyfap4xxqyz5vqcqzyssp52vyh6djmjt644fygwr54cs9vv82d2zc67tmkeun3c40ypzrvqe4srzjqt0pr36g7ke9elfvaqq3wmfey6laun0z8v0lg0nf9fdhdncxsp0y5zxkp5qqnsgqqqqqqqqqqqqq05qqrc9qy9qsqq3a4p9tvmy3sf7h2mlfpd5rcdldsyaksf8e0rk09yxtzvhcyzjrsg2janexechmzaqmnz9c7de04et7jkhmvkkjdnzn3txnz2a204ucplr595s",
"r_hash_decoded": "cce14a3be70a77a9a94a5048434ae628dd89545f38704bc06a00bf6fdb350259",
"memo": "Test for DOCS",
"description_hash": null,
"num_satoshis": 1,
"expiry": 86400,
"expires_at": 1582548678,
"payment_preimage": "6239646b2f326757664d37562b34383070347475665a4d65416c504f6f622b444933314c4e6246593554553d",
"settled": 1,
"settled_at": 1582462278,
"is_keysend": null,
"custom_records": null
},
"passThru": {
"method": "api"
}
}
400: Bad Request
Response directly from node if node error
{
"name":"Bad Request",
"message":"invoice is already paid",
"code":0,
"status":400
}
curl
JavaScript
Python
curl
$ curl -u pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp: \
-H "Content-Type: application/json" \
-X POST \
-d '{"payment_request":"lnbc50n1p0qjf84p..."}' \
https://lnpay.co/v1/wallet/waka_kqvaiFFl4Tjq4rgAXlwsu6/withdraw
# Note we are using the "admin" access_key as denoted by "wa_"
JavaScript
LNPay.Initialize('pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp');
let myWallet = new LNPayWallet('wa_Opnn4kGOGBMnfCLFXtsDnjTb');
let invoiceParams = {"payment_request":"lnbc1111..."};
myWallet.payInvoice(invoiceParams,
function(result) {
console.log(result);
}
);
Python
lnpay_py.initialize('pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp')
from lnpay_py.wallet import LNPayWallet
my_wallet = LNPayWallet('wa_Opnn4kGOGBMnfCLFXtsDnjTb')
invoice_params = {
'payment_request': 'lnbc....'
}
pay_result = my_wallet.pay_invoice(invoice_params)
print(pay_result)

The Content-Type: application/json header is required for all POST request with a JSON body!