Skip to content

Commit 18d9396

Browse files
authored
Fix duplicate emails and order notes when processing setup intent requests (#3421)
* Lock the order before creating and confirm both payment and setup intents * Add changelog entry * Add changelog to readme.txt
1 parent bb7a67a commit 18d9396

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* Fix - Ensure payment tokens are detached from Stripe when a user is deleted, regardless of if the admin user has a Stripe account.
2828
* Fix - Address Klarna availability based on correct presentment currency rules.
2929
* Fix - Use correct ISO country code of United Kingdom in supported country and currency list of AliPay and WeChat.
30+
* Fix - Prevent duplicate order notes and emails being sent when purchasing subscription products with no initial payment.
3031

3132
= 8.6.1 - 2024-08-09 =
3233
* Tweak - Improves the wording of the invalid Stripe keys errors, instructing merchants to click the "Configure connection" button instead of manually setting the keys.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,11 +795,13 @@ private function process_payment_with_deferred_intent( int $order_id ) {
795795
$this->update_saved_payment_method( $payment_method_id, $order );
796796
}
797797

798+
// Lock the order before we create and confirm the payment/setup intents to prevent Stripe sending the success webhook before this request is completed.
799+
$this->lock_order_payment( $order );
800+
798801
if ( $payment_needed ) {
799802
// Throw an exception if the minimum order amount isn't met.
800803
$this->validate_minimum_order_amount( $order );
801804

802-
$this->lock_order_payment( $order );
803805
// Create a payment intent, or update an existing one associated with the order.
804806
$payment_intent = $this->process_payment_intent_for_order( $order, $payment_information );
805807
} else {

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,6 @@ If you get stuck, you can ask for help in the Plugin Forum.
155155
* Fix - Ensure payment tokens are detached from Stripe when a user is deleted, regardless of if the admin user has a Stripe account.
156156
* Fix - Address Klarna availability based on correct presentment currency rules.
157157
* Fix - Use correct ISO country code of United Kingdom in supported country and currency list of AliPay and WeChat.
158+
* Fix - Prevent duplicate order notes and emails being sent when purchasing subscription products with no initial payment.
158159

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

0 commit comments

Comments
 (0)