this is the way that remote checkout systems function. With a remote checkout system, the checkout page sends data to the confirm page, and the confirm page sends the data directly to the gateway for the customer to place the order.
In a local payment system, the customer never leaves your site, the checkout page post to the confirm page, when the confirm page submits, it runs code to process the transaction, then if it is successfull stores it in the database and sends a confirmation email, if it fails, it directs to the failure page instead.