Questions? Answers.

Have a question? Post it and let the masses answer.
1
Answers
Vote up!
4
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!
7
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()
Answer by: Ryan
Posted: Jun 1, 2012

Comments

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 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
drupalcommerce Check out the #Drupal Commerce 2.x Roadmap to see where you can get involved: http://t.co/WAc3jmXY2a
drupalcommerce A new blog discussing the new showcase listing http://t.co/FHOzhAg3tl http://t.co/J5C87imjhb
drupalcommerce RT @drupalcon: Thanks @CommerceGuys and @CommerceJohn for your support, and for #CommerceKickstart! Take the tour http://t.co/ivKEYH7k0o
drupalcommerce Updating our extensions directory: 665 new or updated modules, distributions, sandboxes, & themes. http://t.co/6NMMofYo12 #weloveyouguys