Open ydwnj opened 1 month ago
Hey @ydwnj. Thanks for filing this issue.
The issue here is caused by the WooCommerce Subscriptions plugin. When purchasing free trial subscription products via the block checkout, the WooCommerce Subscriptions product doesn't communicate to WooCommerce core that the order needs a payment method and so WooCommerce isn't expecting payment processing to occur.
We have a fix for it here and it will go out in the next Subscriptions release. https://github.com/Automattic/woocommerce-subscriptions-core/pull/642
Thank you, I checked out your fix; however, I'm using the Subscriptions for WooCommerce plugin so I don't have the subscription coupon type. I did try to use a 100% off coupon on a signup fee > $0 with a trial period to see if anything reacts to that scenario, but I still get the same error.
It's interesting that the same error is occuring on both plugins. This is the first time I'm using a subscription plugin so I don't have any baseline expected behavior. Were free trials always processing correctly in the past? Is this error being caused by recent WooCommerce updates?
I'm curious because your plugin update won't help me if it's a fix, vs. a WooCommerce base issue that needs to be updated to factor in $0 recurring subscription scenario.
Ah ok. We'll need to look into it from the Stripe plugin side too. I just have a feeling that approach is somewhat suppressing the error and the checkout isn't handling the situation correctly.
We had the issue in the official WooCommerce Subscriptions plugin so I fixed it there, but as @Mayisha mentioned when she tested that PR, she couldn't replicate the bug when using the legacy checkout experience. With that in mind there's a way we could prevent the error from the Stripe plugin side too.
That would be great! Any guess how long for a fix? My client is eager to go live, so for now, this is what I'm doing:
It's not the ideal customer journey and would prefer a more seamless transaction process.
Hey @ydwnj,
Sorry for the lengthy response. I've been looking into what it would take to fix the error on the Stripe plugin side. However, as I mentioned in my last message, what we can do from the Stripe plugin side only suppresses the error rather than fixing the root issue.
I'm not deeply familiar with the subscription plugin you're using, but you mentioned that at step 2, you send an email to your customer at the end of the trial period with a link to checkout. Is that checkout also free ($0), and is it just to collect payment information?
For some background, the error occurs due to a mismatch in how WooCommerce Core handles things on the Block checkout. The payment methods are displayed at checkout because the cart requires payment, but payment processing only occurs if the order requires payment. In this scenario, the cart needs payment, but the order doesn't. As a result, when the customer submits the checkout, the Stripe payment gateway expects a payment response from the server, but instead, it receives a response indicating that payment wasn't needed.
On the Stripe gateway side, we can address this error by checking the server response before assuming it's a payment response. However, this leads to other issues. If your customer signs up with a 3D-Secure card, and WooCommerce Core doesn't attempt any payment processing, the card is never authenticated, leading to future payment failures.
To recap, we can fix the error message from the Stripe side, but if a customer signs up with a 3D-Secure enabled card, their future payments will fail.
The real fix for this error involves ensuring that WooCommerce processes this request as a payment request, even if the order doesn't require payment. For reference, that's the fix we applied to the WooCommerce Subscriptions plugin.
I can reach out to the WooCommerce Core developers, but it might also be worth reaching out to the Subscriptions for WooCommerce by WP Swings team.
james-allan
No worries - I appreciate you looking into this for me. I've opened up a issue with Subscriptions for WooCommerce. I'm new to here so I don't know how to reference them / call their attention to this thread.
Describe the bug When using the Stripe Gateway plugin for WooCommerce with the Subscriptions for WooCommerce plugin, an issue occurs during checkout if the total amount due is $0 (due to a free trial period). Instead of proceeding to the order confirmation page, the frontend displays a Cannot read properties of undefined (reading 'match') error above the card payment block. This issue does not occur when the total amount due is greater than $0 or when the plugin is set to legacy checkout mode. This issue persists on both live and test mode.
To Reproduce Steps to reproduce the behavior:
Behavior in Legacy Stripe Mode:
Expected behavior After submitting payment details, even if the total amount due is $0, the user is redirected to the order confirmation page upon successful payment processing. Customer's preferred payment method detail is saved in their account and in Stripe. Order triggers confirmation emails for customer and admin. Stripe webhook succeeds.
Screenshots
Environment (please complete the following information):
Additional context I haven't tested if the subscription triggers after the free trial is over. I just set up a product with 1 day free trial, and process a payment every day to see how it triggers and captures the customer data table to charge the card they input. There is no card saved on file on the WooCommerce side for the customer. Will update here when it triggers.