Skip to content

Commit

Permalink
Skip Checkout Session charge sync if latest charge is nil. Fixes #1006
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 committed Jul 1, 2024
1 parent 90ace6b commit 720c624
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pay/stripe/webhooks/checkout_session_completed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def call(event)

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

if (subscription_id = event.data.object.subscription)
Expand Down

0 comments on commit 720c624

Please sign in to comment.