Difference between revisions of "Dev:Gateway:Config"
(Created page with '<div class="docs-alert-warning"> <span class="title">Required Function</span><br /> The config function is a required function for every gateway module where you must define the …') |
m (moved Dev:Gateway:Config Function to Dev:Gateway:Config) |
(No difference)
|
Revision as of 12:10, 10 May 2014
Required Function
The config function is a required function for every gateway module where you must define the display name of your module, and any settings a user must configure for it.
There are 2 required system attributes - a Friendly Name - this is the name that is displayed to users of your module within the WHMCS interface, and the Usage Notes which allow you to provide additional instructions to users of your module.
Following those you can define an unlimited number of settings your module requires. These take the format below:
"settingname" => array(
"FriendlyName" => "Display Name",
"Type" => "xxxx",
// Additional attributes here
),
We'll look at all the possible setting field types and their supported attributes below. But first, let's take a look at an example of a typical configuration function for a gateway module.
function demogateway_config() {
return array(
"FriendlyName" => array(
"Type" => "System",
"Value" => "My Custom Gateway Module",
),
"accountnumber" => array(
"FriendlyName" => "Account Number",
"Type" => "text",
"Size" => "10",
"Description" => "<a href=\"#\">Click here to Signup</a>"
),
"apiusername" => array(
"FriendlyName" => "API Username",
"Type" => "text",
"Size" => "20",
),
"apipassword" => array(
"FriendlyName" => "API Password",
"Type" => "password",
"Size" => "20",
),
"testmode" => array(
"FriendlyName" => "Test Mode",
"Type" => "yesno",
"Default" => false,
"Description" => "Tick to enable",
),
);
}
The settings you define here will be passed into all the functions of your gateway module any time it is called. Please Note: we recommend avoiding generic names like "invoiceid" and "currency" which may conflict with other data WHMCS is passing to your gateway's functions.