Stripe Checkout in Rails with the Pay gem

  Рет қаралды 13,466

GoRails

GoRails

Күн бұрын

Пікірлер
@MatthewTrussell
@MatthewTrussell 3 жыл бұрын
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!
@GorailsTV
@GorailsTV 3 жыл бұрын
That's amazing to hear! 🔥
@shawndeprey
@shawndeprey 3 жыл бұрын
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!
@GorailsTV
@GorailsTV 3 жыл бұрын
It's on my agenda 👍
@pointerish
@pointerish 3 жыл бұрын
This is awesome, Chris. Your channel should have at least 100k subscribers!
@galiwangoanan5082
@galiwangoanan5082 3 жыл бұрын
I agree with U Josias, am lucky to be one of the current subscribers
@GorailsTV
@GorailsTV 3 жыл бұрын
Hopefully some day soon!
@AxelHawker
@AxelHawker 3 жыл бұрын
Thanks Chris. Great stuff as always
@MrTahitiSeb
@MrTahitiSeb 3 жыл бұрын
You saved my day!!! thanks for the quality of your work
@RonakBhattRz
@RonakBhattRz 3 жыл бұрын
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?!!
@GorailsTV
@GorailsTV 3 жыл бұрын
We default to the root url
@RonakBhattRz
@RonakBhattRz 3 жыл бұрын
@@GorailsTV ahh i see Thanks man !
@avinashmishra7735
@avinashmishra7735 3 жыл бұрын
thanks man..integration was like butter. GoRails Go Smooth
@GorailsTV
@GorailsTV 3 жыл бұрын
😍
@eydaimon
@eydaimon 3 жыл бұрын
This is bomb Chris. Thanks for this video
@UsefulProgrammer
@UsefulProgrammer 3 жыл бұрын
Thanks for this. Exactly what I needed.
@TheGdesplin
@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
@GorailsTV Жыл бұрын
Pay just forwards along the options you pass it to Stripe, so you can just pass in the options like normal.
@neverforget1575
@neverforget1575 2 жыл бұрын
hi great tutorial, is there anyway you could make an updated tutorial with connect implementation? Thanks so much
@MailsonMonteiro77
@MailsonMonteiro77 3 жыл бұрын
Amazing content, thanks!
@Duarte_martins
@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
@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
@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
@Duarte_martins Жыл бұрын
@@GorailsTV turns out billing is all handled out of the box! Amazing gem, thank you!
@FranciscoHernandez-ij3kd
@FranciscoHernandez-ij3kd 3 жыл бұрын
Thank you brother, great explanation and walkthrough. Thank you
@polgasullnavarro1721
@polgasullnavarro1721 2 жыл бұрын
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!
@sebastianrossi7833
@sebastianrossi7833 3 жыл бұрын
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?
@GorailsTV
@GorailsTV 3 жыл бұрын
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.
@sebastianrossi7833
@sebastianrossi7833 3 жыл бұрын
@@GorailsTV Thanks! I'm a bit new to all of this! thanks for the reply and amazing videos you really helped me a lot!
@GorailsTV
@GorailsTV 3 жыл бұрын
That means a lot! I'm just happy to help!
@sidalidev
@sidalidev 3 жыл бұрын
Man! You rock! Thank you so much
@ppavelcars
@ppavelcars 3 жыл бұрын
Thank you for the interesting video Interesting how much fee do 'Stripe' charge for handle payments
@wuliwong
@wuliwong Жыл бұрын
How do you setup webhooks and signing secret in production?
@jcmdev
@jcmdev 3 жыл бұрын
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
@GorailsTV
@GorailsTV 3 жыл бұрын
Just make sure you're running background jobs if you do have Sidekiq or something like it enabled 👍
@zacwillis6585
@zacwillis6585 3 жыл бұрын
Great Tutorial! I am successfully creating subscriptions in Stripe but they aren't being saved in my database.. any ideas why??
@GorailsTV
@GorailsTV 3 жыл бұрын
Webhooks are required. Make sure you are running the Stripe CLI in development.
@zacwillis6585
@zacwillis6585 3 жыл бұрын
@@GorailsTV thank you for getting back to me! What about production? I am having the same issue on my live site.
@GorailsTV
@GorailsTV 3 жыл бұрын
@@zacwillis6585 Same thing. Make sure your webhooks are connected.
@zacwillis6585
@zacwillis6585 3 жыл бұрын
@@GorailsTV Ok. Is there documentation on how to set these up for production?
@blackswansurfing4405
@blackswansurfing4405 3 жыл бұрын
Does exist a solution without the gem Devise ? And take the name and email informations with the form of stripe checkout ? Thanks
@GorailsTV
@GorailsTV 3 жыл бұрын
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.
@Christopher8827
@Christopher8827 3 жыл бұрын
how do you customise the checkout button?
@GorailsTV
@GorailsTV 3 жыл бұрын
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
@hoochill
@hoochill 2 жыл бұрын
the pay gem doesnt update the pay_charges table on postgres. Stripe says payment is successful. what am i missing? help would be great
Debugging Custom Webhooks in the Pay gem | Preview
1:31
One Time Payments With Pay And Stripe
39:24
GoRails
Рет қаралды 1,6 М.
Their Boat Engine Fell Off
0:13
Newsflare
Рет қаралды 15 МЛН
Who is More Stupid? #tiktok #sigmagirl #funny
0:27
CRAZY GREAPA
Рет қаралды 10 МЛН
Dev Chats - Collecting payments in Ruby on Rails with Pay
1:09:20
Stripe Developers
Рет қаралды 2,5 М.
Shopping Cart Order Sessions In Rails 7 With Turbo
26:21
Usage based metered billing with Ruby on Rails and Stripe
1:12:40
CJ Avilla (cjav_dev)
Рет қаралды 4,7 М.
How to use Meilisearch in Rails
20:10
GoRails
Рет қаралды 7 М.
Webhooks in Ruby on Rails 7 Tutorial
13:30
Deanin
Рет қаралды 3,6 М.
Background Processing with Rails, Redis and Sidekiq
15:00
Decypher Media
Рет қаралды 61 М.
BulletTrain SAAS Framework for Ruby on Rails 7
22:33
Deanin
Рет қаралды 4,4 М.