Repository navigation
chore(billing): fill subscription_ends_at from Stripe for subscriptions saved before #1358 - #1586
Merged
Merged
Conversation
…m Stripe for subscriptions saved before #1358
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A one-off script that fills
organizations.subscription_ends_atfrom Stripe for subscriptions saved before #1358, whose period end is empty or already past. #1358 writes it at checkout for new subscriptions only; existing rows wait for their nextcustomer.subscription.updated.web/scripts/backfill-subscription-ends-at.mjs:stripe_subscription_id, statusactive,trialingorpast_due, andsubscription_ends_atnull or past. Canceled ones are left alone.subscription_ends_at, read with the same rule asperiodEndIso(item-level period end first, then the subscription's own).--applywrites. Safe to run again.Run from
web/with the production keys (STRIPE_SECRET_KEY,NEXT_PUBLIC_SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEY):Related issue
Follow-up to #1358. No issue.
Type of change
How to test
Missing STRIPE_SECRET_KEY.stored → Stripeand writes nothing.--apply, the listed rows get Stripe's period end. A second run finds none of them.Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/): eslint clean on the new fileyarn typecheckpasses (run fromweb/): plain.mjs, outside the TypeScript buildyarn format:checkpasses (run fromweb/): prettier clean on the new file🤖 Generated with Claude Code