Fix docs for invoice_payment hook and notification

The data-format changed in 2019.
The field `amount_msat` was renamed to `msat`
(See 2907e430d5)

The data-format changed again in november 2023.
The content of the field `amount_msat` was changed.
It was a string `"1000msat"` and became a number `1000`.
(See 0b23133ab2)

The current documentation still mentions the data-format before
2907e430d5.

I've updated the docs to reflect the latest changes.
I've also incluced a short mention of 0b23133ab2 to help help
developers create plugins that work both pre 23.11 and post 23.11.
This commit is contained in:
Erik De Smedt 2023-12-08 09:49:21 +01:00 committed by Christian Decker
parent 4d22f5af2d
commit acce3b1b32
2 changed files with 5 additions and 4 deletions

View File

@ -114,12 +114,14 @@ A notification for topic `invoice_payment` is sent every time an invoice is paid
"invoice_payment": {
"label": "unique-label-for-invoice",
"preimage": "0000000000000000000000000000000000000000000000000000000000000000",
"amount_msat": 10000
"msat": 10000,
}
}
```
Before version `23.11` the `msat` field was a string with msat-suffix, e.g: `"10000msat"`.
Note that there will be a string member "outpoint" ("txid:outnum") if
the payment was onchain (possible with the *invoices-onchain-fallback*
config option).

View File

@ -163,12 +163,11 @@ This hook is called whenever a valid payment for an unpaid invoice has arrived.
"payment": {
"label": "unique-label-for-invoice",
"preimage": "0000000000000000000000000000000000000000000000000000000000000000",
"amount_msat": 10000
"msat": 10000
}
}
```
Before version `23.11` the `msat` field was a string with msat-suffix, e.g: `"10000msat"`.
The hook is deliberately sparse, since the plugin can use the JSON-RPC `listinvoices` command to get additional details about this invoice. It can return a `failure_message` field as defined for final nodes in [BOLT 4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#failure-messages), a `result` field with the string
`reject` to fail it with `incorrect_or_unknown_payment_details`, or a `result` field with the string `continue` to accept the payment.