General Instructions
To use the Direct Interface, you must invoke an SSL socket on port 443. Then send a standard POST or GET request to that socket with the arguments described below.
NOTE: Before using the Direct Interface, please ensure you have registered
your server IP address and the vendor_password via the Members Login. Please select Account Settings->Shopping Carts from the left side menu once you login.
Arguments are passed as standard URL encoded query fields and are case sensitive:
- vendor_name (your account name)
- vendor_password (A password distinct from your admin and tech login passwords that can be set via the Account Settings page of the Members section. See NOTE above.)
- card_number (13-16 digit card number)
- card_type (one of: AUTO (recommended), VISA, MASTERCARD, AMEX, BANKCARD, DCCB (Diners Club), JCB
- AUTO will automatically detect the card type based on the card number.
- card_expiry (mmyy)
- card_holder (text string)
- card_cvv (optional) more about CVV
- payment_amount (in cents, E.g. 100 = $1.00, or in dollars and cents 1.00 = $1.00. Note that 1.0 = $1.00 as well)
- payment_reference (your reference)
If the information supplied is correct, we will return a response with key=value pairs (one per line):
Content-type: text/plain
payment_number=(six digit number)
payment_reference=(your reference back at you)
bank_reference=(up to six digit number)
summary_code=0, 1, 2 (0 for success, 1 or 2 for declined)
response_code=(00 - 99) AS 2805.2 code
response_text=(text string - AS2805.2 as above code)
If information supplied in in some way incorrect, we will reply with:
Content-type: text/plain
payment_reference=(your reference)
summary_code=3
The failure code you get will depend on what went wrong.
Testing
The URL for test payments is:
https://vault.safepay.com.au/cgi-bin/direct_test.pl
The cents part of the amount you pass to us will determine the response code for the test script.
For example, an amount of 100 ($1.00) with return a response of 00 which represents an approved transaction response. An amount of 151 will return a response of 51 which represents a declined transaction response.
Test transactions on this interface are not recorded in the transaction history.
Live Payments
For URL for live payments is:
https://vault.safepay.com.au/cgi-bin/direct_process.pl
Note that this URL will only operate successfully following account activation.
Transactions may fail if an incorrect IP address or vendor_password is recorded in your account settings. Please see the NOTE at the top of this page.
Direct Processing Codes
When you pass a transaction to the direct system, you receive two codes. The main code is one of a hundred codes used by all banks. The second code is a summary code which breaks down the 100 codes in to four more usable codes.
To view the codes click here.
PHP Code Example
Here is a link to another PHP example.
Please note that this example uses the CURL libraries to enable the opening of an SSL port. Please feel free to edit and update this code as applicable.
<?
// these variables will be filled out by your program
$vars = array();
$vars[vendor_name] = "your_vendor_name";
$vars[vendor_password] = "directpass";
$vars[card_number] = "4444333322221111";
$vars[card_expiry] = "0808";
$vars[card_holder] = "John H Smith";
$vars[card_cvv] = "123";
$vars[payment_amount] = "1.11";
$vars[payment_reference] = "any_reference_you_need";
// call to directone interface function
$return_string = call_directone($vars);
// just print out what we got
print_r($return_string);
function call_directone($vars) {
// First you would normally do some checking to
// make sure the card number isn't invalid.
// Set up initial variables
$directone_url = "https://vault.safepay.com.au/cgi-bin/direct_test.pl";
foreach ($vars as $key => $value) {
$values[] = $key."=".$value;
}
// Prepare data for posting
$data = implode("&", $values);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $directone_url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$curlData = curl_exec ($ch);
curl_close ($ch);
return($curlData);
}
?>