How do you create a web application using a payment gateway?

There is a large and diverse variety of payment gateways -- most of which should have a well-documented (and heavily customized) API. Find more information about your payment gateway to fully answer this question, as the existing amount of payment gateways makes it too broad to generalize.