Subscriptions for WooCommerce enables you to provide customers an option for subscribing your products and services to your WooCommerce store. Sell subscriptions for physical and downloadable products. You can avail WooCommerce recurring revenue with a complete subscription plan management. Collect repeated payments by your subscriptions orders.
Stripe Webhook/Frontend Checkout Fails with Stripe Gateway Plugin for WooCommerce's New Checkout Experience When Total Amount is $0 Due to Free Trial Period #255
Subscriptions for WooCommerce needs an update for free trials to be recognized as payment needed so that Stripe will process the webhook successfully and store the credit card record for auto payment after the trial period.
Original Post:
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:
Add a subscription product to the cart that includes a free trial period, resulting in a $0 total at checkout.
Go to the checkout page on my WooCommerce site.
Enter payment details using the Stripe payment gateway.
Submit the order.
Observe that the frontend does not redirect to the order confirmation page and instead shows a Cannot read properties of undefined (reading 'match') error above the card payment detail block.
The order is successfully submitted, customer and admin receive the order confirmation email. Subscription is successfully created in the backend. Payment/Order does not show up in Stripe's webhook logs. No errors in console.
Behavior in Legacy Stripe Mode:
Submit the order.
Customer is redirected to Order Confirmation Page and receives a confirmation email. Admin receives "order received" email. Subscription is created in the backend.
Webhook connection successful between WooCommerce and Stripe. A "POST /v1/payment_methods" log is created with customer and order details. Customer is not added in Customer table and order does not show up in Transactions table within Stripe.
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):
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
WordPress Version 6.6.1
WooCommerce Version 9.1.4
Stripe Plugin Version 8.6.1
-Active plugins (25):
Gravity Forms by Gravity Forms – 2.8.15
BookingPress Pro - Appointment Booking plugin by Repute Infosystems – 3.9
BookingPress Appointment Booking by Repute Infosystems – 1.1.8
BookingPress - Google Calendar Integration Addon by Repute InfoSystems – 2.7
Elementor Pro by Elementor.com – 3.23.3
Elementor by Elementor.com – 3.23.4
Essential Addons for Elementor - Pro by WPDeveloper – 5.8.17
Essential Addons for Elementor by WPDeveloper – 5.9.27
Gravity Forms Conversational Forms Add-On by Gravity Forms – 1.4.0
Gravity Forms Mailchimp Add-On by Gravity Forms – 5.4.0
Gravity Forms Partial Entries Add-On by Gravity Forms – 1.7
Gravity Forms Quiz Add-On by Gravity Forms – 4.1
Gravity Forms reCAPTCHA Add-On by Gravity Forms – 1.5.0
Gravity Forms User Registration Add-On by Gravity Forms – 5.3.0
Gravity SMTP by Gravity Forms – 1.3.0
MC4WP: Mailchimp for WordPress by ibericode – 4.9.14
PowerPack Lite for Elementor by IdeaBox Creations – 2.7.26
Rank Math SEO by Rank Math – 1.0.225
Speed Optimizer by SiteGround – 7.6.3
Security Optimizer by SiteGround – 1.5.2
Subscriptions For WooCommerce by WP Swings – 1.7.0
Force Authentification Before Checkout for WooCommerce by Luiz Bills – 1.4.4
Preview E-mails for WooCommerce by Digamber Pradhan – 2.2.13
WooCommerce Stripe Gateway by WooCommerce – 8.6.1
WooCommerce by Automattic – 9.1.4
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.
Please view my original post in woocommerce/woocommerce-gateway-stripe for more context. It's a : https://github.com/woocommerce/woocommerce-gateway-stripe/issues/3350
Subscriptions for WooCommerce needs an update for free trials to be recognized as payment needed so that Stripe will process the webhook successfully and store the credit card record for auto payment after the trial period.
Original Post: 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.