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

Pending payment != pending payment status #70

Closed
remcotolsma opened this issue Jul 4, 2024 · 3 comments · Fixed by #72
Closed

Pending payment != pending payment status #70

remcotolsma opened this issue Jul 4, 2024 · 3 comments · Fixed by #72
Assignees

Comments

@remcotolsma
Copy link
Member

remcotolsma commented Jul 4, 2024

For a customer an automatic WooCommerce Subscriptions renewal order #5326 was created on Sunday, June 23, 2024, with the associated Mollie direct debit payment. This renewal order #5326 automatically received the status 'Pending payment', because the direct debit payment had not yet been received. However, on Monday June 24, 2024, the customer logged in to his account page and saw order #5326 with the status 'Pending payment' and a 'Pay' button. The customer was of course not aware that a direct debit was already in progress and used the 'Pay' button to pay for order #5326 via iDEAL. On Tuesday, June 25, 2024, the direct debit payment was also received and payment was made twice for order #5326. Therefore, we think that 'pending payment' is not the correct status when a payment is in progress, 'on hold' seems to be a better choice. This is also better with other payment methods such as iDEAL, because in theory status feedback can take a few hours. During that time, you don't actually want the customer to initiate payment again for this order.

/**
* For new WooCommerce orders, the order status is 'pending' by
* default. It is possible that a first payment attempt fails and the
* order status is set to 'failed'. If a new payment attempt is made,
* we will reset the order status to pending payment.
*
* @link https://github.com/woocommerce/woocommerce/blob/7897a61a1040ca6ed3310cb537ce22211058256c/plugins/woocommerce/includes/abstracts/abstract-wc-order.php#L402-L403
* @link https://github.com/pronamic/wp-pronamic-pay-woocommerce/issues/48
*/
if ( PaymentStatus::OPEN === $payment->get_status() && $order->needs_payment() && 'pending' !== $order->get_status() ) {
$new_status = WooCommerce::ORDER_STATUS_PENDING;
}

CC @rvdsteege

@rvdsteege
Copy link
Member

The same issues occurred in internal Help Scout ticket https://secure.helpscout.net/conversation/2658470443/27516.

@remcotolsma
Copy link
Member Author

remcotolsma commented Sep 26, 2024

In #71 i changed:

- if ( PaymentStatus::OPEN === $payment->get_status() && $order->needs_payment() && 'pending' !== $order->get_status() ) {
-	$new_status = WooCommerce::ORDER_STATUS_PENDING;
- }

to:

+ if ( PaymentStatus::OPEN === $payment->get_status() ) {
+ 	$new_status = WooCommerce::ORDER_STATUS_ON_HOLD;
+ }

As @rvdsteege mentioned, this is not ideal either:

An order can no longer be paid for when going back from a payment page to checkout (e.g. using the browser back button). There is no way to pay for the order then. Is there anything we can do about that?

Originally posted by @rvdsteege in #71 (comment)

@remcotolsma
Copy link
Member Author

Should we focus on the direct debit payment method for now?

if ( PaymentStatus::OPEN === $payment->get_status() && PaymentMethods::DIRECT_DEBIT === $payment->get_payment_method() ) {
	$new_status = WooCommerce::ORDER_STATUS_ON_HOLD;
}

With a direct debit method, can we assume that it can take a few days and that no other payments should be initiated for the order in the meantime?

Or should we make the desired order status for an open payment adjustable in the WooCommerce gateway?

What do you think @rvdsteege?

@remcotolsma remcotolsma moved this from Todo to In Progress in Pronamic Pay Sep 26, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pronamic Pay Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment