feat: add receive option to Payments SDK [AMB-2753]#21
Merged
wthrajat merged 2 commits intoJul 8, 2026
Conversation
createReceive already ships and works end-to-end (backend mints the invoice server-side, no macaroon/password needed) -- it was never missing. Fix the README's stale `expires_in?` field name (the real field is `expires_in_seconds`) and add a small usage snippet under a `#### Receiving` header to match the `#### Sending` section.
04d5d29 to
b0273c7
Compare
wthrajat
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finding
Investigated
transactions.createReceivebefore writing any code, since it turned up already implemented:create_receive) and the SDK resource method (Transactions#createReceive) both shipped in the initial scaffolding commit, before AMB-2725 ("add sending") landed. It has been published sincepayments-v0.1.0.amboss-rails-apiorigin/develop,src/modules/api/payment/transaction/transaction.service.ts):executeCreateReceivecallscreateInvoiceForAsset(...)and mints the invoice server-side, for both sandbox and live wallets. Unlike sending, receiving needs no client-side node macaroon or team password — the backend can safely hold invoice-only node permission without gating it behind a password, whereas spending is gated behind the client-decrypted admin macaroon.addInvoice/createInvoiceinpackages/payments/src/node/, unlikesendLndPayment/sendAssetPaymentfor sending) — nothing is missing on the SDK side.Webhooksresource already covers "get notified of an incoming payment" (the other half of "receive").So
createReceiveis not a stub: it's a complete, correct, thin CRUD-style wrapper — the same shape aswallets.create/environments.create. It intentionally does not mirrorsend()'s richerSendParams/SendResulttypes, becausesend()is rich only because it orchestrates client-side macaroon decryption + node payment execution; receive has no such orchestration to hide. Adding areceive()/ReceiveParamswrapper on top would be unrequested abstraction and would fragment a published public API for no behavioral gain.What this PR actually does
Since the capability already existed, this PR is intentionally small:
expires_in?→ the real field,expires_in_seconds).#### Receivingsection (mirroring#### Sending) with a small usage snippet, per this ticket's "a small example usage snippet is welcome."Out of scope (left for sibling tickets under AMB-2752): a standalone runnable
examples/receive.tsscript ("make an example TS file") and broader API docs site content ("add API docs"), and end-to-end live verification against a running backend ("verify send+receive from scratch").Test plan
pnpm run build— passespnpm run format:check— passes (no lint script exists in this repo)pnpm run typecheck— passespnpm run test— all 38 tests pass (10 core + 28 payments, unchanged — no new tests added sincecreateReceiveis a trivial passthrough, same as the untestedwallets.create/environments.create)