to finish implementing a custom payment method I need to know how to convert the quote to the actual order.
From payment gateway, my custom controller is called. Inside that controller, I can access Checkout Session object. When I call getQuoteId on that object, I get the actual quote id, however, when I call getLastRealOrderId, nothing is returned, so I think I need to do a previous step first.
How can I do it?
*) For a registered customer: How to create an order programmatically with \Magento\Quote\Api\CartManagementInterface :: placeOrder()?: https://mage2.pro/t/732
*) For a guest customer: How to create an order programmatically with \Magento\Quote\Api\GuestCartManagementInterface :: placeOrder()? https://mage2.pro/t/733
Both the methods use internally the \Magento\Quote\Model\QuoteManagement::submit() method: https://mage2.pro/t/731
Thanks but all sites give no explanation, they only show code so the questions are: how to create the order programmatically and only when success payment, the confirmation e-mail to customer to be sent automatically?