This is a great way to wire up stripe into rails. You saved me hours of trying to figure it out myself. A stripe checkout page up and running in under half an hour. Boom! Fantastic stuff as always, Chris. Thanks for making this super badass video!
@GorailsTV3 жыл бұрын
That's amazing to hear! 🔥
@shawndeprey3 жыл бұрын
Dude what an awesome guide! It would be nice to see an updated guide for the new version of Pay, but overall just combining this guide with the latest configuration docs worked wonderfully!
@GorailsTV3 жыл бұрын
It's on my agenda 👍
@pointerish3 жыл бұрын
This is awesome, Chris. Your channel should have at least 100k subscribers!
@galiwangoanan50823 жыл бұрын
I agree with U Josias, am lucky to be one of the current subscribers
@GorailsTV3 жыл бұрын
Hopefully some day soon!
@AxelHawker3 жыл бұрын
Thanks Chris. Great stuff as always
@MrTahitiSeb3 жыл бұрын
You saved my day!!! thanks for the quality of your work
@RonakBhattRz3 жыл бұрын
Hey, overall Amazing tutorial as always. but I am amazed without *success_url* & *cancel_url* how do you return your page on the success screen? any clue?!!
@GorailsTV3 жыл бұрын
We default to the root url
@RonakBhattRz3 жыл бұрын
@@GorailsTV ahh i see Thanks man !
@avinashmishra77353 жыл бұрын
thanks man..integration was like butter. GoRails Go Smooth
@GorailsTV3 жыл бұрын
😍
@eydaimon3 жыл бұрын
This is bomb Chris. Thanks for this video
@UsefulProgrammer3 жыл бұрын
Thanks for this. Exactly what I needed.
@TheGdesplin Жыл бұрын
I just wanted to let anyone else know who was wondering, you can add the 'line items' with options - so you could do something like line_items: [ { price: "price_******", adjustable_quantity: { enabled: true, minimum: 1, maximum: 10 }, quantity: 1 }, { price: "price_**********", adjustable_quantity: { enabled: true, minimum: 1, maximum: 10 }, quantity: 1 } ] To add quantities or user adjustable quantities for example and multiple products at once. I couldn't find in the rails-pay gem docs how to do this, but you can use any of stripe (or I'm sure other services) options.
@GorailsTV Жыл бұрын
Pay just forwards along the options you pass it to Stripe, so you can just pass in the options like normal.
@neverforget15752 жыл бұрын
hi great tutorial, is there anyway you could make an updated tutorial with connect implementation? Thanks so much
@MailsonMonteiro773 жыл бұрын
Amazing content, thanks!
@Duarte_martins Жыл бұрын
This is great, thank you! It could do with an update but I got it working in the end. Now to figure out how to change the user database record based on payment status..
@GorailsTV Жыл бұрын
The best way I've found is to handle it on the redirect after Checkout completes. That way you're not relying on webhooks that could come in slowly.
@Duarte_martins Жыл бұрын
@@GorailsTV Cheers. I've written the controller below which seems to work. Next I'll try to handle the billing section. class CheckoutController < ApplicationController before_action :authenticate_user! def show current_user.set_payment_processor :stripe current_user.payment_processor.customer @checkout_session = current_user.payment_processor.checkout( mode: "subscription", line_items: "price_0000", success_url: checkout_success_url, cancel_url: checkout_cancel_url ) end def success @session = Stripe::Checkout::Session.retrieve(params[:session_id]) @line_items = Stripe::Checkout::Session.list_line_items(params[:session_id]) current_user.set_payment_processor :stripe customer = current_user.payment_processor.customer # Get the subscription ID from the session subscription_id = @session.subscription subscription = Stripe::Subscription.retrieve(subscription_id) # Get the payment method ID from the subscription payment_method_id = subscription.default_payment_method payment_method = Stripe::PaymentMethod.retrieve(payment_method_id) # Attach the payment method to the customer if it's not already attached if payment_method.customer.nil? || payment_method.customer != customer.id Stripe::PaymentMethod.attach(payment_method_id, { customer: customer.id, }) end # Set the attached payment method as the customer's default payment method Stripe::Customer.update(customer.id, { invoice_settings: { default_payment_method: payment_method_id, }, }) # Proceed with the subscription current_user.payment_processor.subscribe(name: "default", plan: "price_0000") if current_user.payment_processor.subscribed? flash[:success] = "Payment registered" redirect_to root_path else flash[:warning] = "Payment was not successful. Please try again." redirect_to root_path end end def cancel flash[:warning] = "Payment was not successful. Please try again." redirect_to root_path ends end
@Duarte_martins Жыл бұрын
@@GorailsTV turns out billing is all handled out of the box! Amazing gem, thank you!
@FranciscoHernandez-ij3kd3 жыл бұрын
Thank you brother, great explanation and walkthrough. Thank you
@polgasullnavarro17212 жыл бұрын
Nice video Chris, but one question. Regarding forms. Is posible to add this in a "new" method and then call "create" after payment succeed? Imagine for example that a customer is uploading a job and then is redirected to this Stripe checkout page. Thanks!
@sebastianrossi78333 жыл бұрын
Thanks Chris, i just wonder why if i have my listener off, pay doesnt register the entry. How can I have it all the time running? in production I mean?
@GorailsTV3 жыл бұрын
In production your app is accessible to the internet, so you don't need the stripe CLI. Just in development when your app isn't accessible on the internet.
@sebastianrossi78333 жыл бұрын
@@GorailsTV Thanks! I'm a bit new to all of this! thanks for the reply and amazing videos you really helped me a lot!
@GorailsTV3 жыл бұрын
That means a lot! I'm just happy to help!
@sidalidev3 жыл бұрын
Man! You rock! Thank you so much
@ppavelcars3 жыл бұрын
Thank you for the interesting video Interesting how much fee do 'Stripe' charge for handle payments
@wuliwong Жыл бұрын
How do you setup webhooks and signing secret in production?
@jcmdev3 жыл бұрын
Hi Chris! Great video! One question... when current_user signed up, billing webhooks didn't create any records in Pay :: Charges. Is correct? I'm trying to create the following stream in STRIPE: signup > trial 30d > paid subscription
@GorailsTV3 жыл бұрын
Just make sure you're running background jobs if you do have Sidekiq or something like it enabled 👍
@zacwillis65853 жыл бұрын
Great Tutorial! I am successfully creating subscriptions in Stripe but they aren't being saved in my database.. any ideas why??
@GorailsTV3 жыл бұрын
Webhooks are required. Make sure you are running the Stripe CLI in development.
@zacwillis65853 жыл бұрын
@@GorailsTV thank you for getting back to me! What about production? I am having the same issue on my live site.
@GorailsTV3 жыл бұрын
@@zacwillis6585 Same thing. Make sure your webhooks are connected.
@zacwillis65853 жыл бұрын
@@GorailsTV Ok. Is there documentation on how to set these up for production?
@blackswansurfing44053 жыл бұрын
Does exist a solution without the gem Devise ? And take the name and email informations with the form of stripe checkout ? Thanks
@GorailsTV3 жыл бұрын
Sure, you can use any auth system you want. Devise is just the most well maintained. 👍 And you don't need a customer to use stripe checkout, pay just adds helpers for it.
@Christopher88273 жыл бұрын
how do you customise the checkout button?
@GorailsTV3 жыл бұрын
Just pass in locals to the partial. You can see it here: github.com/pay-rails/pay/blob/master/app/views/pay/stripe/_checkout_button.html.erb
@hoochill2 жыл бұрын
the pay gem doesnt update the pay_charges table on postgres. Stripe says payment is successful. what am i missing? help would be great