Files
sase.tr/apps/api/drizzle/meta/_journal.json
Semih Yesilyurt 6c6b74a8e5
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
feat(payments): recurring billing — Stripe Checkout switches to subscription mode
Monthly/yearly purchases were one-time charges: our "subscription" was just
an end_date stamp, access silently died at period end and no renewal
machinery existed (no auto-charge, no reminder) — every paying customer had
to notice the lockout and re-buy by hand.

- Checkout now mode:"subscription" with inline recurring price_data; the
  Stripe customer is stored on first purchase and reused (saved card +
  invoice history on one record, with a stale-customer retry guard)
- invoice.paid webhook: extends end_date to the billing-line period end,
  records a completed payment (deduped on stripe_invoice_id against webhook
  retries), captures subscription_renewed with $revenue, mails the receipt;
  late dunning recovery re-activates the row and re-grants Full-plan brands
- invoice.payment_failed webhook: dunning mail with Stripe's next retry
  date; access is NOT cut — end_date governs and the nightly cron closes it
  if every retry fails. Product rule: mail on success, mail on failure,
  never a pre-charge reminder
- customer.subscription.deleted: stamps cancelledAt; renewals stop and
  access runs out at end_date naturally
- cancel()/resume() sync cancel_at_period_end to Stripe (forwardRef pair) —
  an in-app cancel that leaves the card being charged was unacceptable
- subscription_create invoices only enrich the checkout's payment row
  (payment intent + invoice id for receipts/panel refunds); activation,
  revenue and the receipt stay on checkout.session.completed
- migration 0020: users.stripe_customer_id,
  user_subscriptions.stripe_subscription_id (+idx),
  payments.stripe_invoice_id (+idx)

Legacy one-time subs (3 live payers) are untouched: they expire at their
end_date as before and board recurring on their next manual checkout.

Promote checklist: add invoice.paid / invoice.payment_failed /
customer.subscription.deleted to the prod webhook endpoint; verify Stripe
"Customer emails" upcoming-renewal reminders stay OFF.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 15:55:44 +03:00

153 lines
3.0 KiB
JSON

{
"version": "7",
"dialect": "postgresql",
"entries": [
{
"idx": 0,
"version": "7",
"when": 1778535325959,
"tag": "0000_brief_guardian",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
"when": 1747039600000,
"tag": "0001_charming_quicksand",
"breakpoints": true
},
{
"idx": 2,
"version": "7",
"when": 1778584574615,
"tag": "0002_boring_the_stranger",
"breakpoints": true
},
{
"idx": 3,
"version": "7",
"when": 1778587000000,
"tag": "0003_query_log_insights",
"breakpoints": true
},
{
"idx": 4,
"version": "7",
"when": 1778709949622,
"tag": "0004_hot_quicksilver",
"breakpoints": true
},
{
"idx": 5,
"version": "7",
"when": 1779054231051,
"tag": "0005_past_elektra",
"breakpoints": true
},
{
"idx": 6,
"version": "7",
"when": 1779086009525,
"tag": "0006_chilly_dark_phoenix",
"breakpoints": true
},
{
"idx": 7,
"version": "7",
"when": 1779573406942,
"tag": "0007_natural_red_wolf",
"breakpoints": true
},
{
"idx": 8,
"version": "7",
"when": 1779633572753,
"tag": "0008_common_sumo",
"breakpoints": true
},
{
"idx": 9,
"version": "7",
"when": 1779703007129,
"tag": "0009_referral_rewards_rework",
"breakpoints": true
},
{
"idx": 10,
"version": "7",
"when": 1780281600000,
"tag": "0010_dedupe_parts",
"breakpoints": true
},
{
"idx": 11,
"version": "7",
"when": 1780572179333,
"tag": "0011_email_preferences",
"breakpoints": true
},
{
"idx": 12,
"version": "7",
"when": 1780581755559,
"tag": "0012_lifecycle_email_sent",
"breakpoints": true
},
{
"idx": 13,
"version": "7",
"when": 1780600000000,
"tag": "0013_fix_brand_casing",
"breakpoints": true
},
{
"idx": 14,
"version": "7",
"when": 1781136000000,
"tag": "0014_proxy_logs",
"breakpoints": true
},
{
"idx": 15,
"version": "7",
"when": 1781222400000,
"tag": "0015_oem_votes",
"breakpoints": true
},
{
"idx": 16,
"version": "7",
"when": 1781308800000,
"tag": "0016_oem_suggestions",
"breakpoints": true
},
{
"idx": 17,
"version": "7",
"when": 1781395200000,
"tag": "0017_oem_expert_rewards",
"breakpoints": true
},
{
"idx": 18,
"version": "7",
"when": 1781481600000,
"tag": "0018_part_price_history",
"breakpoints": true
},
{
"idx": 19,
"version": "7",
"when": 1781485200000,
"tag": "0019_part_price_brand",
"breakpoints": true
},
{
"idx": 20,
"version": "7",
"when": 1781268490495,
"tag": "0020_stripe_recurring",
"breakpoints": true
}
]
}