Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
173 stars 69 forks source link

`invalid_request_error` breaks subscription renewals using SEPA payment method #3776

Closed haszari closed 8 months ago

haszari commented 2 years ago

Describe the bug

We've had a report from a merchant via customer support that subscriptions (recurring) payments are failing with SEPA payment method. Thanks @jrodger @felipelousantos cc @madisoncmiller

Store is using WooCommerce Subscriptions extension with WCPay.

Here's an example request (details removed) and error message:

**Request** 400 ERR | POST | /v1/payment_intents
**Request body** 
{
  "amount": "xxxx",
  "currency": "eur",
  "confirm": "true",
  "payment_method": "pm_1234",
  "customer": "cus_2345",
  "capture_method": "automatic",
  "metadata": {
    "customer_name": "Xx Yyyy",
    "customer_email": "a@b.com",
    "site_url": "https://____.com",
    "order_id": "1234",
    "order_key": "wc_order_4567",
    "payment_type": "recurring"
  },
  "description": "------",
  "payment_method_types": {
    "0": "card"
  },
  "off_session": "true",
  "expand": {
    "0": "charges.data.balance_transaction"
  },
  "application_fee_amount": "123"
}

**Error response** invalid_request_error
The PaymentMethod provided (sepa_debit) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card. Alternatively, update the allowed payment_method_types for this PaymentIntent to include "sepa_debit".

Linking in some Stripe docs relating to SEPA:

Internal reference: p1643974407798379-slack-C02BW3Z8SHK p1643785082212209-slack-C7U3Y3VMY

To Reproduce

I don't have reproduce details and haven't tried reproducing as I'm unfamiliar with SEPA and don't know how to test it locally.

Next step would be for someone familiar with SEPA to reproduce this issue to find out if it's unique to this store or more common.

I imagine the steps are something like:

  1. Enable and onboard to WCPay.
  2. Activate WooCommerce Subscriptions and create a subscription product.
  3. Activate / enable SEPA (via UPE?).
  4. Purchase a subscription as a customer.
  5. Wait for renewal or trigger early renewal.
  6. Renewal fails with error.
haszari commented 2 years ago

@shendy-a8c (current Helix porter) Can you investigate and see if you can reproduce this?

haszari commented 2 years ago

See also possibly related question about iDEAL + WooCommerce Subscriptions: https://github.com/Automattic/woocommerce-payments/issues/3546

pauljacobson commented 2 years ago

We have similar reports in 4740622-zen and in 4765714-zen. This may also be related to #3233

sverleis commented 2 years ago

Same issue with 5358797-zen.

haszari commented 2 years ago

Tagging has high priority based on merchant insight from @Luminus in #3546 .

shrutimoorthy commented 1 year ago

Similar report in 6065983-zen

Brianmitchtay commented 1 year ago

Seeing another case of this in 6170094-zen

Brianmitchtay commented 1 year ago

I've taken some time looking into this and will give the caveat that I'm not a dev so not certain that I'm onto the right thread here, but given the lack of action on this wanted to try and move it forward.

User in 6170094-zen says that all SEPA renewal payments are failing, but that initial payments via SEPA are successful.

Looking over their account I see that the customer is properly created and that the SEPA payment method is correctly set up for re-use.

However, when the request for the renewal payment is being made, it seems that the only payment_method_types included in the request must be Card given the error message

The PaymentMethod provided (sepa_debit) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card

Looking over the request itself I actually don't see payment_method_types included in it at all, but I'm not sure if I'm just misunderstanding something here. However, other payment intents from this merchant's site begin with the array of enabled payment methods.

