Step 1. Create an invoicePOST /invoice
The telephone number in international format (starting with a plus
sign and the country code). Example: +19876543210
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:
A unique ID (invoice ID). Example: kUnP~nl0xBqWpLJ105dpu
The encoded payment request. A long string of characters
starting with "lnbc1".
The amount due in millisatoshi (1/1000 satoshi). Example:
UNIX timestamp for then the invoice will expire. Example:
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:
Nothing will be returned until something changes with the invoice
or the request times out (defaults to 30s) (long-poll).
HTTP status codes:
Timeout. Nothing has changed and the invoice still needs to be paid.
The invoice has been paid. The SMS has been sent or is in the
process of being sent.
The invoice expired without being paid. No SMS will be sent.
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