Repository navigation
Keep checking the plan after Stripe sends the student back - #169
Merged
Merged
Conversation
Settings trusted the first subscription read, which often arrives before the webhook and then stays stale, so a successful payment looked expired. A successful return now waits and refreshes until Pro shows up, and a canceled return says no charge was made. Co-authored-by: Gáborjáni-Szabó Ádám <Programcode@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 48 minutes. View limit details
Note 🎁 Summarized by CodeRabbit Free
Comment |
Programcode
marked this pull request as ready for review
October 22, 2026 12:27
This branch was successfully deployed
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.
Stripe sends the student to Settings with
?checkout=successbefore the webhook has written Pro. Settings trusted the first subscription read, and that read stays fresh for a minute, so a successful payment could sit on Expired with an Upgrade button.Settings now polls about every 2 seconds for about 20 seconds after a successful return, until the plan is Pro or Legacy Free. While it waits, the subscription card says "Confirming your Pro subscription…" instead of Expired. When the plan appears, a toast says the subscription is active and the Stripe query params are removed. If Stripe is still quiet after the window, a toast says a refresh will catch up.
?checkout=canceledtoasts that no charge was made and clears the params. Copy is in English, Spanish, and Hungarian.UI change for the preview: the confirming line and the three toasts on Settings. Please look at that card after a checkout return. I could not drive a real Stripe redirect here.
Verified locally (GitHub Actions is out of minutes, so this is not a CI pass):
npx vitest run src/test/billing/checkout-return.test.ts(5 passed)npx eslinton the new helper, Settings, and the testnpm run typechecknpm run docs:checkNot run:
npm run verifyand a browser pass through Stripe.