Copy a Gateway Module

The Bank Transfer and Mail In Payment modules are open-source, allowing you to duplicate them if you want to offer multiple options.

For more information about custom payment gateway development, see Custom Gateway Modules.

Duplicate a module

To duplicate a module:

  1. Create a copy of the desired module (for example, /modules/gateways/banktransfer.php).

    The new filename must be all lowercase, alphanumeric characters only, and contain no spaces.

  2. Open the new file in a text editor and change the following three lines to the name of your new module:

    1
    2
    3
    
    function banktransfer_config() {
    "Value" => "Bank Transfer"
    function banktransfer_link($params) {

    For example:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    
    <?php
    
    # Bank Transfer Payment Gateway Module
    
    function banktransfercopy_config() {
    $configarray = array(
        "FriendlyName" => array(
            "Type" => "System",
            "Value" => "Bank Transfer Copy"
        ),
        "instructions" => array(
            "FriendlyName" => "Bank Transfer Instructions",
            "Type" => "textarea",
            "Rows" => "5",
            "Value" => "Bank Name:\nPayee Name:\nSort Code:\nAccount Number:",
            "Description" => "The instructions you want to display to customers who choose this payment method"
        ),
    );
    
    return $configarray;
    }
    
    function banktransfercopy_link($params) {
    global $_LANG;
    
    $code = '<p>' . nl2br($params['instructions']) . '<br />' . $_LANG['invoicerefnum'] . ': ' . $params['invoiceid'] . '</p>';
    
    return $code;
    }
    
    ?>
    
    The above code would create a new Bank Transfer Copy payment gateway module.

  3. Save the file with a filename that matches the function name (for example, banktransfercopy.php).

  4. Upload the file to your /modules/gateways/ directory.

Last modified: November 12, 2024