Skip to content

Tier 1 Stripe fidelity — sub updates, test clock billing, 3DS#2

Merged
Segfaultd merged 12 commits intomainfrom
feat/tier1-stripe-fidelity
Apr 9, 2026
Merged

Tier 1 Stripe fidelity — sub updates, test clock billing, 3DS#2
Segfaultd merged 12 commits intomainfrom
feat/tier1-stripe-fidelity

Conversation

@Segfaultd
Copy link
Copy Markdown
Contributor

Summary

  • Subscription updatesPOST /v1/subscriptions/:id with item swap, cancel_at_period_end, trial_end, metadata. Emits customer.subscription.updated events with previous_attributes.
  • 3D Secure simulation — Magic tokens tok_threeDSecureRequired / tok_threeDSecureOptional. Payment intents enter requires_action with next_action, re-confirm completes the flow.
  • Test clock billingadvance() now triggers subscription period rollovers, invoice creation (with billing_reason: "subscription_cycle"), auto-finalize, and auto-pay. Handles trial-to-active transitions and past_due on payment failure.
  • Review fixes — SSE listener leak, Math.randomcrypto.randomBytes for client secrets, invoice counter survives restarts.

Test plan

  • 479 tests pass (bun test), 0 failures
  • TypeScript compiles cleanly (bun x tsc --noEmit)
  • SDK tests pass (bun test tests/sdk/)
  • 3DS flow: create PM with tok_threeDSecureRequired → confirm PI → requires_action → re-confirm → succeeded
  • Subscription update: swap price on active sub, verify items updated
  • Test clock: create sub with test_clock, advance past current_period_end, verify invoice created and sub period rolled

- Move SSE unsubscribe to cancel() where ReadableStream spec calls it
- Replace Math.random() with crypto.randomBytes for client secrets
- Initialize invoice counter from DB row count to survive restarts
Covers subscription updates, test clock billing, 3DS simulation,
and subscription update events.
7 tasks: 3DS magic tokens, requires_action state, subscription updates,
cancel events, test_clock on sub create, clock-driven billing, final verification.
@Segfaultd Segfaultd changed the title feat: Tier 1 Stripe fidelity — sub updates, test clock billing, 3DS Tier 1 Stripe fidelity — sub updates, test clock billing, 3DS Apr 9, 2026
… TestClockService

Move actionFlags from dashboard/api.ts to lib/action-flags.ts to fix
service→dashboard dependency inversion. Remove PriceService dep from
TestClockService (injected but never called).
@Segfaultd Segfaultd merged commit 75e8f85 into main Apr 9, 2026
2 checks passed
@Segfaultd Segfaultd deleted the feat/tier1-stripe-fidelity branch April 9, 2026 18:56
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.

1 participant