PHP code example of hashbang / securepay
1. Go to this page and download the library: Download hashbang/securepay library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hashbang / securepay example snippets
$sp = new SecurePay('username','password');
$sp->TestMode(); // Remove this line to actually preform a transaction
$sp->TestConnection();
print_r($sp->ResponseXml);
$sp->NameOnCard = 'John Citizen'; // optional
$sp->Cc = 462834666666;
$sp->ExpiryDate = '07/09';
$sp->ChargeAmount = 123;
$sp->ChargeCurrency = 'USD';
$sp->Cvv = 321;
$sp->OrderId = 'ORD34234';
if ($sp->Valid()) { // Is the above data valid?
$response = $sp->Process();
if ($response == SECUREPAY_STATUS_APPROVED) {
echo "Transaction was a success\n";
} else {
echo "Transaction failed with the error code: $response\n";
echo "XML Dump: " . print_r($sp->ResponseXml,1) . "\n";
}
} else {
die("Your data is invalid\n");
}