Skip to content

Conversation

@eulixir
Copy link
Member

@eulixir eulixir commented Jan 30, 2026

Describe your changes

Backend – subscription lifecycle

  • Handle Stripe webhooks: customer.subscription.deleted, customer.subscription.updated; only run completeSubscription when checkout.session.completed is for subscription mode.
  • Add provider_subscription_id and subscription_provider to subscriptions; store Stripe subscription ID on completion and use it in webhooks and cancel/schedule flows.
  • Introduce SubscriptionProvider port and Stripe adapter; make cancel/schedule services depend on the port for provider calls.
  • Idempotent cancel: treat “already canceled” from provider as success and sync DB; add SubscriptionAlreadyCanceledError and webhook signature verification via STRIPE_WEBHOOK_SECRET.
  • Migration: add subscription_provider with DEFAULT 'STRIPE' so existing rows migrate without NOT NULL errors.
  • Backend – API
  • DELETE /user/subscription with body { when: 'now' | 'at_end_of_current_period', reason? }; subscriptions route registered with app.after + withTypeProvider and operationId: 'deleteSubscription' for Swagger/orval.

Frontend

  • Subscription tab in user settings: show plan (Free/PRO), cancel subscription with “Cancel now” and “At end of period” via deleteSubscription; use dictionary for all copy and fix hydration (no

    wrapping Badge).

  • Add generate:api script in web app for orval.

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • If it's an essential feature, I've tested it thoroughly.
  • Do we need to implement analytics?
  • Will this be part of a product update? If yes, please write one phrase about this update.

@eulixir eulixir self-assigned this Jan 30, 2026
@vercel
Copy link

vercel bot commented Jan 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plotwist Error Error Jan 30, 2026 4:23am

Request Review

…ubscription repository and cancellation scheduling
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.

2 participants