0

I'm a Magento beginner. I'm trying to create a custom offline payment gateway, that will function like a check/money order type gateway. I've got something rough up and working by following this tutorial:

https://www.magestore.com/magento-2-tutorial/2361-2/

As I understand it, this gateway should be putting orders into 'pending_payment' status upon placement. Is see this line in Pendingpayment.php:

class Pendingpayment extends Status
{
/**
* @var string[]
*/
protected $_stateStatuses = [Order::STATE_PENDING_PAYMENT];
}

But when orders are placed with this gateway, they are in the 'processing' status. If I pull the order using the API (mysite/rest/V1/orders/{id}), I see both a state and status of 'processing'.

How can I get this gateway to put orders in 'payment_pending' status until further action?

4
  • have you made it work? and are you sure this is a magento 2.3 version?
    – fmsthird
    Mar 26, 2019 at 3:38
  • No, not working. I left another comment below. It says 2.3 in the Admin panel. Mar 26, 2019 at 15:01
  • tried to follow the instructions from the link but it seems it is for magento 1
    – fmsthird
    Mar 28, 2019 at 7:20
  • Why do you say that? That page says 2.3. It also mostly works with my 2.3 installation, except for this order status issue. Mar 28, 2019 at 15:33

1 Answer 1

0

Try putting static pending status:

class Pendingpayment extends Status
{
/**
* @var string[]
*/
protected $_stateStatuses = 'pending';
}

And check if it changes the status

5
  • I made this change, and ran all my bin/magento commands, setup:upgrade, cache:clean etc.. placed a new order, and it still puts it into processing. Mar 25, 2019 at 22:04
  • it seems to me that the issue is not with the current code. have you tried choosing another payment method? does it give the same status?
    – fmsthird
    Mar 25, 2019 at 22:09
  • because basically, new order should have a state of new and status of pending.
    – fmsthird
    Mar 25, 2019 at 22:10
  • maybe you have a plugin or an observer from a custom or third-party extension that changes the state and status upon order checkout
    – fmsthird
    Mar 25, 2019 at 22:12
  • I had one other custom plugin I had built active, for a payment gateway. I disabled this and removed. I don't think I have any other 3rd party plugins. This is a brand new barebones Magento installation. I tried placing an order using the built-in Check/Money Order option, and that puts the order into 'pending' status. Mar 25, 2019 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.