Configuration

A payment gateway module can have user configurable settings that are set via the WHASOLS admin interface.

These are defined in the yourmodulename_config function of the module which is a required function for all gateway modules.

This function should define both the display name for the module and any settings that the gateway module requires.

Defining configuration fields

The supported configuration field types include the following:

  • Text
  • Password
  • Yes/No Checkboxes
  • Dropdown Menus
  • Radio Buttons
  • Text Areas
Below is an example config function that demonstrates each type of field and the parameters available for them.
<?php
function yourmodulename_config()
{
    return [
        // the friendly display name for a payment gateway should be
        // defined here for backwards compatibility
        "Name"=>[
            "Type"=>"System",
            "Value"=>"Module Name here",
        ],
        // a text field type allows for single line text input
        "Title"=>[
            "Name"=>"Display Name",
            "Type"=>"text",
            "Size"=>"50",
            "Default"=>"Default Text Here",
            "Description"=>",
        ],
        // a text field type allows for single line text input
        "web_id"=>[
            "Name"=>"Web ID",
            "Type"=>"text",
            "Size"=>"4",
            "Default"=>",
            "Description"=>"Enter your Web ID here",
        ],
        "LIVE"=>[
            "Name"=>"Test Mode",
            "Type"=>"yesno",
            "Default"=>"no",
            "Description"=>"Tick to enable test mode (Optional)",
        ],
        // the dropdown field type renders a select menu of options
        "dropdownField"=>[
            "Name"=>"Dropdown Field",
            "Type"=>"dropdown",
            "Options"=>[
                "option1"=>"Display Value 1",
                "option2"=>"Second Option",
                "option3"=>"Another Option",
            ],
            "Description"=>"Choose one",
        ],
        // the radio field type displays a series of radio button options
        "radioField"=>[
            "Name"=>"Radio Field",
            "Type"=>"radio",
            "Options"=>["First Option"=>"First Option","Second Option"=>"Second Option","Third Option"=>"Third Option"],
            "Description"=>"Choose your option!",
        ],
        // the textarea field type allows for multi-line text input
        "textareaField"=>[
            "Name"=>"Textarea Field",
            "Type"=>"textarea",
            "Rows"=>"3",
            "Cols"=>"60",
            "Description"=>"Freeform multi-line text input field",
        ],
    ];
}

Each field includes:

Name - a human readable friendly display name for the field

Type - The type of field. The available field types are “text”, “password”, “yesno” (checkbox), “dropdown”, “radio” and “textarea”

Any settings specific to that field type such as Size, Rows, Cols, Default Value and Description

Any fields defined here will be available along with their configured values in all gateway module functions in the $params array.


Avoid common names like currency, invoiceid, etc, as these may conflict with the standard variables.

Build Your Gateway

Now it’s time to integrate your payment gateway provider.

For a Third Party Gateway, click here. For a Merchant Gateway, click here.