Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stripe Link is Incompatible with Subscription Renewals #6261

Closed
csmcneill opened this issue May 9, 2023 · 15 comments · Fixed by #6784 or #7026
Closed

Stripe Link is Incompatible with Subscription Renewals #6261

csmcneill opened this issue May 9, 2023 · 15 comments · Fixed by #6784 or #7026
Assignees
Labels
component: stripe link The issues/PRs related to the StripeLink project component: wc subscriptions integration Issues affecting subscriptions with WC Subscriptions plugin active. type: bug The issue is a confirmed bug.

Comments

@csmcneill
Copy link
Contributor

Describe the bug

If a subscription is purchased via Stripe Link, subsequent renewals will not process. They will fail with the following error:

2023-05-09T01:38:14+00:00 ERROR There is no saved payment token for order # [...]

In my tests, the pm_ ID is stored correctly in Stripe, but that information isn't being passed to Woo or stored on the site to retrieve that information for renewals.

To Reproduce

  1. Enable UPE and enable Stripe Link.
  2. Purchase a subscription product.
  3. Edit the subscription at WooCommerce > Subscriptions and attempt to change the payment method—you will be unable to.
  4. Go through the Renew now flow and the subscription can be renewed as the customer has to go through the checkout flow again.
  5. Process a renewal via the Subscription actions metabox or by manually running the associated woocommerce_scheduled_subscription_payment scheduled action.
  6. The renewal order will fail.

Actual behavior

If a customer purchases a subscription via Stripe Link, the renewals fail, and there is no way for the subscription tokens to be added manually.

Screenshots

Markup on 2023-05-09 at 17:42:14

Markup on 2023-05-09 at 17:43:15

Markup on 2023-05-09 at 17:43:53

Markup on 2023-05-09 at 17:44:20

Expected behavior

Either of the following:

  1. Subscriptions purchased via Stripe Link renew properly.
  2. Stripe Link is not offered for carts that include a subscription product.

Additional context

p1683573649730159-slack-C7U3Y3VMY
6271366-zen

@csmcneill csmcneill added type: bug The issue is a confirmed bug. component: stripe link The issues/PRs related to the StripeLink project component: wc subscriptions integration Issues affecting subscriptions with WC Subscriptions plugin active. labels May 9, 2023
@zmaglica
Copy link
Contributor

According to Pc2DNy-3z-p2, this falls in Helix @haszari. Tagging as a part of Gamma Porter duties PcreKM-yM-p2.

@haszari
Copy link
Contributor

haszari commented May 18, 2023

Thanks – since this is subscription related it's best to hand over to Quark - FYI @thenbrent .

I'll update the Product Responsibilities page (Pc2DNy-3z-p2) to add Quark team for WCPay Subscriptions.

@maxlaf
Copy link
Member

maxlaf commented Jun 28, 2023

6477405-zen

@frosso
Copy link
Contributor

frosso commented Jul 12, 2023

As a temporary "fix", we have #6709 . But we might end up closing #6709 for a more definitive solution.

@timur27
Copy link
Contributor

timur27 commented Aug 4, 2023

Hey @csmcneill, we've just merged some implementation into develop which should fix the issue and I couldn't reproduce it. May we ask you to test the fix if your setup allows it and let us know if we can close the issue?

cc @FangedParakeet

@csmcneill
Copy link
Contributor Author

Hey @timur27! If you can provide me with a ZIP I can install on my test site, I'll be glad to give it a whirl. When I try to activate the develop branch after uploading it to the site, I get a fatal error (which is probably due to my own naïveté):

Fatal error: Uncaught Error: Failed opening required '/srv/htdocs/wp-content/plugins/woocommerce-payments/vendor/autoload_packages.php' (include_path='.:') in /srv/htdocs/wp-content/plugins/woocommerce-payments/woocommerce-payments.php:27
Stack trace:
#0 /wordpress/core/6.2.2/wp-admin/includes/plugin.php(2314): include_once()
#1 /wordpress/core/6.2.2/wp-admin/includes/plugin.php(661): plugin_sandbox_scrape('woocommerce-pay...')
#2 phar:///usr/local/bin/wp-cli/vendor/wp-cli/extension-command/src/Plugin_Command.php(347): activate_plugin('woocommerce-pay...', '', NULL)
#3 [internal function]: Plugin_Command->activate(Array, Array)
#4 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func(Array, Array, Array)
#5 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#6 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(491): call_user_func(Object(Closure), Array, Array)
#7 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(419): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#8 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(442): WP_CLI\Runner->run_command(Array, Array)
#9 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1256): WP_CLI\Runner->run_command_and_exit()
#10 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start()
#11 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/bootstrap.php(78): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState))
#12 phar:///usr/local/bin/wp-cli/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap()
#13 phar:///usr/local/bin/wp-cli/php/boot-phar.php(11): include('phar:///usr/loc...')
#14 /usr/local/bin/wp-cli(4): include('phar:///usr/loc...')
#15 {main}
  thrown in /srv/htdocs/wp-content/plugins/woocommerce-payments/woocommerce-payments.php on line 27

