Step 1. Create an 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: babfeb738805b9eeb85c7444fe0337a05d35cc44748ff9b4846d02bc4412d3d4
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 50s) (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 --data-urlencode 'number=+19876543210' --data-urlencode 'text=Hello world!'
Wait on invoice:
curl -i https://lnsms.world/invoice/babfeb738805b9eeb85c7444fe0337a05d35cc44748ff9b4846d02bc4412d3d4/wait