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

Failed payments: Status conflicts (order hang) with WooCommerce Subscriptions Retry System #269

Open
ibrahimonder opened this issue Dec 26, 2018 · 8 comments

Comments

@ibrahimonder
Copy link

ibrahimonder commented Dec 26, 2018

1. First issue (order hang):
Whenever a SEPA payment has failed, the "order" of a WooCommerce Subscription is not being set to failed after a failed SEPA payment. Is this true? Now, I need somehow to change the order status to failed manually to fire up the retry rule system. So basically, a subscription has multiple orders. The status of an order of the current SEPA also needs to be changed whenever a failed payment web hook is called, not only a subscription status.

2. Second issue (wrong statusses and restrict acces):
The solution for BUG in #143 is not thought well. This is causing problems and conflicts at the moment with WooCommerce Subscriptions.

First read: #143


What if a payment failed after the first attempt and the retry rule system of WooCommerce Subscriptions is firing off.

Whenever the first attempt of a SEPA has failed, WooCommerce Subscription will attempt this again by using their retry system, in total 5 times. Each retry rule can take up to 12 hours to fire off. Each SEPA charge can take up to a few days. So imagine waiting for a SEPA for 5 days to charge and it fails. Imagine that all the 5 retry rules attempts failed one by one? The member still has acces to the site for over a month while the payment is not even charged.

Mollie is setting the status of a subscription from on-hold to active, because it can take up to a few days to receive a payment charge. I get it, you simply don't want that the member to wait 5 days long for a payment. So, yes it seems like reasonable a good choice to set the status to from On-Hold to Active while waiting.

However, this is only a correct implementation if there is one charge for payment attempt with the 'happy' flow. But not the right one if there are more attempts with the retry system of WooCommerce Subscriptions because the first one has failed.

This is how it should be done..

The status Active should only be set after the first SEPA attempt so that the member will still have acces to the website. But after getting a failed payment, the subscription status should be changed back to On-Hold again. It also needs to stay on-hold with the second payment attempt. This is where it goes wrong. The first payment has failed so this means that the member can pay manually if it's urgent by logging in and pay through their account page or simply wait until the next payment retry rule will be fired up in 12 hours as mentioned in WooCommerce Docs until a successful payment is done to get acces again.

So basically:

  1. After a failed SEPA charge attempt, the status should be updated back to on ON-HOLD again.
  2. Whenever a new SEPA order is incoming with the same payment ID or a unique reference of that order, the status shouldn't be changed to Active anymore, it should stay On-Hold so that the member won't have acces until payment is done. This to stop the fraud.

Please check onto this as I'm facing this problem right now, and manually am setting the status to On-Hold of each "subscription" where payment has failed the first

@ibrahimonder ibrahimonder changed the title Status conflicts (order hang) with WooCommerce Subscriptions Retry System Failed payments: Status conflicts (order hang) with WooCommerce Subscriptions Retry System Dec 27, 2018
@davdebcom
Copy link
Contributor

Thank you for the report. I'll review this when I'm back to work.

@ibrahimonder
Copy link
Author

ibrahimonder commented Jan 6, 2019

What's the status of this big issue? Imagine that I need to change the status manually of all the orders that failed to charge every day. It's a lot of work. Let me know if I can help with anything @davdebcom .

@davdebcom
Copy link
Contributor

@ibsonic

  1. The retry system automatically changes the order status (not subscription) to "Pending payment" after a failed payment. You should see messages indicating this in the order notes, with content like "Retry rule applied: Order status changed from Failed to Pending payment". If you disable the retry system, you will see that renewal orders stay in the "Failed" status.

In the technical documentation for the Retry system I am not seeing any mention that the order has to have a failed status, just the payment. Can you point me to the mention if it is there?

  1. In my test server this is exactly what happens. Are you using 5.0.7?

@ibrahimonder
Copy link
Author

ibrahimonder commented Jan 9, 2019

@davdebcom

In my test server this is exactly what happens. Are you using 5.0.7?

Yes, I am using 5.0.7

