Hi, Can someone please take a look at this code given by my payment processor and tell me which part sends my web url to my payment processor to let them know which website is the payment coming from or does it not do that at all? Thank you and your help is very much appreciated. <?php class CHECKOUT_MOLPAY extends ISC_CHECKOUT_PROVIDER { private $_merchantid = 0; private $_vkey = ""; private $_testmode = ""; protected $supportsVendorPurchases = true; protected $_id = "molpay"; protected $supportsMultiShipping = false; public function __construct() { // Setup the required variables for the NbePay checkout module parent::__construct(); $this->SetName(GetLang('MOLPayName')); $this->SetImage("molpay_logo.gif"); $this->SetDescription(GetLang('MOLPayDesc')); $this->SetHelpText(sprintf(GetLang('MOLPayHelp'), $GLOBALS['ShopPathSSL'])); } /** * Set up the configuration options for this module. */ public function SetCustomVars() { $this->_variables['displayname'] = array("name" => "Display Name", "type" => "textbox", "help" => GetLang('DisplayNameHelp'), "default" => $this->GetName(), "required" => true ); $this->_variables['merchantid'] = array("name" => "Merchant ID", "type" => "textbox", "help" => GetLang('MOLPaySellerIdHelp'), "default" => "", "required" => true ); $this->_variables['vkey'] = array("name" => "Verify Key", "type" => "textbox", "help" => GetLang('MOLPaySecretWordHelp'), "default" => "", "required" => true ); } public function TransferToProvider() { $total = $this->GetGatewayAmount(); $this->_merchantid = trim($this->GetValue("merchantid")); $this->_vkey = trim($this->GetValue("vkey")); $testmode_on = $this->GetValue("testmode"); $returnurl = $GLOBALS['ISC_CFG']['ShopPath']."/finishorder.php?provider=MOLPay"; $orders = $this->GetOrders(); list(,$order) = each($orders); $orderIds = implode(',', array_keys($orders)); $itemFields = ''; // Get the items in the order $query = " SELECT * FROM [|PREFIX|]order_products WHERE orderorderid IN (".$orderIds.") "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $product = $GLOBALS['ISC_CLASS_DB']->Fetch($result); $billingDetails = $this->GetBillingDetails(); /*$shippingAddresses = $this->GetShippingAddresses(); $shippingDetails = current($shippingAddresses);*/ // get default currency set in shopping cart $currencycode = GetDefaultCurrency(); $currencycode = $currencycode['currencycode']; $ignoreCase = strnatcasecmp($currencycode, "myr"); if ($ignoreCase == "0") { $currencycode = "rm"; } else {$currencycode = strtolower($currencycode);} $hiddenFields = array( 'provider' => 'checkout_nbepay', 'merchantid' => $this->_merchantid, 'vkey' => $this->_vkey, 'orderid' => $order['orderid'], 'isc_order_id' => $_COOKIE['SHOP_ORDER_TOKEN'], 'amount' => number_format($total, 2, '.', ''), 'bill_name' => $billingDetails['ordbillfirstname'].' '.$billingDetails['ordbilllastname'], 'bill_email' => $billingDetails['ordbillemail'], 'bill_desc' => substr($product['ordprodname'], 0, 254), 'country' => $billingDetails['ordbillcountrycode'], 'currency' => $currencycode, 'returnurl' => $returnurl ); $merchantid = trim($this->GetValue("merchantid")); $vkey = trim($this->GetValue("vkey")); $amount = $hiddenFields['amount']; $orderID = $hiddenFields['orderid']; $vcode = md5($amount.$merchantid.$orderID.$vkey); $hiddenFields['vcode'] = $vcode; $itemFields = ''; // Get the items in the order $this->RedirectToProvider('https://www.onlinepayment.com.my/NBepay/pay/'.$merchantid.'/' ,$hiddenFields ); } /** * Return the unique order token which was saved as a cookie pre-payment. * * @return string The order token. */ public function GetOrderToken() { return @$_REQUEST['isc_order_id']; } /***************************************************************** * Verify the order was successful on the "Thank you" page. * ****************************************************************/ public function VerifyOrderPayment() { // clear cart EmptyCartAndKillCheckout(); // latest interspire V5++ require this $paymentId = $this->GetId(); $this->_vkey = trim($this->GetValue("vkey")); $this->_merchantid = trim($this->GetValue("merchantid")); // list of value returned by NBePay $vkey = $this->_vkey; $merchantid = $this->_merchantid; $tranID = $_REQUEST['tranID']; $appcode = $_REQUEST['appcode']; $amount = $_REQUEST['amount']; $orderid = $_REQUEST['orderid']; $status = $_REQUEST['status']; $currency = $_REQUEST['currency']; $paydate = $_REQUEST['paydate']; $skey = $_REQUEST['skey']; if (strtolower($currency)=="myr") $currency = "RM"; $key0 = md5($tranID.$orderid.$status.$merchantid.$amount.$currency); $key1 = md5($paydate.$merchantid.$key0.$appcode.$vkey); if ($skey!=$key1) $status = -1; if( isset($status) && isset($tranID) ) { if($status == "00") { $this->SetPaymentStatus(PAYMENT_STATUS_PAID); //IF SUCCESS, PAYMENT PAID $OrderStatus = ORDER_STATUS_COMPLETED; } else { $this->SetPaymentStatus(PAYMENT_STATUS_DECLINED); // PAYMENT_STATUS_DECLINED PAYMENT_STATUS_PENDING } return true; } else { // record into log for invalid order $GLOBALS['ISC_CLASS_LOG']->LogSystemError(array('payment', $this->GetName()), GetLang('NBePayErrorInvalid')); return false; } session_write_close(); } } // END CLASS ?> Code (markup):
Thanks alot for the reply. If the returnUrl is set elsewhere, will this hide the website where the actual sale was coming from? Or is there anyway to do so?
Since it's coming from a website, the payment processor can have code to grab the site it's coming from, regardless of any code in the script.