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" |
| email * | PayEasy Login |
| passwd_sha1 * | sha1 digest of the string "email:password" |
* optional
URL will be provided upon acceptance
returned parameters:
| txnid | unique number for every transaction |
| result | either "success" or "failure" |
| reason | failure description |
| digest2 | sha1 digest of the string "txnid:result:merchantid:password" |
Parameters will be returned to merchant specified return URL
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);
if ($email != '' && $password != '') {
$params .= "&email=" . $email .
"&passwd_sha1=" . sha1("$email:$password");
}
$url = 'http://uat.payeasy.ph/login2.asp';
############################################
# 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>
|
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>
|
