2021-01-07 19:45:47 +01:00
|
|
|
lightning-offer -- Command for accepting payments
|
|
|
|
=================================================
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
--------
|
|
|
|
|
2021-01-14 04:36:59 +01:00
|
|
|
**(WARNING: experimental-offers only)**
|
2021-01-07 19:45:47 +01:00
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
**offer** *amount* *description* [*issuer*] [*label*] [*quantity\_max*] [*absolute\_expiry*] [*recurrence*] [*recurrence\_base*] [*recurrence\_paywindow*] [*recurrence\_limit*] [*single\_use*]
|
2021-01-07 19:45:47 +01:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
-----------
|
|
|
|
|
2021-07-21 07:37:49 +02:00
|
|
|
The **offer** RPC command creates an offer (or returns an existing
|
|
|
|
one), which is a precursor to creating one or more invoices. It
|
2022-11-11 02:44:56 +01:00
|
|
|
automatically enables the processing of an incoming invoice\_request,
|
2021-07-21 07:37:49 +02:00
|
|
|
and issuing of invoices.
|
2021-01-07 19:45:47 +01:00
|
|
|
|
2023-08-03 07:13:59 +02:00
|
|
|
Note that for making an offer to *pay* someone else, see lightning-invoicerequest(7).
|
2021-07-02 02:11:34 +02:00
|
|
|
|
2021-01-07 19:45:47 +01:00
|
|
|
The *amount* parameter can be the string "any", which creates an offer
|
|
|
|
that can be paid with any amount (e.g. a donation). Otherwise it can
|
|
|
|
be a positive value in millisatoshi precision; it can be a whole
|
|
|
|
number, or a whole number ending in *msat* or *sat*, or a number with
|
|
|
|
three decimal places ending in *sat*, or a number with 1 to 11 decimal
|
|
|
|
places ending in *btc*.
|
|
|
|
|
|
|
|
*amount* can also have an ISO 4217 postfix (i.e. USD), in which case
|
2021-01-09 05:25:46 +01:00
|
|
|
currency conversion will need to be done for the invoice itself. A
|
|
|
|
plugin is needed which provides the "currencyconvert" API for this
|
|
|
|
currency, otherwise the offer creation will fail.
|
2021-01-07 19:45:47 +01:00
|
|
|
|
|
|
|
The *description* is a short description of purpose of the offer,
|
|
|
|
e.g. *coffee*. This value is encoded into the resulting offer and is
|
|
|
|
viewable by anyone you expose this offer to. It must be UTF-8, and
|
|
|
|
cannot use *\\u* JSON escape codes.
|
|
|
|
|
2021-10-08 02:52:34 +02:00
|
|
|
The *issuer* is another (optional) field exposed in the offer, and
|
2021-01-07 19:45:47 +01:00
|
|
|
reflects who is issuing this offer (i.e. you) if appropriate.
|
|
|
|
|
|
|
|
The *label* field is an internal-use name for the offer, which can
|
2023-03-06 04:47:18 +01:00
|
|
|
be any UTF-8 string. This is *NOT* encoded in the offer not sent
|
|
|
|
to the issuer.
|
2021-01-07 19:45:47 +01:00
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
The presence of *quantity\_max* indicates that the
|
2022-11-09 03:32:00 +01:00
|
|
|
invoice can specify more than one of the items up (and including)
|
|
|
|
this maximum: 0 is a special value meaning "no maximuim".
|
|
|
|
The *amount* for the invoice will need to be multiplied
|
|
|
|
accordingly. This is encoded in the offer.
|
2021-01-07 19:45:47 +01:00
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
The *absolute\_expiry* is optionally the time the offer is valid until,
|
2021-01-07 19:45:47 +01:00
|
|
|
in seconds since the first day of 1970 UTC. If not set, the offer
|
|
|
|
remains valid (though it can be deactivated by the issuer of course).
|
|
|
|
This is encoded in the offer.
|
|
|
|
|
|
|
|
*recurrence* means that an invoice is expected at regular intervals.
|
|
|
|
The argument is a positive number followed by one of "seconds",
|
|
|
|
"minutes", "hours", "days", "weeks", "months" or "years" (variants
|
|
|
|
without the trailing "s" are also permitted). This is encoded in the
|
|
|
|
offer. The semantics of recurrence is fairly predictable, but fully
|
|
|
|
documented in BOLT 12. e.g. "4weeks".
|
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
*recurrence\_base* is an optional time in seconds since the first day
|
2021-01-07 19:45:47 +01:00
|
|
|
of 1970 UTC, optionally with a "@" prefix. This indicates when the
|
|
|
|
first period begins; without this, the recurrence periods start from
|
|
|
|
the first invoice. The "@" prefix means that the invoice must start
|
|
|
|
by paying the first period; otherwise it is permitted to start at any
|
|
|
|
period. This is encoded in the offer. e.g. "@1609459200" indicates
|
|
|
|
you must start paying on the 1st January 2021.
|
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
*recurrence\_paywindow* is an optional argument of form
|
2022-01-26 18:18:49 +01:00
|
|
|
'-time+time[%]'. The first time is the number of seconds before the
|
2021-01-07 19:45:47 +01:00
|
|
|
start of a period in which an invoice and payment is valid, the second
|
|
|
|
time is the number of seconds after the start of the period. For
|
|
|
|
example *-604800+86400* means you can fetch an pay the invoice 4 weeks
|
|
|
|
before the given period starts, and up to 1 day afterwards. The
|
|
|
|
optional *%* indicates that the amount of the invoice will be scaled
|
|
|
|
by the time remaining in the period. If this is not specified, the
|
|
|
|
default is that payment is allowed during the current and previous
|
|
|
|
periods. This is encoded in the offer.
|
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
*recurrence\_limit* is an optional argument to indicate the maximum
|
2021-01-07 19:45:47 +01:00
|
|
|
period which exists. eg. "12" means there are 13 periods, from 0 to
|
|
|
|
12 inclusive. This is encoded in the offer.
|
|
|
|
|
2022-11-11 02:44:56 +01:00
|
|
|
*single\_use* (default false) indicates that the offer is only valid
|
2021-01-07 19:46:47 +01:00
|
|
|
once; we may issue multiple invoices, but as soon as one is paid all other
|
|
|
|
invoices will be expired (i.e. only one person can pay this offer).
|
2021-01-07 19:45:47 +01:00
|
|
|
|
|
|
|
RETURN VALUE
|
|
|
|
------------
|
|
|
|
|
2021-06-16 03:10:17 +02:00
|
|
|
[comment]: # (GENERATE-FROM-SCHEMA-START)
|
|
|
|
On success, an object is returned, containing:
|
2022-09-05 23:33:09 +02:00
|
|
|
|
2023-01-30 07:24:17 +01:00
|
|
|
- **offer\_id** (hash): the id of this offer (merkle hash of non-signature fields)
|
2021-06-16 03:10:17 +02:00
|
|
|
- **active** (boolean): whether this can still be used (always *true*)
|
2022-11-11 03:03:13 +01:00
|
|
|
- **single\_use** (boolean): whether this expires as soon as it's paid (reflects the *single\_use* parameter)
|
2021-06-16 03:10:17 +02:00
|
|
|
- **bolt12** (string): the bolt12 encoding of the offer
|
2021-07-21 07:37:49 +02:00
|
|
|
- **used** (boolean): True if an associated invoice has been paid
|
|
|
|
- **created** (boolean): false if the offer already existed
|
2021-06-16 03:10:17 +02:00
|
|
|
- **label** (string, optional): the (optional) user-specified label
|
2021-09-03 12:07:59 +02:00
|
|
|
|
2021-06-16 03:10:17 +02:00
|
|
|
[comment]: # (GENERATE-FROM-SCHEMA-END)
|
2021-01-07 19:45:47 +01:00
|
|
|
|
|
|
|
On failure, an error is returned and no offer is created. If the
|
|
|
|
lightning process fails before responding, the caller should use
|
|
|
|
lightning-listoffers(7) to query whether this offer was created or
|
|
|
|
not.
|
|
|
|
|
2021-07-21 07:37:49 +02:00
|
|
|
If the offer already existed, and is still active, that is returned;
|
|
|
|
if it's not active then this call fails.
|
|
|
|
|
2021-01-07 19:45:47 +01:00
|
|
|
The following error codes may occur:
|
|
|
|
- -1: Catchall nonspecific error.
|
2022-11-11 02:44:56 +01:00
|
|
|
- 1000: Offer with this offer\_id already exists (but is not active).
|
2021-01-07 19:45:47 +01:00
|
|
|
|
|
|
|
AUTHOR
|
|
|
|
------
|
|
|
|
|
|
|
|
Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible.
|
|
|
|
|
|
|
|
SEE ALSO
|
|
|
|
--------
|
|
|
|
|
2023-03-06 04:47:18 +01:00
|
|
|
lightning-listoffers(7), lightning-disableoffer(7), lightning-invoicerequest(7).
|
2021-01-07 19:45:47 +01:00
|
|
|
|
|
|
|
RESOURCES
|
|
|
|
---------
|
|
|
|
|
|
|
|
Main web site: <https://github.com/ElementsProject/lightning>
|
|
|
|
|
2023-01-30 07:24:17 +01:00
|
|
|
[comment]: # ( SHA256STAMP:3ad09aed48fb17db5fae6d401f21e50a4479e970199bd039b453868057829653)
|