The application proceeds normally until it is ready to receive payment. If the application is a shopping cart, you would have assembled the list of goods and calculated the total amount due. If the application is a hotel booking system, it would have captured the user's booking dates and details and presented the user with a final price to be paid. The application is now ready to receive payment.
The application now calls the Payage get_buttons() function. Payage determines which payment gateway accounts match the requirement and returns the buttons as an HTML structure according to the selected layout. The application should check the status of the call and if all is well, output the returned HTML.
When the user clicks on one of the payment buttons, he is taken to the payment gateway as usual, and pays as usual. The end user is completely unaware that another component is involved.
When the user completes payment, the gateway redirects the browser back to your site, where control is initially passed to Payage, although Payage always remains invisible to the end user. Payage performs any necessary processes with the payment gateway, for example PayPal's Payment Data Transfer process. On completion of the process, Payage records full details of the transaction and the final payment status, and then redirects the browser back to the original calling application.
The application then calls the Payage get_payment_data() function to retrieve the details and status of the transaction, and proceeds as appropriate.
Payage has relieved the application of the burden of configuring and dealing directly with the payment gateway. The application can now work with any payment gateway that works with Payage without any further development, testing, support, or documentation.