Generate Invoice

post
PostWalletInvoice

https://lnpay.co/v1/wallet/:wallet_access_key/invoice
Request
Response
Request
Path Parameters
wallet_access_key
required
string
Body Parameters
description_hash
optional
string
base64 encoded hash of payment. If this is provided, memo will be ignored.
memo
optional
string
expiry
optional
integer
seconds, defaults to 86400 (1 day)
num_satoshis
required
integer
Response
201: Created
This returns an LnTx object
LnTx Object
{
"id":"lntx_RFbu0YosFoIuJc7S6qMg0L9",
"created_at":1577655829,
"updated_at":1577655829,
"dest_pubkey":"033868c219bdb51a33560d854d500fe7d3898a1ad9e05dd89d0007e11313588500",
"payment_request":"lnbc200n1p0qj8s4pp525lkfynvsxlyl5vys8v4xv840swspylfk3v5l95gne3ms77vc9tsdp223jhxapqd9h8vmmfvdjjqenjdakjqargv5sxgmmrwvcqzpgxqyz5vq48ud7ha9rnsnadkhcsv38aadh3yrvuvv3kl9xv7wp0w3hqqyllvjkdzm2awcsdw9l5zkkkqu2hy0shunjdrdg4r8h8f59e2720885jgqwrqyt8",
"r_hash_decoded":"553f64926c81be4fd18481d95330f57c1d0093e9b4594f96889e63b87bccc157",
"memo":"Test invoice from the docs",
"num_satoshis":20,
"expiry":86400,
"expires_at":1577742229,
"payment_preimage":null,
"settled":0,
"settled_at":null
}
curl
JavaScript
Python
curl
$ curl -u pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp: \
-H "Content-Type: application/json" \
-X POST \
-d '{"num_satoshis":20, "memo":"Test invoice from the docs"}' \
https://lnpay.co/v1/wallet/wi_skllxCQI7yurKi0NCCTc0wwO/invoice
# Note we are using the "invoice" access_key as denoted by "wi_"
JavaScript
LNPay.Initialize('pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp');
let myWallet = new LNPayWallet('wi_skllxCQI7yurKi0NCCTc0wwO');
let invoiceParams = {"num_satoshis":2,"memo":"Tester"};
myWallet.createInvoice(invoiceParams,
function(result) {
console.log(result);
}
);
Python
lnpay_py.initialize('pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp')
from lnpay_py.wallet import LNPayWallet
my_wallet = LNPayWallet('wi_skllxCQI7yurKi0NCCTc0wwO')
invoice_params = {
'num_satoshis': 2,
'memo': 'Tester'
}
invoice = my_wallet.create_invoice(invoice_params)
print(invoice)

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