Hi,
1. The order is created before the redirection to the payment gateway. And thus the order number is created at the same time and the payment plugin should normally pass that information to the payment gateway.
2. in the onAfterOrderConfirm function of your payment plugin, which display the redirection form to your payment gateway, you'll find the order number in the variable $order->order_number
3. It's normally already generated. Now I don't know what payment plugin you use and how it's done in it so hard to say more.
PS: note that if you're talking about the "invoice number" and not the "order number", that number is generated when the order is confirmed (ie. after the payment of the order) so of course it can't be passed on to the payment gateway. But you can always change the "order invoice status" setting of the HikaShop configuration to get it generated when the order is created but normally, you should only generate an invoice number after an order is paid.