This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events.subscribe 'charge.dispute.', Stripe::EventHandler.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stripe.api_key = ENV['STRIPE_SECRET_KEY'] | |
StripeEvent.signing_secret = ENV['STRIPE_SIGNING_SECRET'] | |
StripeEvent.configure do |events| | |
events.subscribe 'charge.dispute.created', Stripe::EventHandler.new | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mount StripeEvent::Engine, at: '/stripe/webhook' # you can change this url |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mount StripeEvent::Engine, at: '/any-path-you-want' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'stripe_event' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "active_support/core_ext/hash/indifferent_access" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
symbolic_hash = {a: 1, b: 2, c: 3} | |
string_hash = {"a" => 1, "b" => 2, "c" => 3} | |
new_hash = ActiveSupport::HashWithIndifferentAccess.new(symbolic_hash) | |
new_hash[:a] # 1 | |
new_hash["a"] # 1 | |
# same for other hash string_hash | |
new_hash = ActiveSupport::HashWithIndifferentAccess.new(string_hash) | |
new_hash["a"] # 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string_hash["a"] # 1 | |
string_hash[:a] # nil | |
string_hash.keys # ["a", "b", "c"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
symbolic_hash.keys # [:a, :b, :c] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
symbolic_hash[:a] # 1 | |
symbolic_hash["a"] # nil |