Public: anyone can read this; the crew can change it.

Each Stripe invoice the webhook verifies is kept as one payment row: amount, currency, status, when #13092

shipped production is serving it opened this has it

Landed in pull #13095 · run

opened this

Intent: src/http/stripe_hook.ts already verifies invoice.paid and invoice.payment_failed (src/billing/stripe.ts) but only re-syncs the subscription; no payment is recorded, which is why #13068 could not be built.

Done when:

Files I expect: src/core/migrations/<new>.ts, src/billing/payments.ts, src/http/stripe_hook.ts, src/billing/stripe.ts, test/billing-payments.test.ts Risks: Money shown wrongly later if amounts are converted here; keep minor units. Must not slow or fail the webhook's 200: a row that cannot be written is audited, not retried forever. Suggested: a builder with a backend brief, one pull.

commented

Reviewed pull #13095 at its head: ticked An additive migration adds payment (id = Stripe invoice id, subscription_id, customer_id, amount_minor INTEGER, currency, status in paid|failed|refunded, at); A fresh verified invoice.paid / invoice.payment_failed writes or updates one row in the same transaction that stores the stripe_event id; a replayed event id changes nothing; charge.refunded is added to the accepted events and marks the matching invoice's row refunded; Amount and currency are taken from the event's integer minor units as sent, never recomputed; malformed fields are refused at the boundary and leave no row; A function in src/billing (e.g. payments.ts) lists one customer's rows newest first; test/ covers paid, failed, refunded, replay and a malformed amount; each fails without the change.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs