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
passThru
optional
string
JSON string. you can reference these parameters later via webhooks, etc. Good for ticket # or a certain ID
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_ztkK7XxfqCq3ihmhJiUhnR",
"created_at": 1582462172,
"dest_pubkey": "033868c219bdb51a33560d854d500fe7d3898a1ad9e05dd89d0007e11313588500",
"payment_request": "lnbc200n1p09yaxupp5r7ckx99n00d2a7g8xtr8wup57w82t827kkeujsdgjyn45cjmym7sdp623jhxapqd9h8vmmfvdjjqenjdakjq5r0wd6x6ctwyppk7mrvv43hg6t0dccqzpgxqyz5vqsp5gyfwnrqnkyvxxgpww0vwsl8tfe524ggr5kngr8n8fn4vt9xl5ggs9qy9qsq42vwx9dh2n3ggrlgwqqxqq77detywruhv2s558uk3vfrumgmjfhs3y8hwtgxe7cx6svg4pr87qzfg8mgawsveqe6wn0te9d3h02fm4spxtzy5s",
"r_hash_decoded": "1fb16314b37bdaaef90732c6777034f38ea59d5eb5b3c941a891275a625b26fd",
"memo": "Test invoice from Postman Collection",
"description_hash": null,
"num_satoshis": 20,
"expiry": 86400,
"expires_at": 1582548572,
"payment_preimage": null,
"settled": 0,
"settled_at": null,
"is_keysend": null,
"custom_records": null,
"passThru": {
"wallet_id": "wal_czDztN5eJ4r5sJ",
"userDefined": {
"ticketId": "556"
}
}
}
curl
JavaScript
Python
curl
$ curl -u pak_O0iUMxk8kK_qUzkT4YKFvp1ZsUtp: \
-H "Content-Type: application/json" \
-X POST \
-d '{"num_satoshis":5, "memo":"Test invoice from the docs","passThru":" {\"ticketId\":\"556\"} "}' \
https://lnpay.co/v1/wallet/waki_Q2XHBIfEAN33mLlwdYvusN6Q/invoice
# Note we are using the "invoice" access_key as denoted by "wi_" or "waki"
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!