Skip to content

Add retry-safe fake payment API#26

Open
qjly421 wants to merge 1 commit into
tscircuit:mainfrom
qjly421:codex/issue-1-payment-api
Open

Add retry-safe fake payment API#26
qjly421 wants to merge 1 commit into
tscircuit:mainfrom
qjly421:codex/issue-1-payment-api

Conversation

@qjly421
Copy link
Copy Markdown

@qjly421 qjly421 commented May 13, 2026

Summary

  • add in-memory fake payment records to the existing zod/zustand database
  • add payment lifecycle routes: send, list, get, complete, and cancel
  • support idempotency_key body values and Idempotency-Key headers so send retries do not duplicate payments
  • document the payment endpoints in the README
  • add route tests for creation, lookup, filtering, idempotent replay, completion, and cancellation

/claim #1

Verification

  • bunx biome check README.md lib/db/schema.ts lib/db/db-client.ts lib/payments/schemas.ts routes/payments tests/routes/payments/payments.test.ts
  • bunx tsc --noEmit
  • bun test
  • bun run build
  • git diff --check

Notes

This is a fake in-memory payment flow for the template API; it does not integrate with a real payment provider.

The template API only exposed a health check and starter thing routes, so this adds a small fake payment lifecycle that can simulate sending, listing, reading, completing, and canceling bounty payments without introducing new infrastructure. The implementation keeps state in the existing zod/zustand database and uses idempotency keys so callers can safely retry send requests without duplicating records.

Constraint: Use the existing Winterspec, zod, and Zustand patterns without new dependencies
Rejected: Only add a single send route | too little behavior to verify realistic payment flows
Rejected: Persist payments outside the in-memory store | unnecessary for this template API
Confidence: high
Scope-risk: narrow
Directive: Keep this API fake/in-memory unless the project explicitly adds a durable database layer
Tested: bunx biome check README.md lib/db/schema.ts lib/db/db-client.ts lib/payments/schemas.ts routes/payments tests/routes/payments/payments.test.ts
Tested: bunx tsc --noEmit
Tested: bun test
Tested: bun run build
Tested: git diff --check
Not-tested: Real external payment provider integration
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