Class: Pay::Stripe::Webhooks::PaymentIntentSucceeded

Inherits:
Object
  • Object
show all
Defined in:
lib/pay/stripe/webhooks/payment_intent_succeeded.rb

Instance Method Summary collapse

Instance Method Details

#call(event) ⇒ Object

This webhook does NOT send notifications because stripe sends both ‘charge.succeeded` and `payment_intent.succeeded` events.

We use ‘charge.succeeded` as the single place to send notifications



10
11
12
13
14
# File 'lib/pay/stripe/webhooks/payment_intent_succeeded.rb', line 10

def call(event)
  object = event.data.object
  payment_intent = ::Stripe::PaymentIntent.retrieve({id: object.id}, {stripe_account: event.try(:account)}.compact)
  Pay::Stripe::Charge.sync(payment_intent.latest_charge, stripe_account: event.try(:account))
end