Skip to content

Commit

Permalink
Fix docs for invoice_payment hook and notification
Browse files Browse the repository at this point in the history
The data-format changed in 2019.
The field `amount_msat` was renamed to `msat`
(See 2907e43)

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 0b23133)

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

I've updated the docs to reflect the latest changes.
I've also incluced a short mention of 0b23133 to help help
developers create plugins that work both pre 23.11 and post 23.11.
  • Loading branch information
ErikDeSmedt authored and cdecker committed Dec 12, 2023
1 parent 4d22f5a commit acce3b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
5 changes: 2 additions & 3 deletions doc/developers-guide/plugin-development/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit acce3b1

Please sign in to comment.