In the technical documentation for the Retry system I am not seeing any mention that the order has to have a failed status, just the payment. Can you point me to the mention if it is there?

Well, I don't know about the technical documentation but I've had contact with the developers from Prospress (creators/devs of WooCommerce Subscription) and they mentioned:

"Woo Subscriptions is merely waiting for the order status to be changed to failed by the gateway plugin. The gateway plugin needs to properly change the order status to "failed" after a failed payment happens. Best Regards, Nick"

So this seems to be an issue for retrying recurring payments. It never came to the light as there is only one charge occurring when you don't enable retry recurring payments. Also, I've mailed them right away to help us out here.

Have you had time for the second issue also?

@ibrahimonder
Copy link
Author

ibrahimonder commented Jan 9, 2019

@davdebcom

Also, it seems that the first issue, as mentioned in the OP, only occurs the very first time. After setting the recurring order status to failed manually, the retry system works like it should. Also the second attempt and the third. After the first time, I don't need to do this manually anymore.

But the problem with the second issue, remains. I still need to manually change the subscription status to on hold after the first "failed" payment attempt. Mollie doesn't differentiate between a failed order or succeeded order. It sets the subscription status to "Active" as it waits to receive the payment. So this is also happening when a retry rule is kicking in. At this very moment, the subscription status shouldn't be changed to "Active" anymore but "On Hold", because the first payment attempt has failed.

schermafbeelding 2019-01-09 om 14 11 58

@ibrahimonder
Copy link
Author

@davdebcom

Hi,

We have a couple documents on the retry system. There is a user level doc here: https://docs.woocommerce.com/document/subscriptions/failed-payment-retry/
We also have a development level document here: https://docs.woocommerce.com/document/subscriptions/develop/failed-payment-retry/
You can see in the Retry Process Flow of the developer level document that what starts the process is:

"The 'woocommerce_subscription_renewal_payment_failed' action is triggered in WC_Subscription->payment_failed() after a renewal payment fails."

Let us know if you have any further questions

Thanks,
Sarah

@ibrahimonder
Copy link
Author

@davdebcom another bug/issue, when the retry system is doing it's job and trying to charge the customer for the fifth time, a new order is being fired in the meanwhile for the new month which is odd. The consumer hasn't been able to use anything because payment was waiting so subsciription is on hold. Now there are two orders trying to charge the consumer. I really suggest to write down different scenario's and add these to your plugin as I wrote down different scenario's already. I'm turning off retry rules now as I'm not able to manage everything manually.

@davdebcom
Copy link
Contributor

davdebcom commented Feb 4, 2019

We also have a development level document here: docs.woocommerce.com/document/subscriptions/develop/failed-payment-retry

Documentation doesn't seem to be up to date. Code seems to be different (class names).

Also, it seems that the first issue, as mentioned in the OP, only occurs the very first time. After setting the recurring order status to failed manually, the retry system works like it should. Also the second attempt and the third. After the first time, I don't need to do this manually anymore.

But the problem with the second issue, remains. I still need to manually change the subscription status to on hold after the first "failed" payment attempt.

In the current beta this isn't happening for me (it's already setting the renewal order to failed, subscription to On Hold). Could you email me on [email protected]? I'll share the beta with you.

Mollie doesn't differentiate between a failed order or succeeded order. It sets the subscription status to "Active" as it waits to receive the payment. So this is also happening when a retry rule is kicking in. At this very moment, the subscription status shouldn't be changed to "Active" anymore but "On Hold", because the first payment attempt has failed.

Yes, this issue (actually the third) I can adjust, and it's in the beta.

@davdebcom another bug/issue, when the retry system is doing it's job and trying to charge the customer for the fifth time, a new order is being fired in the meanwhile for the new month which is odd. The consumer hasn't been able to use anything because payment was waiting so subsciription is on hold. Now there are two orders trying to charge the consumer. I really suggest to write down different scenario's and add these to your plugin as I wrote down different scenario's already. I'm turning off retry rules now as I'm not able to manage everything manually.

The Mollie plugin does not initiate a new renewal order, WooCommerce Subscriptions does that, the Mollie plugin only then processed the payment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants