I am developing a module for a payment gateway.
- I created module skeleton using module creator provided here.
- I used redirection solution given in this.
- I wrote custom controller where it is getting redirect.
Now in my custom controller I need to create data to post on the payment gateway and then will post that data to the payment gateway url. Here I need order data which I and not getting in checkout session. I referred other extension they are using similar method but I am not getting any data.
protected function _getOrder() { if (!$this->_order) { $incrementId = $this->_getCheckout()->getLastRealOrderId(); var_dump($incrementId); $this->_orderFactory = $this->_objectManager->get('Magento\Sales\Model\OrderFactory'); $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId); } return $this->_order; } protected function _getCheckout() { return $this->_objectManager->get('Magento\Checkout\Model\Session'); }