Skip to content

fix(payments): surface payment preimage on send result [AMB-2789]#25

Merged
apotdevin merged 3 commits into
mainfrom
rajat/amb-2789-payments-sdk-surface-payment-preimage-on-send-result
Jul 20, 2026
Merged

fix(payments): surface payment preimage on send result [AMB-2789]#25
apotdevin merged 3 commits into
mainfrom
rajat/amb-2789-payments-sdk-surface-payment-preimage-on-send-result

Conversation

@wthrajat

Copy link
Copy Markdown
Member

What this does

The send functions dropped the payment preimage that LND and litd already return in the send-payment stream. This adds it.

Why

The preimage is the proof that a payment went through. It's needed for L402 and any proof-of-payment flow. Before this, the only way to get it was setting AMBOSS_SDK_DEBUG=1 and reading the raw stream by hand. An external builder flagged this as their main blocker.

Changes

  • NodePaymentResult now has an optional preimage field.
  • The LND and litd stream update types now include payment_preimage.
  • sendLndPayment and sendAssetPayment copy it into the terminal result.
  • Updated the lnd test to assert the preimage is surfaced.

No behavior change for existing callers — it's a new optional field.

Linear: AMB-2789

LND and litd return payment_preimage in the send-payment stream but the
SDK dropped it. Add preimage to NodePaymentResult and the stream update
types, and pass it through in sendLndPayment and sendAssetPayment so
callers can use it as proof of payment (L402 etc.).
@wthrajat

Copy link
Copy Markdown
Member Author

Yes, expected. These send functions are node-direct — they call the customer's own LND/litd REST with the decrypted admin macaroon (self-custody), so the preimage is read straight from the node's payment stream. The lnd path does the same; it's symmetric.

Our GraphQL API does expose transaction.preimage, but only once a transaction is COMPLETED (it's pulled from the details Nodify writes on settlement). For self-custody sends the backend doesn't observe settlement yet, so that field stays null — that's the separate PENDING-send gap (AMB-2790). When we build that path, the preimage the client reports should get persisted and surface on the API too.

So the node stream is the only place a self-custody send's preimage exists today; API parity is tracked in AMB-2790.

@wthrajat
wthrajat force-pushed the rajat/amb-2789-payments-sdk-surface-payment-preimage-on-send-result branch from b17e063 to 6cda008 Compare July 20, 2026 12:39
bufo24
bufo24 previously approved these changes Jul 20, 2026
@apotdevin
apotdevin merged commit 944f494 into main Jul 20, 2026
2 checks passed
@apotdevin apotdevin mentioned this pull request Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants