API

Step 1. Create an invoice

POST /invoice

Parameters:

number

The telephone number in international format (starting with a plus
sign and the country code). Example: +19876543210

text

The message contents. Max length and allowed characters depends on the
destination. For messages that only contain GSM7 characters (ASCII
plus some additional latin characters) the max length is in general
at least 130 characters.

If the number and message content was valid, the reply will have
HTTP status 201 and the body will be an invoice in JSON format
with these fields:

id

    A unique ID (invoice ID). Example: kUnP~nl0xBqWpLJ105dpu

payreq

    The encoded payment request. A long string of characters
    starting with "lnbc1".

msatoshi

    The amount due in millisatoshi (1/1000 satoshi). Example:
    100000

expires_at

    UNIX timestamp for then the invoice will expire. Example:
    1536326108


If there was something wrong with the provided data, the HTTP
status will be 400 and the returned JSON will have only
one field named 'message' describing the problem in plain text.


Step 2. Let the user pay the invoice

Provide the encoded payment request to the user. Preferably both in
text format and as a QR code. If you are using Node.js you can use
the qrcode package to create the QR code.


Step 3. Wait for the SMS to be sent

As soon as the user has paid the invoice, the SMS will be sent
automatically. To know if this has happened, and provide feedback to
the user, wait on the invoice like this:

GET /invoice/INVOICE-ID/wait

Nothing will be returned until something changes with the invoice
or the request times out (defaults to 30s) (long-poll).

HTTP status codes:

402

Timeout. Nothing has changed and the invoice still needs to be paid.
Try again.

202

The invoice has been paid. The SMS has been sent or is in the
process of being sent.

410

The invoice expired without being paid. No SMS will be sent.


Examples

Create invoice:

curl -i -X POST -H 'Accept: application/json' https://lnsms.world/invoice -d number=+19876543210 -d text='Hello world!'

Wait on invoice:

curl -i https://lnsms.world/invoice/kUnP~nl0xBqWpLJ105dpu/wait