diff --git a/doc/lightning-invoice.7 b/doc/lightning-invoice.7
index 1183e7a18..c8f7a030a 100644
--- a/doc/lightning-invoice.7
+++ b/doc/lightning-invoice.7
@@ -2,12 +2,12 @@
.\" Title: lightning-invoice
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1
-.\" Date: 09/06/2016
+.\" Date: 01/10/2018
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
-.TH "LIGHTNING\-INVOICE" "7" "09/06/2016" "\ \&" "\ \&"
+.TH "LIGHTNING\-INVOICE" "7" "01/10/2018" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -36,10 +36,12 @@ lightning-invoice \- Protocol for accepting payments\&.
.sp
The \fBinvoice\fR RPC command creates the expectation of a payment of a given amount of milli\-satoshi: it returns a unique token which another lightning daemon can use to pay this invoice\&.
.sp
+The \fImsatoshi\fR can be the string "any", which creates an invoice that can be paid with any amount\&.
+.sp
The \fIlabel\fR must be unique; it is never revealed to other nodes on the lightning network, but it can be used to query the status of this invoice\&.
.SH "RETURN VALUE"
.sp
-On success, a hash is returned as \fIrhash\fR to be given to the payer\&. On failure, an error is returned and no invoice is created\&. If the lightning process fails before responding, the caller should use getinvoice(7) to query whether this invoice was created or not\&.
+On success, a hash is returned as \fIrhash\fR to be given to the payer\&. It also returns a BOLT11 invoice as \fIbolt11\fR to be given to the payer\&. On failure, an error is returned and no invoice is created\&. If the lightning process fails before responding, the caller should use getinvoice(7) to query whether this invoice was created or not\&.
.SH "AUTHOR"
.sp
Rusty Russell is mainly responsible\&.
diff --git a/doc/lightning-invoice.7.txt b/doc/lightning-invoice.7.txt
index f721f9a0b..14815499a 100644
--- a/doc/lightning-invoice.7.txt
+++ b/doc/lightning-invoice.7.txt
@@ -16,6 +16,9 @@ The *invoice* RPC command creates the expectation of a payment of a
given amount of milli-satoshi: it returns a unique token which another
lightning daemon can use to pay this invoice.
+The 'msatoshi' can be the string "any", which creates an invoice
+that can be paid with any amount.
+
The 'label' must be unique; it is never revealed to other nodes on
the lightning network, but it can be used to query the status of this
invoice.
@@ -24,6 +27,8 @@ RETURN VALUE
------------
On success, a hash is returned as 'rhash' to be given to the payer.
+It also returns a BOLT11 invoice as 'bolt11' to be given to the
+payer.
On failure, an error is returned and no invoice is created. If the
lightning process fails before responding, the caller should use
getinvoice(7) to query whether this invoice was created or not.
diff --git a/lightningd/invoice.c b/lightningd/invoice.c
index d4efa3819..4c7912ffd 100644
--- a/lightningd/invoice.c
+++ b/lightningd/invoice.c
@@ -197,13 +197,18 @@ static void json_invoice(struct command *cmd,
sha256(&invoice->rhash, invoice->r.r, sizeof(invoice->r.r));
- invoice->msatoshi = tal(invoice, u64);
- if (!json_tok_u64(buffer, msatoshi, invoice->msatoshi)
- || *invoice->msatoshi == 0) {
- command_fail(cmd, "'%.*s' is not a valid positive number",
- msatoshi->end - msatoshi->start,
- buffer + msatoshi->start);
- return;
+ if (json_tok_streq(buffer, msatoshi, "any"))
+ invoice->msatoshi = NULL;
+ else {
+ invoice->msatoshi = tal(invoice, u64);
+ if (!json_tok_u64(buffer, msatoshi, invoice->msatoshi)
+ || *invoice->msatoshi == 0) {
+ command_fail(cmd,
+ "'%.*s' is not a valid positive number",
+ msatoshi->end - msatoshi->start,
+ buffer + msatoshi->start);
+ return;
+ }
}
invoice->label = tal_strndup(invoice, buffer + label->start,