-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: tweak plan gate query param #163
Conversation
we really don't want to show the plan gate if we just finished Stripe checkout - sometimes Stripe isn't fast enough with the webhook so this will help us provide a UX that makes sense even in this case
it turns out Stripe already adds the `checkout.session` query param to this URL - this means we don't even need to update Stripe to fix this!
@@ -66,7 +66,7 @@ export function PlanGate ({ children }: { children: ReactNode }): ReactNode { | |||
|
|||
export function MaybePlanGate ({ children }: { children: ReactNode }): ReactNode { | |||
const params = useSearchParams() | |||
if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || (params.get('checkout') === 'true')) { | |||
if ((process.env.NEXT_PUBLIC_DISABLE_PLAN_GATE == 'true') || params.get('checkout.session')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check if the checkout was completed?
e.g: https://docs.stripe.com/api/events/types#event_types-checkout.session.completed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah so that's a slightly separate thing - the name matches the event names, but the param is actually just set manually in the Stripe pricing table config:
I had been planning on adding checkout
as a custom query param but realized we already have checkout.session
- we only redirect here if checkout completed so it's essentially what you're suggesting already
Website preview 🔗✨ |
🤖 I have created a release *beep* *boop* --- ## [1.16.1](w3console-v1.16.0...w3console-v1.16.1) (2024-12-12) ### Bug Fixes * make it possible to skip the plan gate after Stripe checkout ([#162](#162)) ([b399b37](b399b37)) * tweak plan gate query param ([#163](#163)) ([0ce071e](0ce071e)) ### Other Changes * update copy ([#159](#159)) ([0253b05](0253b05)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
it turns out Stripe already adds the
checkout.session
query param to this URL - this means we don't even need to update Stripe to fix this!