{
  "payment_method_types": {
    "0": "card",
    "1": "sepa_debit"
  },

This isn't included in the failing request at all from what I can tell.

In setting up a testing site to reproduce this I came up against the fact that because we've closed the beta for SEPA payments, my testing account didn't get SEPA as a payment option..

kmIJFN.png

I'm not certain, but wondering whether when the SEPA beta was closed, that change has somehow prevented the gateway from passing a check and returning as active, so it's not being included as an available payment method type in these recurring payment attempts?

Let me know if there's a way I can enable the SEPA method for my testing site, or how else I can move this forward.

WEBLAZER commented 1 year ago

Hi there, I have a client with the same issu. If needed, he is ok to give an access to his website to someone at Automattic if it can help to solve this issu. Let me know.

csmcneill commented 1 year ago

I have a client with the same issu. If needed, he is ok to give an access to his website to someone at Automattic if it can help to solve this issu.

It is unlikely that this issue can be resolved by accessing the site. I would recommend subscribing to this issue so that you can stay up-to-date with any progress made.

csmcneill commented 1 year ago

6091810-zen shared:

My customer want to pay with SEPA. Usually, they do not have to refill their data, it is already stored.

Of course I could ask them to switch to creditcard. But to be honest, my customer mostly do not have this and it is a very delicate issue for them. That´s why they´ve chosen SEPA.

And the subscriptions work with credit card as I can see at the other accounts. Right now 16 accounts are affected by this SEPA-problem.

jtobiesen commented 1 year ago

Another example here: 6179674-zen

marissaexplores commented 1 year ago

6196861-zen

Mailyss2 commented 1 year ago

I have the same problem, when the request for the renewal payment is being made, it seems that the only payment_method_types included in the request must be Card

The PaymentMethod provided (sepa_debit) is not allowed for this PaymentIntent. Please attach a PaymentMethod of one of the following types: card

However, the SEPA method is the main payment method used since the launch of our e-commerce site. Our customers can enter their bank details without worries, but nothing during the renewal payment... The SEPA does not work. The bug would come from PaymentIntent.

Do you know if there is any news on the progress of the treatment of the issue ?

namiokuzono commented 1 year ago

Reported via 6210245-zen — I've also tested this flow on my staging site, and I am able to reproduce this.

Steps are as follows:

Here is the Log https://shrtm.nu/b1Z

kalessil commented 1 year ago

To keep things linked, supporting saved payment methods by SEPA was introduced in https://github.com/Automattic/woocommerce-payments/issues/1471, but as more foundational work is required for SEPA we'll make SEPA unavailable for subscriptions as per pchH0V-18S-p2#comment-1311

grig-23 commented 1 year ago

6225648-zen

igorhereira commented 1 year ago

6226311-zen

solstudioim commented 1 year ago

Another merchant experiences that same problem: 6242925-zd-woothemes

Was able to replicate too using Nami's steps

csmcneill commented 1 year ago

Likely 6268978-zen

kgeorgee commented 1 year ago

6263861-zen

kaushikasomaiya commented 1 year ago

6282520-zen

kalessil commented 1 year ago

https://github.com/Automattic/woocommerce-payments/pull/6965

frosso commented 1 year ago

SEPA support for subscription payments will come to a later date, the solution will be revisited once SEPA becomes widely available.

It can take up to 14 business days to receive notification on the success or failure of a payment with SEPA. Woo Subscriptions' renewal process is designed with the assumption that payment notification is near immediate (or at least within 24 hours).

Additional context: paJDYF-9Ud-p2#comment-20540

frosso commented 8 months ago

@FangedParakeet I can confirm that SEPA is disabled for subscription products ( also code ref: https://github.com/Automattic/woocommerce-payments/blob/37ef8921f11337be59fac8f5c24ceed6b99f82dd/includes/payment-methods/class-sepa-payment-method.php#L30-L30 ) Screenshot 2024-02-06 at 4 14 46 PM

Manual renewal with card payments works as expected.

Changing the is_reusable flag to false does make SEPA appear at checkout when a subscription product is present. Screenshot 2024-02-06 at 4 37 22 PM However, besides toggling the flag's value, it seems that additional work is needed to ensure that SEPA subscriptions are currently processed. Subscriptions will remain "on hold", despite the related Stripe charge succeeding. WooPayments Server & WooPayments client logs didn't reveal anything useful.

Since it seems that the original issue isn't reproducible anymore, I think we can close the ticket and open a different one once we decide to move forward with SEPA support for subscription products.