Skip to content

Commit 9a75c56

Browse files
authored
Fix call to a member function get_token() on null (#3626)
* call process_payment function when retrying a payment * add changelog
1 parent 7779798 commit 9a75c56

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* Fix - Return 'is_live' as true in account summary response when test mode is disabled in gateway settings and charge is enabled in Stripe account.
1515
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early (only shown on stores with WP_DEBUG enabled).
1616
* Fix - Prevent showing the shipping options on express checkout modal for virtual product variations.
17+
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
1718
* Tweak - Update links to plugin documentation and Stripe documentation.
1819

1920
= 8.9.0 - 2024-11-14 =

includes/payment-methods/class-wc-stripe-upe-payment-gateway.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ public function save_payment_method_to_order( $order, $payment_method ) {
14151415
/**
14161416
* Retries the payment process once an error occured.
14171417
*
1418-
* @param object $intent The Payment Intent response from the Stripe API.
1418+
* @param object $response The response from the Stripe API.
14191419
* @param WC_Order $order An order that is being paid for.
14201420
* @param bool $retry A flag that indicates whether another retry should be attempted.
14211421
* @param bool $force_save_source Force save the payment source.
@@ -1424,7 +1424,7 @@ public function save_payment_method_to_order( $order, $payment_method ) {
14241424
* @throws WC_Stripe_Exception If the payment is not accepted.
14251425
* @return array|void
14261426
*/
1427-
public function retry_after_error( $intent, $order, $retry, $force_save_source = false, $previous_error = false, $use_order_source = false ) {
1427+
public function retry_after_error( $response, $order, $retry, $force_save_source = false, $previous_error = false, $use_order_source = false ) {
14281428
if ( ! $retry ) {
14291429
$localized_message = __( 'Sorry, we are unable to process your payment at this time. Please retry later.', 'woocommerce-gateway-stripe' );
14301430
$order->add_order_note( $localized_message );
@@ -1433,13 +1433,13 @@ public function retry_after_error( $intent, $order, $retry, $force_save_source =
14331433

14341434
// Don't do anymore retries after this.
14351435
if ( 5 <= $this->retry_interval ) {
1436-
return $this->process_payment_with_saved_payment_method( $order->get_id(), false );
1436+
return $this->process_payment( $order->get_id(), false, $force_save_source, $response->error, $previous_error );
14371437
}
14381438

14391439
sleep( $this->retry_interval );
14401440
$this->retry_interval++;
14411441

1442-
return $this->process_payment_with_saved_payment_method( $order->get_id(), true );
1442+
return $this->process_payment( $order->get_id(), true, $force_save_source, $response->error, $previous_error );
14431443
}
14441444

14451445
/**

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
124124
* Fix - Return 'is_live' as true in account summary response when test mode is disabled in gateway settings and charge is enabled in Stripe account.
125125
* Fix - Prevents notices being displayed on WordPress 6.7 due to loading translations too early (only shown on stores with WP_DEBUG enabled).
126126
* Fix - Prevent showing the shipping options on express checkout modal for virtual product variations.
127+
* Fix - Do not assume payment is using a saved card when retrying a failed payment.
127128
* Tweak - Update links to plugin documentation and Stripe documentation.
128129

129130
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).

0 commit comments

Comments
 (0)