diff --git a/app/PaymentDrivers/Stripe/CreditCard.php b/app/PaymentDrivers/Stripe/CreditCard.php index 565b038207b7..6b72bee7107b 100644 --- a/app/PaymentDrivers/Stripe/CreditCard.php +++ b/app/PaymentDrivers/Stripe/CreditCard.php @@ -120,6 +120,16 @@ class CreditCard { $stripe_method = $this->stripe->getStripePaymentMethod($this->stripe->payment_hash->data->server_response->payment_method); + $data = [ + 'payment_method' => $this->stripe->payment_hash->data->server_response->payment_method, + 'payment_type' => PaymentType::parseCardType(strtolower($stripe_method->card->brand)), + 'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->server_response->amount, $this->stripe->client->currency()->precision), + 'transaction_reference' => $this->stripe->payment_hash->data->server_response->id, + ]; + + $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, ['amount' => $data['amount']]); + $this->stripe->payment_hash->save(); + if ($this->stripe->payment_hash->data->store_card) { $customer = $this->stripe->findOrCreateCustomer(); @@ -128,13 +138,6 @@ class CreditCard $this->storePaymentMethod($stripe_method, $this->stripe->payment_hash->data->payment_method_id, $customer); } - $data = [ - 'payment_method' => $this->stripe->payment_hash->data->server_response->payment_method, - 'payment_type' => PaymentType::parseCardType(strtolower($stripe_method->card->brand)), - 'amount' => $this->stripe->convertFromStripeAmount($this->stripe->payment_hash->data->server_response->amount, $this->stripe->client->currency()->precision), - 'transaction_reference' => $this->stripe->payment_hash->data->server_response->id, - ]; - $payment = $this->stripe->createPayment($data, \App\Models\Payment::STATUS_COMPLETED); SystemLogger::dispatch(