Skip to content

feat: add payment send/list API#34

Open
tungnguyentu wants to merge 2 commits into
tscircuit:mainfrom
tungnguyentu:feat/payment-api
Open

feat: add payment send/list API#34
tungnguyentu wants to merge 2 commits into
tscircuit:mainfrom
tungnguyentu:feat/payment-api

Conversation

@tungnguyentu
Copy link
Copy Markdown

@tungnguyentu tungnguyentu commented May 15, 2026

Summary

Adds a fake payment API with two endpoints:

POST /payments/send

  • Accepts recipient_email, amount_usd, and optional note
  • Creates a payment record with status: "pending" then immediately marks it "sent" (simulating Algora's async send)
  • Returns the completed payment object with payment_id, sent_at, and status

GET /payments/list

  • Returns all payments with optional ?recipient_email= and ?status= query filters
  • Useful for verifying what was paid and to whom

Schema changes (lib/db/schema.ts + lib/db/db-client.ts):

  • Added paymentSchema with payment_id, recipient_email, amount_usd, note, status, created_at, sent_at
  • Added addPayment and updatePaymentStatus methods to DbClient
  • Extended databaseSchema with payments: [] default

Tests (tests/routes/payments/send.test.ts): 2 passing tests covering basic send flow and recipient filtering.

Also migrated test HTTP client from redaxiosky to match the template-api-fake standard — all 4 tests pass.

/claim #1

Adds a /payments/send POST endpoint that creates and immediately
marks a payment as sent, and a /payments/list GET endpoint with
optional filtering by recipient_email and status.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Replace redaxios with ky in the test fixture and all test files.
ky is already used in template-api-fake and is the preferred HTTP
client across the tscircuit template ecosystem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant