Skip to content
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

Merged
merged 3 commits into from
Dec 12, 2024
Merged

fix: tweak plan gate query param #163

merged 3 commits into from
Dec 12, 2024

Conversation

travis
Copy link
Member

@travis travis commented Dec 12, 2024

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!

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')) {
Copy link
Member

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

Copy link
Member Author

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:

Screenshot 2024-12-12 at 10 39 15 AM

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

Copy link
Contributor

Website preview 🔗✨

build log

@travis travis merged commit 0ce071e into main Dec 12, 2024
5 checks passed
@travis travis deleted the feat/plan-gate-override branch December 12, 2024 18:43
travis pushed a commit that referenced this pull request Dec 12, 2024
🤖 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>
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