Ask A Question


You’re not receiving notifications from this thread.

Skip Stripe checkout for user with certain conditions

Nathaniel Mak 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
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.