You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 8748958
Browse filesBrowse the repository at this point in the historyBrowse files
fix(payments): accept the webhook body LNbits >= 1.0 sends
LNbits >= 1.0 posts the payment webhook with `json=payment.json()`
(`model_dump_json()` on current main): the payment is serialized and
then JSON-encoded a second time, so the request body is a JSON string
holding the payment object. The /callbacks/lnbits route used the default
strict `json()` parser, which rejects a top-level string with 400 before
the controller runs. Even an object body would have been rejected: the
body schema was `.strict()` with only `payment_hash`, while LNbits always
sends its whole payment object.
Every webhook failed, and paid invoices were only confirmed by the
maintenance worker on its next 60 s poll; users kept waiting on the
invoice page after paying, and some paid a second invoice.
Parse the body with `strict: false`, decode a JSON string body in the
controller, and validate only `payment_hash`, stripping the other fields.
The invoice state is still fetched from LNbits and the query hmac is
still required, so nothing from the body is trusted beyond the hash.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
0 commit comments