diff --git a/changelog.txt b/changelog.txt index ff9636184..ff6eb5cdf 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ * Tweak - Updates the Single Payment Element setting copy. Now it is labeled "Smart Checkout". * Update - Enable/disable Amazon Pay by adding/removing it from the enabled payment methods list. * Add - Add ACSS payment tokenization. +* Fix - Fix duplicate token retrieval for reusable payment methods other than card. = 9.3.0 - 2025-03-13 = * Dev - Adds a new README.md file to the plugin with specific development-focused instructions. diff --git a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php index 86b89b6d3..ce74cd2fc 100644 --- a/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php +++ b/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php @@ -2455,7 +2455,7 @@ protected function handle_saving_payment_method( WC_Order $order, $payment_metho } // Searches for an existing duplicate token to update. - $found_token = WC_Stripe_Payment_Tokens::get_duplicate_token( $payment_method_object, $customer->get_user_id(), $this->id ); + $found_token = WC_Stripe_Payment_Tokens::get_duplicate_token( $payment_method_object, $customer->get_user_id(), $payment_method_instance->id ); if ( $found_token ) { // Update the token with the new payment method ID. @@ -2613,7 +2613,7 @@ public function add_payment_method() { $customer->clear_cache(); // Check if a token with the same payment method details exist. If so, just updates the payment method ID and return. - $found_token = WC_Stripe_Payment_Tokens::get_duplicate_token( $payment_method_object, $user->ID, $this->id ); + $found_token = WC_Stripe_Payment_Tokens::get_duplicate_token( $payment_method_object, $user->ID, $payment_method->id ); // If we have a token found, update it and return. if ( $found_token ) { diff --git a/readme.txt b/readme.txt index a23538d0d..c04c97cf3 100644 --- a/readme.txt +++ b/readme.txt @@ -117,5 +117,6 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o * Tweak - Updates the Single Payment Element setting copy. Now it is labeled "Smart Checkout". * Update - Enable/disable Amazon Pay by adding/removing it from the enabled payment methods list. * Add - Add ACSS payment tokenization. +* Fix - Fix duplicate token retrieval for reusable payment methods other than card. [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).