2

I have payment processing on the checkout page on click of place order. I get the payment response on the same page. Now, I need to update the order status after the checkout form submission in the custom payment module. Does anyone know how to do it? Thanks in advance.

OR

Can I process the checkout form submission in the Controller Controller\Index\Index.php

0

Create file: etc/events.xml

<event name="sales_order_place_after">
    <observer name="sales_order_place_after_event" instance="Vendor\Module\Observer\SalesOrderPlaceAfter" />
</event>

Create Vendor/Module/Observer/SalesOrderPlaceAfter.php

public function execute(Observer $observer)
{
    /** @var Order $order */
    $order = $observer->getData('order');
    $payment = $order->getPayment();
    $order->setState('new');
    $order->setStatus('pending');
}
  • Can I post the additional parameters to this method from the checkout page? such as payment status – Garry Nov 7 at 12:08
  • @Garry Yes. You can. But if need only payment info then you can get that from order. $payment = $order->getPayment(); – Sainadh Mannem Nov 7 at 13:59

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.