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

Add subscriptions support to Bacs #3987

Merged
merged 12 commits into from
Mar 6, 2025
Merged

Conversation

asumaran
Copy link
Contributor

@asumaran asumaran commented Feb 26, 2025

Closes #3798

Changes proposed in this Pull Request:

The changes here are quite simple. The most important one is enabling Bacs support for subscriptions. By default, Bacs should work well for the subscription cases listed below, except for subscriptions with a free trial. For now, the Bacs payment method is being disabled for subscriptions with a free trial as it will be addressed separately. More info here.

Testing instructions

Important

First, make sure that the business in your Stripe account is located in the UK (link) and that your default currency is GBP (link). Otherwise you won't be able to see Bacs as a payment option.

Important

Update the store country to the UK and set the currency to GBP in the WooCommerce settings.

Important

Also, make sure the Bacs feature is enabled. You can use the following to do that:
wp option update _wcstripe_feature_lpm_bacs 'yes'

Install the WooCommerce Subscriptions and test checking out using following subscription variatons.

  • Simple subscription.
    • Virtual product.
    • Physical product.
  • Variable subscription.
    • Virtual products.
    • Physical products.
  • Simple subscription with:
    • Free Trial
      {
        "error": {
          "message": "Your account isn't configured to directly use SetupIntents to create Mandates for Bacs Direct Debits. See https://stripe.com/docs/payments/payment-methods/bacs-debit to learn more, or contact us through https://support.stripe.com/contact/.",
          "param": "deferred_intent.payment_method_types",
          "request_log_url": "https://dashboard.stripe.com/acct_1Ja916HJAl4h87JO/test/logs/req_D2rNbNMZcnr08C?t=1740691770",
          "type": "invalid_request_error"
        }
      }
      
    • Sign Up Fee.
    • Free trial with Sign Up Fee

It would be nice to test with shortcode checkout and the checkout block.


  • Covered with tests (or have a good reason not to test in description ☝️)
  • Tested on mobile (or does not apply)

Changelog entry

  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Comment

Comment

Post merge

@asumaran asumaran force-pushed the as-bacs-subscription-support branch from dd423aa to fefa53c Compare February 27, 2025 18:34
@asumaran asumaran force-pushed the as-bacs-subscription-support branch from fefa53c to 8d63e1e Compare March 3, 2025 19:32
@asumaran asumaran marked this pull request as ready for review March 3, 2025 21:07
@asumaran asumaran requested review from a team and lovo-h and removed request for a team March 3, 2025 21:09
@asumaran asumaran self-assigned this Mar 3, 2025
@asumaran asumaran added the component: LPMs/APMs Issues related to LPMs/APMs label Mar 3, 2025
Copy link
Contributor

@lovo-h lovo-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes are looking good. However, I left a few comments that we may want to address before proceeding with a merge.

Also, we discussed testing compatibility with coupons and how that may affect the Bacs payment method. Will that be addressed here?

@asumaran
Copy link
Contributor Author

asumaran commented Mar 5, 2025

Also, we discussed testing compatibility with coupons and how that may affect the Bacs payment method. Will that be addressed here?

@lovo-h Since the changes here are somewhat related, I’d say yes. I’ll double-check tomorrow to ensure coupons are working as expected.

@asumaran asumaran requested a review from lovo-h March 5, 2025 21:54
@asumaran
Copy link
Contributor Author

asumaran commented Mar 5, 2025

@lovo-h, regarding coupons, I just verified that it’s actually unrelated to Bacs. When a coupon that discounts 100% of the total amount is applied, the payment methods are removed from the checkout form. So, it works without any issues.

Screenshot 2025-03-05 at 4 57 59 PM

And the payment methods are restored after the coupon is removed

Screenshot 2025-03-05 at 4 58 33 PM

Copy link
Contributor

@lovo-h lovo-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Thanks for clarifying the £0.30 minimum charge in the comments.

The code looks good and tests mostly well. However, I am setting the PR's status to Request changes because for the Blocks Checkout / simple subscription with free trial, there was a difference between the behavior in the shortcode checkout and the blocks checkout. Do you know if this was expected?

Testing Instructions

Install the WooCommerce Subscriptions and test checking out using the following subscription variations.

Shortcode Checkout

  • Simple subscription.
    • 🟢 Virtual product.
    • 🟢 Physical product.
  • Variable subscription.
    • 🟢 Virtual products.
    • 🟢 Physical products.
  • 🟢 Sign-up Fee.
  • 🟢 Free trial with sign-up fee.
  • 🟢 Simple subscription with free trial. Hides the Bacs PM as intended (see image below).
    image

Blocks Checkout

  • Simple subscription.
    • 🟢 Virtual product.
    • 🟢 Physical product.
  • Variable subscription.
    • 🟢 Virtual products.
    • 🟢 Physical products.
  • 🟢 Sign-up Fee.
  • 🟢 Free trial with sign-up fee.
  • 🟡 Simple subscription with free trial. The Bacs PM is not hidden, and the following error appears (see image below).
    image

@asumaran
Copy link
Contributor Author

asumaran commented Mar 6, 2025

@lovo-h, I can’t reproduce the issue you mentioned with simple subscriptions with a free trial. Have you pulled the latest changes? I’m going to need more information on this. A screenshot of the checkout form would be very helpful.

@lovo-h lovo-h self-requested a review March 6, 2025 15:05
Copy link
Contributor

@lovo-h lovo-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asumaran, after resetting my environment, I was not able to reproduce the issue in the blocks checkout. Everything else looks good 👍

Test Instructions

Blocks Checkout

  • 🟢 Simple subscription with free trial. Hides the Bacs PM as intended (see image below).

image

@asumaran asumaran enabled auto-merge (squash) March 6, 2025 15:49
@asumaran asumaran merged commit a3349e0 into develop Mar 6, 2025
36 of 38 checks passed
@asumaran asumaran deleted the as-bacs-subscription-support branch March 6, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: LPMs/APMs Issues related to LPMs/APMs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bacs: WooCommerce Subscriptions support
2 participants