Order generation from through payment gateway works as mentioned below:
-> We send a request from our end to the payment gateway to process the order
-> Once the payment is made payment gateway sends an automated response regarding successful payment.
-> Once the response from payment gateway is received the order is automatically generated.
However, in some cases, we do not receive the response from payment gateway only in those cases the orders are not generated, but the complete order details are captured in the abandoned checkout, you can generate the order by converting abandoned checkout to order.