Payment Gateway Modules

Top  Previous  Next

For each supported currency there is a set of payment gateway modules, which contain settings for each gateway. The gateway modules are pre-configured and under most circumstances do not require modification.

 

Important! Payment gateways do not follow a standard format or system. Complexity of integration varies widely among payment services. Depending on the payment gateway, integration may only require settings in a gw file or it may require installation of additional software. For some gateways modification of the AShop code may be required. Also, some payment services may not support all of the required data exchange for the shopping cart to function fully and some payment service may be problematic. Modify the payment gateway modules and create new ones at your own risk! We do NOT provide technical support for custom made payment modules.

 

Gateway Directory Names and Currencies

In the admin directory, there is a directory for each currency.

 

clip10123

 

gateways - U.S. Dollar
gatewaysaud - Australian Dollar
gatewayscad - Canadian Dollar
gatewayseur - Euro
gatewaysgbp - Great Britain Pound
gatewaysmxn - Mexican Peso
gatewaysnok - Norweigan Krone
gatewaysnzd - New Zealand Dollar
gatewayssek - Swedish Krona
gatewayssgd - Singapore Dollar
gatewaystec - Traffic Exchange Credits

 

For each currency there is a set of payment gateway (.gw) files. Each payment gateway file is named with an abbreviation for the payment service that it is configured to work with.

 

clip10124

 

Payment Gateway Module Variables

 

$gatewayname = the name of the payment processor as it will appear in the AShop administration panel

 

$paymenturl = the URL to which AShop should post order information.

For gateways that require the merchant to collect credit card information on the merchant's site the function process_payment is used instead and this URL should be set to the orderform.php script that is included with AShop.

 

$postbackurl = the URL to the AShop order.php script which will receive the postback of order information from the payment gateway and then process the order.

 

$visibleorderprocessing = should be set to TRUE or FALSE.

If it is set to TRUE then the order.php script will process the order directly in the customer's web browser and then show the thank you text if the order was processed successfully. If it is set to FALSE then the order.php script will be called through server to server communication with the gateway to process the order and the thank you text will be shown to the customer regardless of the result of the order processing.

 

$resultpagessl = should be set to TRUE or FALSE.

If it is set to true then the order.php script will produce an SSL adapted version of the thank you page. This is used by some gateways that fetch the thank you page from their own URL instead of redirecting the customer back to the merchant's site.

 

$sendpayoptionid = should be set to TRUE or FALSE.

Payment gateways that require the merchant to collect credit card information on the merchant's site should set this to TRUE. All other gateways should set this to FALSE.

 

$noquerystring = should be set to TRUE or FALSE.

This was added to fix a problem with some payment gateways that check the referring URL and need an exact match, with the exact same query string. Setting this to TRUE will simply remove the query string from the AShop script that sends the order information to the payment gateway.

 

$gw_orderid ... $gw_shipcountry  = the field names of all the order information.

Change these to the field names required by the the payment gateway. For example: if the gateway requires a variable named totalamount which should contain the amount to be paid then the $gw_amount variable should be set to: "totalamount". Fields not needed by a specific gateway can be set to "".

 

$gw_extrafields = if any extra gateway specific fields are needed this variable should contain them as html input tags of the type hidden. For example: a payment gateway requires a field named x_Method with the value "ECHECK", the $gw_extrafields can then be set to: <input type=\"hidden\" name=\"x_Method\" value=\"ECHECK\">

 

$testrequest = set this to a hidden html input tag with the name and value of a variable to request test mode if the gateway supports this. Checking the text mode checkbox for the payment option in the AShop admin panel will then result in this input tag being included in the payment request.

 

$gw_parameters['settingname'] = these should be set to true or false and will activate or deactivate the corresponding setting in the AShop admin panel for a payment option using this gateway. For example: setting $gw_parameters['testmode'] to "true" will make the test mode checkbox appear for this gateway when used in a payment option in the admin panel.

 

Payment Gateway Module Functions:

 

authenticate($gateway_input, $securityhash, $merchant) - checks that the payment has been authenticated by the payment gateway.

 

The $gateway_input array contains all the order information fields sent back to the AShop order.php script, for example: $gateway_input['orderid'] will contain the value of the field orderid if such a field is posted back to AShop.

 

The $securityhash variable contains any security hash string or password used by some gateways to make sure the order information has not been manipulated in any way.

 

The $merchant variable contains the merchant's username or merchant ID with the payment gateway and can be checked against any returned field that should contain the same value to add more security.

The function should set $validate[0] to "VERIFIED" if the authentication is successful or "INVALID" if not. The variable $validate[1] can also be set to any message containing the reason why the authentication failed if such a message is returned by the gateway.

 

process_payment($user, $password, $vspartner, $cardtype, $ccnumber, $seccode, $expdate, $amount, $invoice, $firstname, $lastname, $address, $city, $zip, $state, $country, $phone, $email, $testmode, $description) - used to process the payment by gateways that require that the merchant collects credit card information on the merchant's site.

 

The $user and $password variables are used to authenticate the merchant on the payment gateway's server. The remaining variables contain the corresponding payment and order information to be used by the function for processing, for example by using Curl to post the information to the gateway.

 

If the payment is successfully processed the variable $result["RESULT"] should be set to "success".

 

The variable $result["REMOTEORDERID"] should also be set to the transaction ID of the payment as returned by the payment gateway and $result["RESPONSEMSG"] can be set to any response message from the gateway.

 

If the payment has failed then the variable $result["ERROR"] should be set to the error returned by the gateway.

 

parse_response($gateway_input) - maps the fields returned by the payment gateway to the corresponding variables used by AShop.