Skip to main content

Public API

This is the public facing side of the API server.

Tips

POST /tip

Request parameters:

  • currency
    • string
    • international 3 character ISO code
  • value
    • numeric
    • amount being transacted

If currency equals the special code "SAT", then value represents the exact numbers of sats to be invoiced. If currency is fiat like "USD", the final sats value will be calculated internally based on the store rate between USD->BTC.

Sample request:

{
"currency": "SAT",
"value": 10000
}

Reply:

{
// document id created in the database, is passed along on the invoice memory currently
"_id": "order-0a798d5f-fcac-4c86-9e8b-be58c82e1cc1",

// internal revision tracking for document
// first step was created,
// second step was processed by the external lightning invoice provider
// third step would be the "settled" state
"_rev": "2-fbef6bbeb5e87f674a844f8c6534ac43",

// will be used for specific product shopping
"products": [],
// local currency in which accounting has to be denominated in
// can be configured in the settings document
"fiat_currency": "EUR",

// total amount charged in the local currency
"fiat_total": 2.68,

// currency in which the order has been presented to the user
"order_currency": "GBP",

// total amount shown to customer
"order_total": 2.34,

// total value in sats after conversion rates were applied
"sats_total": 10000,

// order creation time
"timestamp": "2023-05-06T20:24:41.668Z",

// marker as procesed by the "LN_invoice" plugin
"LN_Invoice": true,

// copied value in sats
"ln_invoice_sats": 10000,

// memo for transaction
// currently it's only the order id, some messages can be embedded as well
"ln_invoice_memo": "order-0a798d5f-fcac-4c86-9e8b-be58c82e1cc1",

// expiration time in miliseconds
"ln_invoice_expire_ms": 86400000,

// test is only true when being generated from the test suite
"test": false,

// lightning invoice code
"ln_invoice_req": "lnbc100u1pj9ddufpp5eqgz4344ws6ep0ryrg43v5ykjc4lztfj27g6njgysadevrxcs05qdzydaexgetj95cxzdee8pjr2e3dve3kzcedx33nsd3d89jnsc3dvfjn2wrr8qex2vtrvd3scqzpgxqyz5vqsp58jzju3j5z2szhwzuw9x4qu05c3459q8x252z4nxrm9nhmel4gkjq9qyyssqxfahy0j8y32u2v5qyyhygajcmwckchtvual32dev9znjvv2vx8ektp64wr5hjpufnd20guhfa6qlwvdj9zxjq39lw46rdjeul03d5jsq3z25na",

// generated qr code
"ln_invoice_qr": "data:image/png;base64,i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Yq21PuJirbU+4mKttT7C/mCttT7gYq21PuJirbU+4mKttT7iYq21PuJirbU+4mKttT7iYq21PuJirbU+4mKttT7iYq21PuJirbU+4mKttT7iYq21PuJirbU+4mKttT7i/wDj2W4JDrcXfAAAAABJRU5ErkJggg==",

// date when document was processed and the linghtning invoice was created
"ln_invoice_created_at": "2023-05-06T20:24:42.281Z"
}

GET /status/{id}

After an order document is created, the returned _id value can be used to query for live changes on the state of that document. When a settle operation happens (currently the only transformation allowed) through the external watch script, the endpoint will return the new revision if it has settled, or it will stay in a pending state until the settlement happens or the 1 minute timeout expires.

Proxied directly to the CouchDB changes feed.

Possible Headers:

  1. None

It watches for changes starting from this exact moment going forward (passes since=now param to changes feed)

  1. X-Rev

When passed, returns the revision of the document right away.

  1. X-Start-Rev

Starts watching since specific database update sequence. If change has already happened it returns it immediately, otherwise is keep watching

All live requests have a timeout period of 1 minute, in which they return an empty result set. In case the payment check needs to continue, the request has to be performed again.

Rates

GET /rates

Retrieve latest currency exchange rates maintained by the cron job.

{
"_id": "rate:10kSATS",
"_rev": "1-da24a4ce39122b009ac447438b9080a8",
"timestamp": "2023-04-23T11:38:20.769Z",
"SAT": 10000,
"EUR": 2.52,
"GBP": 2.23,
"RON": 12.58,
"USD": 2.76
}

The reference value for sats is arbitrarily picked at 10000 to allow for each conversion.