The exact process depends on the payment gateway. You should follow their documentation for the checkout process they support.
The one you suggest could be right, but without knowledge of the payment gateway I can't be sure.
Usually the payment gateway will pass back information to the confirm page that can be used to identify the order.