<p>You probably need a small plugin listening for <code>commerce_orders.onOrderComplete</code> which checks the payment method and re-saves the order with the required status.</p>

CC BY-SA 3.0
2017-04-25T16:18:22.893Z
We're on it, but we're having a hard time finding the handle for the payment method and detailed documentation on the order model. Can you point me in the right direction to find this?
Farmer1
CC BY-SA 3.0
2017-04-19T11:16:37.837Z
2017-04-19T11:16:37.837Z
Clive Portman
<p>Listen for the <code>onBeforeOrderComplete</code> event and do something like this (replacing values to match your setup).</p>

<pre><code>craft()-&gt;on('commerce_orders.onBeforeOrderComplete', function($event){
    $order = $event-&gt;params['order'];
    if ($order-&gt;paymentMethodId == 2)
    {
        $order-&gt;orderStatusId = 3;
    }
});
</code></pre>

CC BY-SA 3.0
2017-06-29T10:23:12.007Z
2017-06-29T10:23:12.007Z
Jamie Pittock
<p>We're working on our first Craft Commerce site and are in need of your good advice. This might be related to a similar question (<a href="https://craftcms.stackexchange.com/questions/19876/craft-commerce-send-notification-emails-when-setting-status-dynamically">Craft Commerce: send notification emails when setting status dynamically?</a>) but I can't comment there.</p>

<p>We have a Craft Commerce setup with two payment gateways for credit card and bank transfer (Manual payment). We'd like to achieve the following scenario:
1) If the customer pays with Credit Card, the order status is "Approved". They receive an email with the invoice and confirmation.
2) If the customer pays via bank transfer, the order status is "Pending" and they receive a different email.</p>

<p>We can't find any clues on the docs on how to pass a specific status on checkout. Is there anything obvious we might be missing? I appreciate any input. Thanks!</p>

<plugin-craftcommerce>
Custom status based on chosen payment gateway
# Custom status based on chosen payment gateway

(Asked by: username_0 on 2017-04-18)

We're working on our first Craft Commerce site and are in need of your good advice. This might be related to a similar question ([Craft Commerce: send notification emails when setting status dynamically?](https://craftcms.stackexchange.com/questions/19876/craft-commerce-send-notification-emails-when-setting-status-dynamically)) but I can't comment there.

We have a Craft Commerce setup with two payment gateways for credit card and bank transfer (Manual payment). We'd like to achieve the following scenario:
1) If the customer pays with Credit Card, the order status is "Approved". They receive an email with the invoice and confirmation.
2) If the customer pays via bank transfer, the order status is "Pending" and they receive a different email.

We can't find any clues on the docs on how to pass a specific status on checkout. Is there anything obvious we might be missing? I appreciate any input. Thanks!

**Tags:** plugin-craftcommerce

---

## 2 answers

### Answer by username_2 on 2017-06-29. Score: 6 | Accepted answer

Listen for the onBeforeOrderComplete event and do something like this (replacing values to match your setup).
craft()->on('commerce_orders.onBeforeOrderComplete', function($event){
    $order = $event->params['order'];
    if ($order->paymentMethodId == 2)
    {
        $order->orderStatusId = 3;
    }
});


---

### Answer by username_1 on 2017-04-19. Score: 2

You probably need a small plugin listening for `commerce_orders.onOrderComplete` which checks the payment method and re-saves the order with the required status.

> **Comments:**
> **username_0**: We're on it, but we're having a hard time finding the handle for the payment method and detailed documentation on the order model. Can you point me in the right direction to find this?  

---

