Skip to content

Commit 0ad0cc1

Browse files
james-allana-danae
andauthored
Fix Stripe Link errors and potential duplicate payments when purchasing a subscription product (#3304)
* Use link to create link payment method objects * Add changelog entries * Add comment --------- Co-authored-by: Danae Millan <[email protected]>
1 parent a15ddf9 commit 0ad0cc1

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*** Changelog ***
22

33
= 8.5.2 - xxxx-xx-xx =
4+
* Fix - Fixed errors when using Link to purchase subscription products that could lead to duplicate payment attempts.
45
* Fix - Prevent failures creating SetupIntents when using a non-saved payment method on the Legacy checkout experience.
56

67
= 8.5.1 - 2024-07-12 =

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2188,8 +2188,14 @@ private function handle_saving_payment_method( WC_Order $order, $payment_method_
21882188
$customer = new WC_Stripe_Customer( $user->ID );
21892189
$customer->clear_cache();
21902190

2191+
// If the payment method object is a Link payment method, use the Link payment method instance to create the payment token.
2192+
if ( isset( $payment_method_object->type ) && 'link' === $payment_method_object->type ) {
2193+
$payment_method_instance = $this->payment_methods['link'];
2194+
} else {
2195+
$payment_method_instance = $this->payment_methods[ $payment_method_type ];
2196+
}
2197+
21912198
// Create a payment token for the user in the store.
2192-
$payment_method_instance = $this->payment_methods[ $payment_method_type ];
21932199
$payment_method_instance->create_payment_token_for_user( $user->ID, $payment_method_object );
21942200

21952201
// Add the payment method information to the order.

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ If you get stuck, you can ask for help in the Plugin Forum.
129129
== Changelog ==
130130

131131
= 8.5.2 - xxxx-xx-xx =
132+
* Fix - Fixed errors when using Link to purchase subscription products that could lead to duplicate payment attempts.
132133
* Fix - Prevent failures creating SetupIntents when using a non-saved payment method on the Legacy checkout experience.
133134

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

0 commit comments

Comments
 (0)