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 = 'http://payeasy2-uat.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>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 ($digest == $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>
|
Sending Additional Billing Parameters
To save your customers the trouble of re-encoding their contact details, you can pre-populate the billing information section of PayEasy. Most merchants have the contact details already of their customers in their database. By using this function, merchants can simplify the checkout process. There are two ways to do this -- via http get/post and via web service.
To use http get/post, you can call the url:
http://payeasy2-uat.mozcom.com/v2/SendBillingInfo.aspx
For example, you can invoke the ff. URL via HTTP GET:
http://payeasy2-uat.mozcom.com/v2/SendBillingInfo.aspx?txnId=123&merchantId=TEST&firstName=John&
lastName=Cruz&address1=1%20ABC%20Street&city=Pasig&state=&country=PH&zipCode=&
telNo=6711111&email=john@company.com
(NOTE: make sure to supply all fields even if they are empty)
You should call this function prior to doing the redirect to PayEasy's Pay.aspx. That way, by the time you redirect to us, we already have all the necessary contact info and there would be no more need to prompt for them. The txnid and merchantid fields should match the values of the actual redirected transaction.
To use the SOAP/Web Service version, you may get the WSDL from the ff. entry point:
http://payeasy2-uat.mozcom.com/PayEasyWebService/PayEasyService.asmx
NOTE: The country parameter should be the 2-char ISO code. For example, "Philippines" is "PH". You may refer to this site for a complete listing. The above URL's are for testing only. Please contact us for the production url.
