Payment Modules: Creating your own. (Advanced)

RyanTechnical SupportLeave a Comment

This article is aimed at PHP programmers who want to create their own payment modules. The payment system is loosely designed around the Model-View-Controller (MVC) pattern from OO programming. The payment module system is controlled by payment/payment_manager.php (Payment Manager) The Payment Manager is responsible for loading the module files, listing the payment options, and configuration of the payment modules from the Admin. The configuration data is stored in the 'config' table in the database Each payment module has it's own payment object in a separate file. Each payment module is responsible for rendering it's own payment button, rendering configuration forms, loading / saving configuration data and handling the payment gateway integration. Anatomy of a payment module A payment module has two sections, the top part is the integration with the payment gateway, and the bottom part is an implementation of the payment object. Here is an example based around the Paypal module: <?php // Change to whatever is your payment class name $_PAYMENT_OBJECTS['PayPal'] = new PayPal; if ($_POST['txn_id']!='') { // insert your gateway handling code here (see paypalIPN.php for further hints) // This code should only execute when called by the gateway, in this case this script is called // … Read More