public function successAction()
 {
     $response = $this->getRequest()->getPost();
     $WorkingKey = '80dok7geej2kvvd90b';
     //put in the 32 bit working key in the quotes provided here
     $Merchant_Id = $_REQUEST['Merchant_Id'];
     $Amount = $_REQUEST['Amount'];
     $Order_Id = $_REQUEST['Order_Id'];
     $Merchant_Param = $_REQUEST['Merchant_Param'];
     $Checksum = $_REQUEST['Checksum'];
     $AuthDesc = $_REQUEST['AuthDesc'];
     $Avenues = Mage::getModel('Avenues/Avenues');
     $Checksum = verifyChecksum($Merchant_Id, $Order_Id, $Amount, $AuthDesc, $Checksum, $WorkingKey);
     if ($Checksum == "true" && $AuthDesc == "Y") {
         $order = Mage::getModel('sales/order');
         $order->loadByIncrementId($Order_Id);
         $_mail = false;
         $f_passed_status = Mage::getStoreConfig('payment/Avenues/orderStatus');
         $order->setState($f_passed_status, $f_passed_status, Mage::helper('Avenues')->__('The payment is AUTHORIZED by Avenues.'), $_mail);
         $order->sendOrderUpdateEmail($_mail, Mage::helper('Avenues')->__('Your payment is authorized.'));
         $session = Mage::getSingleton('checkout/session');
         $session->setQuoteId($session->getAvenuesStandardQuoteId(true));
         Mage::getSingleton('checkout/session')->getQuote()->setIsActive(false)->save();
         $this->_redirect('checkout/onepage/success', array('_secure' => true));
     } else {
         if ($Checksum == "true" && $AuthDesc == "B") {
             echo "<br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail";
             //Here you need to put in the routines/e-mail for a  "Batch Processing" order
             //This is only if payment for this transaction has been made by an American Express Card
             //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"
         } else {
             if ($Checksum == "true" && $AuthDesc == "N") {
                 Mage::getSingleton('checkout/session')->addError("Thank you for shopping with us.However,the transaction has been declined");
                 $this->_redirect('checkout/cart');
                 //Here you need to put in the routines for a failed
                 //transaction such as sending an email to customer
                 //setting database status etc etc
             } else {
                 Mage::getSingleton('checkout/session')->addError("Security Error. Illegal access detected");
                 $this->_redirect('checkout/cart');
             }
         }
     }
 }
    //This refers to the amount of transaction in your Selling Currency
    $accountingCurrencyAmount = $_GET['accountingcurrencyamount'];
    //This refers to the amount of transaction in your Accounting Currency
    $redirectUrl = $_GET['redirecturl'];
    //This is the URL on our server, to which you need to send the user once you have finished charging him
    $checksum = $_GET['checksum'];
    //checksum for validation
    $price = $sellingCurrencyAmount + $settings['myorderbox']['uni'][$widget[1]]['commission']($sellingCurrencyAmount, $_GET['resellerCurrency'], $userType);
    $time = time();
    $rkey = md5($time . $_GET['transid'] . $private_var['private_rkey']);
    $data = apc_fetch('transid-' . $transId);
    if ($data) {
        header('HTTP/1.1 302 Moved Temporarily');
        header('Location: ' . $settings['global']['base_url'] . 'myorderbox-check.php?transid=' . $transId . '&time=' . $time . '&key=' . $rkey);
    } else {
        if (verifyChecksum($paymentTypeId, $transId, $userId, $userType, $transactionType, $invoiceIds, $debitNoteIds, $description, $sellingCurrencyAmount, $accountingCurrencyAmount, $settings['myorderbox']['uni'][$widget[1]]['key'], $checksum) && $sellingCurrencyAmount == $accountingCurrencyAmount) {
            $widget = new Paymentwall_Widget($userId, 'p2', [new Paymentwall_Product($transId, $price, $_GET['resellerCurrency'], $transId, Paymentwall_Product::TYPE_FIXED)], ['email' => $_GET['emailAddr'], 'pingback_url' => $settings['global']['base_original_url'] . 'myorderbox-uni-pingback.php', 'ts' => $time, 'ps' => $widget[1], 'usertype' => $userType, 'origin_price' => $sellingCurrencyAmount, 'success_url' => $settings['global']['base_url'] . 'myorderbox-check.php?transid=' . $transId . '&time=' . $time . '&key=' . $rkey]);
            $html = $widget->getHtmlCode() . '<h1 style="margin: 1em;z-index: 1;">Loading…</h1>';
        } else {
            $html = "Checksum Mismatch";
        }
        ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
	<title>Pay with Paymentwall</title>
	<style>
	* { margin: 0; }
	iframe { width: 100vw !important; height: 100vh !important; position: absolute !important; z-index: 10000; top:0; left: 0; }
	</style>
    //This refers to the amount of transaction in your Selling Currency
    $accountingCurrencyAmount = $_GET['accountingcurrencyamount'];
    //This refers to the amount of transaction in your Accounting Currency
    $redirectUrl = $_GET['redirecturl'];
    //This is the URL on our server, to which you need to send the user once you have finished charging him
    $checksum = $_GET['checksum'];
    //checksum for validation
    $price = $sellingCurrencyAmount + $settings['myorderbox']['commission']($sellingCurrencyAmount, $_GET['resellerCurrency'], $userType);
    $time = time();
    $rkey = md5($time . $_GET["transid"] . $private_var['private_rkey']);
    $data = apc_fetch('transid-' . $transId);
    if ($data) {
        header('HTTP/1.1 302 Moved Temporarily');
        header('Location: ' . $settings['global']['base_url'] . 'myorderbox-check.php?transid=' . $transId . '&time=' . $time . '&key=' . $rkey);
    } else {
        if (verifyChecksum($paymentTypeId, $transId, $userId, $userType, $transactionType, $invoiceIds, $debitNoteIds, $description, $sellingCurrencyAmount, $accountingCurrencyAmount, $private_var['myorderbox'], $checksum) && $sellingCurrencyAmount == $accountingCurrencyAmount) {
            $widget = new Paymentwall_Widget($userId, 'p4', [new Paymentwall_Product($transId, $price, $_GET['resellerCurrency'], $transId, Paymentwall_Product::TYPE_FIXED)], ['email' => $_GET['emailAddr'], 'pingback_url' => $settings['global']['base_original_url'] . 'myorderbox-pingback.php', 'ts' => $time, 'origin_price' => $sellingCurrencyAmount, 'usertype' => $userType, 'success_url' => $settings['global']['base_url'] . 'myorderbox-check.php?transid=' . $transId . '&time=' . $time . '&key=' . $rkey]);
            $html = $widget->getHtmlCode() . '<h1 style="margin: 1em;z-index: 1;">Loading…</h1>';
        } else {
            $html = "Checksum Mismatch";
        }
        ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
	<title>Pay with Paymentwall</title>
	<style>
	* { margin: 0; }
	iframe { width: 100vw !important; height: 100vh !important; position: absolute !important; z-index: 10000; top:0; left: 0; }
	</style>
Exemple #4
0
require_once DOCUMENT_ROOT . "/system/includes/dboperations.php";
/*
	This is the sample RedirectURL PHP script. It can be directly used for integration with CCAvenue if your application is developed in PHP. You need to simply change the variables to match your variables as well as insert routines for handling a successful or unsuccessful transaction.
	return values i.e the parameters namely Merchant_Id,Order_Id,Amount,AuthDesc,Checksum,billing_cust_name,billing_cust_address,billing_cust_country,billing_cust_tel,billing_cust_email,delivery_cust_name,delivery_cust_address,delivery_cust_tel,billing_cust_notes,Merchant_Param POSTED to this page by CCAvenue. 
*/
$WorkingKey = "M_mypocket_13956";
//put in the 32 bit working key in the quotes provided here
$Merchant_Id = $_REQUEST['Merchant_Id'];
$Amount = $_REQUEST['Amount'];
$Order_Id = $_REQUEST['Order_Id'];
$Merchant_Param = $_REQUEST['Merchant_Param'];
$Merchant_Param = str_replace("`", '', $Merchant_Param);
$data = explode(',', $Merchant_Param);
$Checksum = $_REQUEST['Checksum'];
$AuthDesc = $_REQUEST['AuthDesc'];
$Checksum = verifyChecksum($Merchant_Id, $Order_Id, $Amount, $AuthDesc, $Checksum, $WorkingKey);
$Checksum = 'true';
$AuthDesc = "Y";
if ($Checksum == "true" && $AuthDesc == "Y") {
    echo "<br>Thank you for shopping with us. Your credit card has been charged and your transaction is successful. We will be shipping your order to you soon.";
    $COUPONID = $data[0];
    $L_QTY0 = $data[1];
    $USERID = $data[2];
    $REFERRAL_AMOUNT = $data[3];
    $TYPE = $data[4];
    $queryString = "insert into transaction_details (PAYERID,PAYERSTATUS,COUNTRYCODE,COUPONID,FIRSTNAME,LASTNAME,TRANSACTIONID,L_QTY0,USERID,EMAIL,TRANSACTIONTYPE,CORRELATIONID,REFERRAL_AMOUNT,CAPTURED,CAPTURED_ACK,ACK,AMT) values ('{$PAYERID}','{$PAYERSTATUS}','{$COUNTRYCODE}','{$COUPONID}','{$FIRSTNAME}','{$LASTNAME}','{$TRANSACTIONID}','{$L_QTY0}','{$USERID}','{$EMAIL}','{$TYPE}','{$CORRELATIONID}','{$REFERRAL_AMOUNT}', '1','Success','Success','{$Amount}')";
    require_once DOCUMENT_ROOT . "/system/includes/dboperations.php";
    $resultSet = mysql_query($queryString);
    $_SESSION['txn_id'] = mysql_insert_id();
    $_SESSION['deal_quantity'] = $L_QTY0;
    $_SESSION['txn_amt'] = $AMT + $_SESSION['deductable_ref_amt'];
$invoiceIds = $_GET["invoiceids"];
//comma separated Invoice Ids, This will have a value only if the transactiontype is "ResellerPayment" or "CustomerPayment"
$debitNoteIds = $_GET["debitnoteids"];
//comma separated DebitNotes Ids, This will have a value only if the transactiontype is "ResellerPayment" or "CustomerPayment"
$description = $_GET["description"];
$sellingCurrencyAmount = $_GET["sellingcurrencyamount"];
//This refers to the amount of transaction in your Selling Currency
$accountingCurrencyAmount = $_GET["accountingcurrencyamount"];
//This refers to the amount of transaction in your Accounting Currency
$redirectUrl = $_GET["redirecturl"];
//This is the URL on our server, to which you need to send the user once you have finished charging him
$checksum = $_GET["checksum"];
//checksum for validation
echo "File paymentpage.php<br>";
echo "Checksum Verification..............";
if (verifyChecksum($paymentTypeId, $transId, $userId, $userType, $transactionType, $invoiceIds, $debitNoteIds, $description, $sellingCurrencyAmount, $accountingCurrencyAmount, $key, $checksum)) {
    //YOUR CODE GOES HERE
    /** 
     * since all these data has to be passed back to foundation after making the payment you need to save these data
     *	
     * You can make a database entry with all the required details which has been passed from foundation.  
     *
     *							OR
     *	
     * keep the data to the session which will be available in postpayment.php as we have done here.
     *
     * It is recommended that you make database entry.
     **/
    $_SESSION['redirecturl'] = $redirectUrl;
    $_SESSION['transid'] = $transId;
    $_SESSION['sellingcurrencyamount'] = $sellingCurrencyAmount;