From b71c4965e237d3989a0870e7d5498bf10e76c29c Mon Sep 17 00:00:00 2001 From: Lars Kusch Date: Tue, 26 Oct 2021 17:54:42 +0200 Subject: [PATCH] Fixes for Stripe Webhook --- app/PaymentDrivers/StripePaymentDriver.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 93cc87f8cd85..1c07e5d82895 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -519,7 +519,12 @@ class StripePaymentDriver extends BaseDriver ->where('transaction_reference', $transaction['id']) ->where('company_id', $request->getCompany()->id) ->first(); - + if (empty($payment)){ + $payment = Payment::query() + ->where('transaction_reference', $transaction['payment_intent']) + ->where('company_id', $request->getCompany()->id) + ->first(); + } if ($payment) { $payment->status_id = Payment::STATUS_COMPLETED; $payment->save(); @@ -540,7 +545,12 @@ class StripePaymentDriver extends BaseDriver ->where('transaction_reference', $transaction['id']) ->where('company_id', $request->getCompany()->id) ->first(); - + if (empty($payment)){ + $payment = Payment::query() + ->where('transaction_reference', $transaction['payment_intent']) + ->where('company_id', $request->getCompany()->id) + ->first(); + } if ($payment) { $payment->status_id = Payment::STATUS_COMPLETED; $payment->save();