The file sr.php or send and receive is used to handle setting up the form and handling the post back.
This file includes two php functions and they are:
andThese functions include the name of your gateway then the function name. The first portion comes from the $data['gateway']['name'] variable set in the config file.
So if you named your gateway ?kingarthur? then your functions would be:
andThese method is used by the core files to tell the difference from each gateway.
Now that the function names are out of the way we will move on to the $params array that is passed to the functions.
Create Form
The createform function has these available $params.
If you wish to see all of the available params you can add the following php inside the function:
print_r($params); die;
Then a list of variables will be printed when you place a test ad.
Process Transaction
The processTransaction function has these available $params.
Plus any others from your Payment Gateway. You will need to refer to their documentation on what they are.
Since the check / money order gateway doesn't include the post back information you will probably need, we will use the processTransaction function from the Paymate gateway:
Starting from the top we include global $db, $Orders, $userid. I will not go into details what the global does but you can find out from php.net.
Next we have $orderid = (int)@$params['ref'];If it returns true then the order was successfully updated if not it returns an error and something happened inside the Orders class to make the order not be updated.
As you can see creating a custom gateway is not a simple process and as such is not supported by us. A lot of things can go wrong and it will take some trial and error getting it setup properly.
Still have a question? Post it on the Help Forums.