Vitaly

Joined

110 Experience
1 Lesson Completed
0 Questions Solved

Activity

Posted in Using Webhooks with Stripe Discussion

I am trying to implement this episode (exactly as shown) in my test app using Rails 5.2 on Cloud 9 with no luck at all.  The Stripe parameters (charge details) arrive safely into our app but then rejected because of "Can't verify CSRF token authenticity" error as shown in the console.

I have tried all the solutions found on the web including adding:

- skip_before_action :verify_authenticity_token
- protect_from_forgery with: :null_session
- skip_before_action :verify_authenticity_token, only: [:webhook]

to stripe_controller 

and I also tried adding 
- protect_from_forgery unless: -> { request.format.json? } 

to application controller.

Please can someone help as the episode seemed to be great but is not working for me.
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

© 2020 GoRails, LLC. All rights reserved.