Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Stripe webhook integration for Rails applications.
Ruby HTML
tree: e2eb92cbe3

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app/controllers/stripe_event
config
lib
screenshots
script
spec
.gitignore
.rspec
.travis.yml
CHANGELOG.md
Gemfile
Gemfile.lock
MIT-LICENSE
README.md
Rakefile
stripe_event.gemspec

README.md

stripe_event

Build Status

stripe_event is built on the ActiveSupport::Notifications API. Incoming webhook requests are authenticated by retrieving the event object from Stripe. Define subscriber blocks to handle one, many, or all event types.

Install

# Gemfile
gem 'stripe_event'
# config/routes.rb
mount StripeEvent::Engine => "/my-chosen-path" # provide a custom path

Usage

# config/initializers/stripe.rb
Stripe.api_key = ENV['STRIPE_API_KEY'] # Set your api key

StripeEvent.registration do
  subscribe 'charge.failed' do |event|
    MyClass.handle_failed_charge(event) # Define subscriber behavior
  end

  subscribe 'customer.created', 'customer.updated' do |event|
    # Handle multiple event types
  end

  subscribe do |event|
    # Handle all event types - logging, etc.
  end
end

Register webhook url with Stripe

Setup webhook url

Something went wrong with that request. Please try again.