You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. Thank you very much for creating the gem. It really solves the problem of setup and verifications for Stripe.
I have just started picking up Rails again and really struggling to set up the gem. I have copied and pasted the examples and tried to make something work but to no vail. I was wondering what your thoughts are on creating an example folder and a rails project which people can clone and see it working.
I am doing webhooks by following the setup mentioned in Stripe's docs with stripe-cli. I can see that things are happening in my rails terminal when the app is running but when I tried to create a new order for example it failed. I have also tried using a logger but that didnt work either
config/stripe.rb
Stripe.api_key = Rails.application.credentials.dig(:stripe, :secrect_key) # this is not a type for the secret
StripeEvent.signing_secret = 'whsec_7KN2VtuaSbwZHf2KvgokYmhIqmN6CXA9'
StripeEvent.configure do |events|
# events.subscribe 'checkout.session.completed', Stripe::CheckoutEventHandler.new
# events.subscribe 'checkout.session.completed' do |event|
# end
events.all Testing::BillingEventLogger.new(Rails.logger)
# events.subscribe 'checkout.session', Testing::CheckoutEventHandler.new
end
These are the different things that I have tried
app/services/testing/checkout_event_handler.rb
# module Stripe
# class CheckoutEventHandler
# def call(event)
# begin
# self.send handle_checkout_session_completed, event
# rescue JSON::ParserError => e
# # handle the json parsing error here
# raise # re-raise the exception to return a 500 error to stripe
# rescue NoMethodError => e
# #code to run when handling an unknown event
# end
# end
# def handle_checkout_session_completed(event)
# Test.create(name: 'hi')
# end
# end
# def Testing
# def call(event)
# Test.create(name: 'Testing')
# end
# end
# end
module Testing
# class CheckoutEventHandler
# def call(event)
# begin
# self.send handle_checkout_session_completed, event
# rescue JSON::ParserError => e
# # handle the json parsing error here
# raise # re-raise the exception to return a 500 error to stripe
# rescue NoMethodError => e
# #code to run when handling an unknown event
# end
# end
# def handle_checkout_session_completed(event)
# Test.create(name: 'hi')
# end
# end
class BillingEventLogger
def initialize(logger)
@logger = logger
end
def call(event)
@logger.info "I AM CALLED ******** ZHIVKO"
@logger.info "BILLING:#{event.type}:#{event.id}"
end
end
end
Looking forward to your thoughts and any feedback welcome. Thanks.
The text was updated successfully, but these errors were encountered:
Hi. Thank you very much for creating the gem. It really solves the problem of setup and verifications for Stripe.
I have just started picking up Rails again and really struggling to set up the gem. I have copied and pasted the examples and tried to make something work but to no vail. I was wondering what your thoughts are on creating an example folder and a rails project which people can clone and see it working.
I am doing webhooks by following the setup mentioned in Stripe's docs with stripe-cli. I can see that things are happening in my rails terminal when the app is running but when I tried to create a new order for example it failed. I have also tried using a logger but that didnt work either
These are the different things that I have tried
Looking forward to your thoughts and any feedback welcome. Thanks.
The text was updated successfully, but these errors were encountered: