Skip to content

feat: add receive option to Payments SDK [AMB-2753]#21

Merged
wthrajat merged 2 commits into
mainfrom
jesseva/amb-2753-add-receive-option-to-payments-sdk
Jul 8, 2026
Merged

feat: add receive option to Payments SDK [AMB-2753]#21
wthrajat merged 2 commits into
mainfrom
jesseva/amb-2753-add-receive-option-to-payments-sdk

Conversation

@bufo24

@bufo24 bufo24 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Finding

Investigated transactions.createReceive before writing any code, since it turned up already implemented:

  • The mutation (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 since payments-v0.1.0.
  • Verified against the backend (amboss-rails-api origin/develop, src/modules/api/payment/transaction/transaction.service.ts): executeCreateReceive calls createInvoiceForAsset(...) 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.
  • Confirmed there's no orphaned client-side node code for receive (no addInvoice/createInvoice in packages/payments/src/node/, unlike sendLndPayment/sendAssetPayment for sending) — nothing is missing on the SDK side.
  • The Webhooks resource already covers "get notified of an incoming payment" (the other half of "receive").

So createReceive is not a stub: it's a complete, correct, thin CRUD-style wrapper — the same shape as wallets.create / environments.create. It intentionally does not mirror send()'s richer SendParams/SendResult types, because send() is rich only because it orchestrates client-side macaroon decryption + node payment execution; receive has no such orchestration to hide. Adding a receive()/ReceiveParams wrapper 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:

  • Fixes a stale field name in the README's receive snippet (expires_in? → the real field, expires_in_seconds).
  • Adds a #### Receiving section (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.ts script ("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 — passes
  • pnpm run format:check — passes (no lint script exists in this repo)
  • pnpm run typecheck — passes
  • pnpm run test — all 38 tests pass (10 core + 28 payments, unchanged — no new tests added since createReceive is a trivial passthrough, same as the untested wallets.create/environments.create)

@linear

linear Bot commented Jul 8, 2026

Copy link
Copy Markdown

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.
@bufo24 bufo24 force-pushed the jesseva/amb-2753-add-receive-option-to-payments-sdk branch from 04d5d29 to b0273c7 Compare July 8, 2026 10:47
@bufo24 bufo24 marked this pull request as ready for review July 8, 2026 10:47
@wthrajat wthrajat merged commit ae56d6f into main Jul 8, 2026
2 checks passed
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.

2 participants