@timur27
Copy link
Contributor

timur27 commented Aug 7, 2023

@csmcneill Thanks for your attempt while testing this, Chris! Could you please try woo-payments-develop.zip and let us know if any other support from our side would be needed to test it. Thank you!

@csmcneill
Copy link
Contributor Author

@timur27 I don't have access to Zenhub, so that link isn't quite working for me 😞

The error I get is when I download the ZIP from GH...

Markup 2023-08-07 at 10 17 51

...and then try to activate it on my test site. I've tried activating it via wp-admin and WP CLI without success.

@FangedParakeet
Copy link
Contributor

The error I get is when I download the ZIP from GH...

This is probably happening because if you just download the raw repo zip from GH, you still need to build all the dependencies before you can use it on a test site. Nonetheless never fear, here's one I made earlier--hopefully the link below works for you! @csmcneill, gimme a shout if it's still not opening and I'll figure something else out.

woocommerce-payments.zip

@csmcneill
Copy link
Contributor Author

csmcneill commented Aug 8, 2023

Thanks a ton for that @FangedParakeet!

I tested this out on the same site I was using to explore #4492 (read p1691503660845959-slack-CGGCLBN58 for all the juicy details, including login information) and am still unable to renew a subscription paid via Link:

Markup on 2023-08-08 at 13:57:06

Edit: I realized that what I was testing is very similar to the flow in #4492 since the site's currency was still set to EUR. However, disabling multicurrency completely and changing the site's currency to USD still yields the same error.

@FangedParakeet FangedParakeet self-assigned this Aug 9, 2023
@FangedParakeet
Copy link
Contributor

#6965 has now been tested internally, approved, and merged. @csmcneill, if I may summon you once more and beseech you to retest this issue one more time, whenever you're able, can you please let me know if we have indeed managed to patch this problem this time. I am now able to reliably process subscription payments on my own test site, so hopefully these new changes now successfully address this issue directly.

Please find an updated build of the plugin attached below for you to trial on a test site. As always many thanks in advance and hopefully we have managed to resolve this issue for good this time. 🙏

woocommerce-payments-latest.zip

@frosso
Copy link
Contributor

frosso commented Aug 17, 2023

@FangedParakeet (& @csmcneill ) FWIW, I created a subscription with Stripe Link.
As a merchant, I manually renewed the subscription. It worked.
Then, as a customer, I manually changed the subscription's payment method to "card". As a merchant, I manually renewed the subscription again. It also worked.

I think the fix was good 👍

(The subscription was processed with the "Legacy UPE" because of the current fallback from the Split UPE).

@frosso
Copy link
Contributor

frosso commented Aug 17, 2023

@csmcneill feel free to test this further - otherwise, we can mark this ticket as closed?

@FangedParakeet
Copy link
Contributor

I tested this on a fresh JN and I was able to process a subscription renewal with Stripe Link...but I did face a few other issues and can confirm that @csmcneill is not losing his mind and imagining things. 😂

(The subscription was processed with the "Legacy UPE" because of the current fallback from the Split UPE).

This is the key basically. Stripe Link payment tokens are being sent to the non-existent woocommerce_payments_link gateway instead of the woocommerce_payments gateway where they should belong--only when the split UPE is enabled.

I've just authored #7026 that should resolve this and bring balance to the force once and for all. That PR also adds a fix that I believe will ensure that SEPA Debit is functional as a saved payment method/subscription payment method as well. However, I have not yet fully enabled SEPA Debit when the split UPE is enabled (so you will have to manually edit this function to test SEPA with the split UPE), as I would rather wait for consensus in #5517 and test SEPA with the split UPE a bit more comprehensively, before leaping to enable it in #7026.

Nonetheless I'm pretty confident #7026 will finally dam the floodgate of tears unloaded by this issue, so once it is merged, I think we should be able to close out this issue at last.

@FangedParakeet
Copy link
Contributor

@csmcneill, I think we can test this one internally in #7026, so if your hands are full don't feel the need to drop whatever they're currently occupied with. Nonetheless if your curiosity cannot be constrained, here's a new build that contains the Stripe Link fix, should you yearn to see the promised land with your own eyes.

woocommerce-payments-stripe-link-fix.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: stripe link The issues/PRs related to the StripeLink project component: wc subscriptions integration Issues affecting subscriptions with WC Subscriptions plugin active. type: bug The issue is a confirmed bug.
Projects
None yet
7 participants