Technical Integration

HTTP GET parameters:

amount the amount being requested
txnid unique identifier for every transaction
description a short description of the transaction
merchantid unique merchant identifier
ccy currency code (PHP or USD)
digest sha1 digest of the string "amount:txnid:merchantid:password:ccy"

Returned parameters:

txnid unique number for every transaction
result "success", "failure" or "pending"
reason detailed description of result (can be error code, successful transaction reference id, etc.)
digest sha1 digest of the string "txnid:result:merchantid:password"

Parameters will be returned to merchant's registered postback URL.  Note that in the case of PENDING transactions, PayEasy will asynchronously send a SUCCESS or FAILURE result later in the future once the PENDING payment has been completed. Merchants should handle these cases appropriately.

Sample php checkout program:

<?php
if ($submit) {
	if (!is_numeric($amount)) {
		$error .= "Error: Invalid amount.<br>";
	}
	if (!is_string($description) || $description == '' ) {
		$error .= "Error: Invalid description.<br>";
	}
	if ($error == '') {
		$txnid = 'PE' . time();
		$merchant = 'STOREDEMO';
		$passwd = 'mozzy';
		$digest_str = "$amount:$txnid:$merchant:$passwd:$ccy";
		$digest = sha1($digest_str);
		$params = "merchantid=" . urlencode($merchant) .
			"&txnid=" .  urlencode($txnid) . 
			"&amount=" . urlencode($amount) .
			"&description=" . urlencode($description) .
			"&ccy=" . urlencode($ccy) .
			"&digest=" . urlencode($digest);
		}
		$url = 'https://payeasy2.mozcom.com/v2/Pay.aspx';

		############################################
		# put subroutine here to store transaction
		# in file or database
		############################################

		header("Location: $url?$params");
	}
}
?>
<?php echo $error; ?>
<form method="post">
<table>
<tr>
<td>Amount:</td>
<td><input type="text" name="amount"
	value="<?php echo $amount; ?>"></td></tr>
<tr>
<td>Description:</td>
<td><input type="text" name="description"
	value="<?php echo $description; ?>"></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email"
	value="<?php echo $email; ?>"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"
	></td>
</tr>
<tr>
<td>Currency:</td>
<td><input type="text" name="ccy" value="<?php echo $ccy; ?>"></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Pay Now"></td>
</tr>
</table>
</form>

	

Test paydemo.php script

sample return program:

<?php
$merchantid = 'STOREDEMO';
$error = '';

if ($result == 'success') {
	$rdigest_str = "$txnid:$result:$merchantid:$passwd";
	$chk_rdigest = sha1($rdigest_str);
	if ($digest2 == $chk_rdigest) {

		##################################################	
		# insert subroutine to update transaction status
		##################################################

	} else {
		echo "Error: Incorrect digest.<br>";
	}
} else {

	##################################################
	# insert subroutine to update transaction status
	##################################################

}
?>
<table><tr><td>
Txn Id:
</td><td>
<?php echo $txnid; ?>
</td></tr>
<tr><td>
Result:
</td><td>
<?php echo $result; ?>
</td></tr>
<tr><td>
Reason:
</td><td>
<?php echo $reason; ?>
</td></tr>
<tr><td>
Digest:
</td><td>
<?php echo $digest; ?>
</td></tr>
</table>