Step-by-step tutorial on building a custom payment gateway for WHMCS. Integrate any payment processor with your billing system.
Building a Custom Payment Gateway
Payment gateways are essential for any WHMCS installation. Learn how to create one from scratch.
Prerequisites
Module Structure
Create your gateway in /modules/gateways/:
['Type' => 'System', 'Value' => 'Your Gateway'],
'apiKey' => ['FriendlyName' => 'API Key', 'Type' => 'text', 'Size' => '50'],
'secretKey' => ['FriendlyName' => 'Secret Key', 'Type' => 'password', 'Size' => '50'],
'testMode' => ['FriendlyName' => 'Test Mode', 'Type' => 'yesno']
];
}
Handling Payments
Implement the _link function for redirect-based payments or _capture for direct capture.
Webhook Handling
Create a callback file to handle payment notifications from the processor.