Sha256: 8fda67dbc8b1adb355284c933e55256fb79fb33a6b6a68031384c0dfe7bef4da

Contents?: true

Size: 1.75 KB

Versions: 7

Compression:

Stored size: 1.75 KB

Contents

require 'stripe_event'
Dir[File.join(__dir__, 'webhooks', '**', '*.rb')].each { |file| require file }

StripeEvent.configure do |events|
  # Listen to the charge event to make sure we get non-subscription
  # purchases as well. Invoice is only for subscriptions and manual creation
  # so it does not include individual charges.
  events.subscribe 'charge.succeeded', Pay::Stripe::Webhooks::ChargeSucceeded.new
  events.subscribe 'charge.refunded', Pay::Stripe::Webhooks::ChargeRefunded.new

  # Warn user of upcoming charges for their subscription. This is handy for
  # notifying annual users their subscription will renew shortly.
  # This probably should be ignored for monthly subscriptions.
  events.subscribe 'invoice.upcoming', Pay::Stripe::Webhooks::SubscriptionRenewing.new

  # If a subscription is manually created on Stripe, we want to sync
  events.subscribe 'customer.subscription.created', Pay::Stripe::Webhooks::SubscriptionCreated.new

  # If the plan, quantity, or trial ending date is updated on Stripe, we want to sync
  events.subscribe 'customer.subscription.updated', Pay::Stripe::Webhooks::SubscriptionUpdated.new

  # When a customers subscription is canceled, we want to update our records
  events.subscribe 'customer.subscription.deleted', Pay::Stripe::Webhooks::SubscriptionDeleted.new

  # Monitor changes for customer's default card changing
  events.subscribe 'customer.updated', Pay::Stripe::Webhooks::CustomerUpdated.new

  # If a customer was deleted in Stripe, their subscriptions should be cancelled
  events.subscribe 'customer.deleted', Pay::Stripe::Webhooks::CustomerDeleted.new

  # If a customer's payment source was deleted in Stripe, we should update as well
  events.subscribe 'customer.source.deleted', Pay::Stripe::Webhooks::SourceDeleted.new
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pay-1.0.2 lib/pay/stripe/webhooks.rb
pay-1.0.1 lib/pay/stripe/webhooks.rb
pay-1.0.0 lib/pay/stripe/webhooks.rb
pay-1.0.0.rc3 lib/pay/stripe/webhooks.rb
pay-1.0.0.rc2 lib/pay/stripe/webhooks.rb
pay-1.0.0.rc1 lib/pay/stripe/webhooks.rb
pay-1.0.0.beta5 lib/pay/stripe/webhooks.rb