Module : iPay88 Payment Module for CubeCart V4
File name Purpose Module Version
index.php Access control 1.0.1
transfer.inc.php Form post module 1.0.1
confirmed.php Call-back module 1.0.1
admin\index.inc.php Admin – iPay88 account control module 1.0.1
admin\logo.gif Admin – iPay88 logo file N/A
Installation
Unzip ipay88-ccv4.zip to your computer
Upload all files to your cubecart path by any FTP program.
Login to your CubeCart admin page
Goto Store Config >Currencies
Add a new currency for MYR as following:
Goto Store Config > General settings
Set default currency to “Ringgit Malaysia”
Click “Update Settings”
5. Goto Modules > Payment methods
Click “Configure” for iPay88
6. Fill in the fields :
Status > Enable
Description > This will display as payment title on your Store home.
iPay88 Merchant Code > Your ipay88 Merchant Code
iPay88 Merchant Code > Your ipay88 Merchant Key
iPay88 Response URL > The response URL , provide to iPay88 support team
Default > Default payment method for your store , Yes/No
Default Currency > Default currency for your store
When done , click “Save Changes”.
7. Inform iPay88 Support Team your Request & Response URLs.
Example of request & response URLs:
Request URL : www.yourdomain.com
Response URL : http://www.yourdomain.com/modules/gateway/iPay88/confirmed.php
Do a test transaction on your iPay88’s account, when payment completed , the module will call back to your CubeCart
V4, show the payment notification page , update order status accordingly , email both admin and customer.
Author Alvin Lee
Developer Alvin Lee
E-mail [email protected]
Developer notes:
Sample code.
Index.php
<?php
die("Access Denied");
?>
transfer.inc.php
<?php
if (!defined('CC_INI_SET')) die("Access Denied");
function repeatVars() {
global $i, $orderInv;
// for product specific field (not require)
$hiddenVars = "";
return $hiddenVars;
}
function fixedVars() {
global $module, $orderSum, $config, $basket, $ccUserData;
// Form post to iPay88
return $hiddenVars;
///////////////////////////
// Other Vars
/////////////////////////
$formAction = "https://www.mobile88.com/epayment/entry.asp";
$formMethod = "post";
$formTarget = "_self";
$transfer = "auto";
$emailText = "Charges for the purchase will appear on your statement under the name ipay88.com\r\n";
$emailText .= "Questions regarding your order should be directed to:\r\n\r\n";
$emailText .= $config['storeName']."\r\n";
$emailText .= $GLOBALS['storeURL']."\r\n";
$emailText .= $config['masterEmail'];
?>
confirmed.php
<?php
// SUCCESS transaction
if ( $HTTP_POST_VARS['Status'] == "1" && Requery()=="00" ) {
// Write your update status code here
echo "<script>
alert(\"Your Online Payment have been succesfully processed!\\nYou will be redirect to home page\");
window.location=\"../../../index.php\";
</script>";
// FAILED transaction
} else {
// status remain default
// Write your update status code here
echo "<script>
alert(\"Your Online Payment cannot be processed and Your order(s) have been cancelled due to some reasons!
Sorry for the inconvenience.\\nYou will be redirect to invoice page. \");
window.location=\"../../../index.php?_g=co&_a=step2\";
</script>";
exit();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charsetIso;?>" />
<title>Redirecting...</title>
<meta http-equiv="refresh" content="0;URL=<?php echo $GLOBALS['storeURL']."/confirmed.php".$result; ?>" />
</head>
<body>
<p align="center" style="font:11px Arial bold">Redirecting.... <a href="<?php echo
$GLOBALS['storeURL']."/confirmed.php".$result; ?>"><?php echo $GLOBALS['storeURL']; ?></a></p>
</body>
</html>
admin/index.inc.php
<?php
if(!defined('CC_INI_SET')) {
die("Access Denied");
permission("settings","read",$halt=TRUE);
require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php");
if(isset($_POST['module'])) {
require CC_ROOT_DIR.CC_DS.'modules'.CC_DS.'status.inc.php';
$cache = new cache("config.".$moduleName);
$cache->clearCache();
$module = array();
$msg = writeDbConf ($_POST['module'], $moduleName, $module);
}
$module = fetchDbConfig($moduleName);
?>
<p><a href="http://www.ipay88.com/"><img src="modules/<?php echo $moduleType; ?>/<?php echo $moduleName;
?>/admin/logo.gif" alt="" border="0" title="" /></a></p>
<?php
if(isset($msg)) {
echo msg($msg);
$ipay88_title = "iPay88 Online Payment Gateway (Visa, Master Card, Maybank2u, MEPS, FPX, etc)" ;
global $config;
?>
<p class="copyText">" <a href="http://www.ipay88.com" target="_blank">iPay88 Online Payment Gateway </a> "</p>
<form action="<?php echo $glob['adminFile']; ?>?_g=<?php echo $_GET['_g']; ?>&module=<?php echo $_GET['module']; ?>"
method="post" enctype="multipart/form-data">
<table border="0" cellspacing="1" cellpadding="3" class="mainTable">
<tr>
<td colspan="2" class="tdTitle">Configuration Settings </td>
</tr>
<tr>
<td align="left" class="tdText"><strong>Status:</strong></td>
<td class="tdText">
<select name="module[status]">
<option value="1" <?php if($module['status']==1) echo "selected='selected'"; ?>>Enabled</option>
<option value="0" <?php if($module['status']==0) echo "selected='selected'"; ?>>Disabled</option>
</select></td>
</tr>
<tr>
<td align="left" class="tdText"><strong>Description:</strong> </td> <!-- value="<? echo $module['desc'] ?>" -->
<td class="tdText"><input type="text" name="module[desc]" value="<?php echo $ipay88_title; ?>" class="textbox" size="30"
/></td>
<td class="tdText">This will display as payment title on your Store home.</td>
</tr>
<!-- -->
<tr>
<td align="left" class="tdText"><strong>iPay88 Merchant Code</strong></td>
<td class="tdText"><input type="text" name="module[ipay88_merchant]" value="<?php echo $module['ipay88_merchant'];
?>" class="textbox" size="30" /></td>
</tr>
<!-- -->
<tr>
<td align="left" class="tdText"><strong>iPay88 Merchant Key</strong></td>
<td class="tdText"><input type="text" name="module[ipay88_vkey]" value="<?php echo $module['ipay88_vkey']; ?>"
class="textbox" size="30" /></td>
<td class="tdText">Please refer to your iPay88 Merchant Profile to have this key.</td>
</tr>
<!-- -->
<tr>
<td align="right" class="tdText"><div align="left"><strong>iPay88 Response URL</strong></div></td>
<td class="tdText"><input type="text" name="module[ipay88_url]" value="<?php echo $module['ipay88_url']; ?>"
class="textbox" size="30" /></td>
<td class="tdText">Provide the Response URL to iPay88 Support Team with this format: <br> E.g:
http://www.yourdomain.com/modules/gateway/iPay88/confirmed.php
</td>
</tr>
<!-- -->
<tr>
<td align="right" class="tdText"><div align="left"><strong>Default :</strong></div></td>
<td>
<select name="module[default]">
<option value="1" <?php if($module['default'] == 1) echo "selected='selected'"; ?>>Yes</option>
<option value="0" <?php if($module['default'] == 0) echo "selected='selected'"; ?>>No</option>
</select>
</td>
</tr>
<!-- -->
<tr>
<td align="right" class="tdText"><div align="left"><strong>Default Currency : </strong></div></td>
<td><?php echo $config[defaultCurrency]; ?></td>
<td class="tdText">Ensure the default currency set in the <a href="<?php echo $GLOBALS['storeURL'];
?>/admin.php?_g=settings/index" target="_blank">General Settings</a> is the same as the currency that iPay88 will process order
in.</td>
</tr>
<!-- -->
<tr>
<td align="right" class="tdText"> </td>
<td class="tdText"><input type="submit" class="submit" value="Save Changes" /></td>
</tr>
</table>
</form>