I'm using one of the payment gateways. It's called Urway/one97.
When the customer makes a payment with the payment gateway not register as paid + the order status changes to Complete.
I sent the problem to the Support Team but I got no solution.
How can I solve the issue? Why is that happening?
You can use events to change order status again after the order is created
You can try the event: checkout_submit_all_after
For example, in events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="checkout_submit_all_after"> <observer name="yourcompany_yourmodule_checkout_submit_all_after" instance="YourCompany\YourModule\Observer\ProcessOrder" /> </event> </config>
And in the observer
public function execute(\Magento\Framework\Event\Observer $observer) { $order = $observer->getOrder(); $quote = $observer->getQuote(); // Do whatever you want here return $this; }