Create Invoice

Use create invoice API to create a payment invoice where you can pass the amount in USD and get a lightning invoice which can be displayed as a QR code directly on your website.

Creating a new invoice

create invoice API

POST https://tapi.paysea.net/createinvoice

Headers

NameTypeDescription

Content-Type*

application/json

Authorization*

Bearer <api key>

Request Body

NameTypeDescription

device_code*

paysea010

amount*

{ "amount": "0.01", "currency": "USD" }

currency should be always USD and amount should be in USD with up to 2 decimal places

memo*

"This is a test transaction"

required to link payment to your in house billing system

{
    "r_hash": "6d85faea4b2d298e685425161c3b1109d0820ff2623d6ab4d17aa416e7c7d25e",
    "payment_request": "lnbc72820n1pjwguylpp5dkzl46jt955cu6z5y5tpcwc3p8ggyrljvg7k4dx302jpde786f0qdpd235xjueqd9ejqargv5s8getnwss8gunpdeekzcm5d9hkucqzpgxqz95rzjqvjpj9slq5z6j4wyqf0fp66yraw0tvgr4xde7tx799jlhq8xk2wccz6uhgqqxgqqqqqqqqqqqqqqqqqqqqrzjq0x7vznry0m3yt230qj4wehrsy2tgu3wmcy00j0qch0ehyfvcgqavz6u8cqqrvqqqyqqqqqqqqqqqqqqqqsp5x5jfz0p5x6z4mwm8fjghlugaa09z86p5nxc347wdv0sgxy9v534q9qyyssqgx9awv0wn8ea0eg0dr9hq0hmfhdtw3k557sf98r7zj0p3syrzz43y0360l27zxx69ugq0stzqmzcjk2vu9l4v32k6xh0fl3sj2qtyagquf53fk",
    "add_index": "32854",
    "pay_req": "lnbc72820n1pjwguylpp5dkzl46jt955cu6z5y5tpcwc3p8ggyrljvg7k4dx302jpde786f0qdpd235xjueqd9ejqargv5s8getnwss8gunpdeekzcm5d9hkucqzpgxqz95rzjqvjpj9slq5z6j4wyqf0fp66yraw0tvgr4xde7tx799jlhq8xk2wccz6uhgqqxgqqqqqqqqqqqqqqqqqqqqrzjq0x7vznry0m3yt230qj4wehrsy2tgu3wmcy00j0qch0ehyfvcgqavz6u8cqqrvqqqyqqqqqqqqqqqqqqqqsp5x5jfz0p5x6z4mwm8fjghlugaa09z86p5nxc347wdv0sgxy9v534q9qyyssqgx9awv0wn8ea0eg0dr9hq0hmfhdtw3k557sf98r7zj0p3syrzz43y0360l27zxx69ugq0stzqmzcjk2vu9l4v32k6xh0fl3sj2qtyagquf53fk",
    "amtinsats": "7282",
    "expiry": 180,
    "askRate": "26092.9900",
    "amount": {
        "currency": "USD",
        "amount": "1.9"
    },
    "paylink": "69de8353bcae1241"
}

Execute this sample curl to see the response.

curl --location 'https://tapi.paysea.net/createinvoice' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 2C7C39B6D842D43AFB4A675AE61B2' \
--data '{
    "device_code" : "payseatest100",
    "amount": {
        "amount": "0.01",
        "currency": "USD"
    },
    "memo" : "This is the test transaction"
}'

use payment_request field data which always starts with "lnbc" and convert them to QR code to show it on your website for the user to scan and pay the invoice.

Last updated