integrallis / stripe_event

Stripe webhook integration for Rails applications.
https://rubygems.org/gems/stripe_event
MIT License
844 stars 104 forks source link

Can't get it to work #45

Closed theDazzler closed 9 years ago

theDazzler commented 9 years ago

I set up my app the same way as the README and the webhooks don't work.

This is in my config/initializers/stripe.rb

class CustomerCreated
  def call(event)
    u = User.find(1)
    u.first_name = "bear"
    u.save!

    puts "whoohoo!"
  end
end

StripeEvent.configure do |events|
  events.subscribe 'customer.created', CustomerCreated.new

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

this is in my routes.rb

mount StripeEvent::Engine => '/stripe-webhooks'

Is there something else I have to do? Do I need to create a controller? I am using http://www.ultrahook.com/ if it matters

invisiblefunnel commented 9 years ago

@theDazzler I recommend posting this question to http://stackoverflow.com/ rather than GitHub issues. Include relevant server logs, stack traces, etc.

To answer your questions:

Is there something else I have to do?

Make sure to set your Stripe API key: Stripe.api_key = ENV.fetch('STRIPE_API_KEY').

Do I need to create a controller?

You don't need to add a controller to handle webhooks with stripe_event.