All threads / Skip Stripe checkout for user with certain conditions

Ask A Question


You’re not receiving notifications from this thread.

Skip Stripe checkout for user with certain conditions

Anthony Makela asked in Rails

Any ideas on how one would go about adding this to stripe checkout flow? I would like the referree to have a free post instead of going through the checkout if he has a referred user who has the referral_completed_at? as true.

Hey Anthony,

After the user signs up through the referral link, you can add the free post to their account. That might just be a column on the user model to keep track of it, up to you.

Then you can check if the user has a free post and let them post. If they don't, redirect them to the pricing page. You probably have a before_action in your PostsController to redirect if not subscribed, so you can modify that to allow them through if they have a free post. Once they complete the Post, then they you can remove that column on the user so they can't do it twice.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 52,887+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.