Vote up!
Vote down!

Why is my order status still Pending after checkout and payment complete?

Even after completing checkout and getting payment notification from my payment gateway, my order remains in the Pending status. Is there something I need to do to change this or should it be updating on its own?

Asked by: mholloway
on June 1, 2012

1 Answer

Vote up!
Vote down!

Yep, we actually don't do any automatic order status updates on checkout completion or payment receipt. We don't really know what might need to be taken into consideration when updating order statuses or what statuses may even be available on a site, so we are purposefully agnostic in core.

The solution here is to use Rules to update the order status using one of two events: "When a customer completes checkout" or "When an order is first paid in full." The important distinction here is that depending on your payment method, it may be possible for a customer to complete checkout without payment. It may be off-line payment, a pending payment, or an asynchronous transaction that simply hasn't POSTed to your site yet.

For those reasons, if you're doing an order status update that triggers fulfillment or completion of an order, you should most likely be using the latter event to ensure the order has been paid in full before processing.

Note: if you prefer a code based solution instead, both of these events have corresponding hooks:

  • hook_commerce_checkout_complete()
  • hook_commerce_payment_order_paid_in_full()
Ryan Szrama
Answer by: Ryan Szrama
Posted: Jun 1, 2012


Thanks! On a standard site where a transaction is completed after the checkout process when the payment method returns a response, what would be the appropriate action to hook on to in rules?

- Pfriedo on June 28, 2012

You'd want to use the When an order is first paid in full event.

- Ryan Szrama on November 20, 2012

Silly question, but where do I put this rule? I can't seem to make it work.

- bwobbones on January 6, 2013

The order status / order state is confusing. In a recent order the "order status" (from store/orders) shows pending. I created a rule with the event "when an order is first paid in full" to change the order status to completed. I created a new order, use payment gateway in test and it didn't change. Then I tried changing order state to completed, again no change.

1. Am I doing something wrong?
2. Will this never change to completed since I'm in a test environment on localhost?

This is driving me batty. thank you, mark

- mark gundersen on August 13, 2014