User Guide

AShop V User Guide140
AShop Software © Copyright 2002 - 2010
$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.