From 2a483cf217be54f2d2dc8424f2e96b845345dedd Mon Sep 17 00:00:00 2001 From: Nico Mollet Date: Thu, 26 Oct 2023 16:56:41 +0200 Subject: [PATCH 1/2] Get the last payment error pm or src --- includes/class-wc-gateway-stripe.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/includes/class-wc-gateway-stripe.php b/includes/class-wc-gateway-stripe.php index afa5a7225..0ab86d175 100644 --- a/includes/class-wc-gateway-stripe.php +++ b/includes/class-wc-gateway-stripe.php @@ -671,14 +671,15 @@ public function prepare_intent_for_order_pay_page( $order = null ) { if ( 'requires_payment_method' === $intent->status && isset( $intent->last_payment_error ) && 'authentication_required' === $intent->last_payment_error->code ) { - $level3_data = $this->get_level3_data_from_order( $order ); - $intent = WC_Stripe_API::request_with_level3_data( - [ - 'payment_method' => $intent->last_payment_error->source->id, - ], - 'payment_intents/' . $intent->id . '/confirm', - $level3_data, - $order + $level3_data = $this->get_level3_data_from_order( $order ); + $payment_method = WC_Stripe_Helper::get_payment_method_from_intent( $intent ); + $intent = WC_Stripe_API::request_with_level3_data( + [ + 'payment_method' => is_string( $payment_method ) ? $payment_method : $payment_method->id, + ], + 'payment_intents/' . $intent->id . '/confirm', + $level3_data, + $order ); if ( isset( $intent->error ) ) { From 92a3dd6903c94e3e209b083572dc98ccea85295b Mon Sep 17 00:00:00 2001 From: Nico Mollet Date: Thu, 26 Oct 2023 17:15:53 +0200 Subject: [PATCH 2/2] It's the last_payment_error intent --- includes/class-wc-gateway-stripe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-gateway-stripe.php b/includes/class-wc-gateway-stripe.php index 0ab86d175..4f1f074ea 100644 --- a/includes/class-wc-gateway-stripe.php +++ b/includes/class-wc-gateway-stripe.php @@ -672,7 +672,7 @@ public function prepare_intent_for_order_pay_page( $order = null ) { if ( 'requires_payment_method' === $intent->status && isset( $intent->last_payment_error ) && 'authentication_required' === $intent->last_payment_error->code ) { $level3_data = $this->get_level3_data_from_order( $order ); - $payment_method = WC_Stripe_Helper::get_payment_method_from_intent( $intent ); + $payment_method = WC_Stripe_Helper::get_payment_method_from_intent( $intent->last_payment_error ); $intent = WC_Stripe_API::request_with_level3_data( [ 'payment_method' => is_string( $payment_method ) ? $payment_method : $payment_method->id,