Search code examples
phpamazon-ec2payment-gatewayccavenue

CC avenue new api request handler not responding in php on ec2 linux instance


After checkout the URL I am redirecting on ccavRequestHandler.php with following code. Once I redirected after checkout its showing blank white page. URL for the site is activated with working key, access code in cc avenue setting page. But still I am not able to sort out issue. Please provide some better solution.

    <html>
    <head>
    <title> Custom Form Kit </title>
    </head>
    <body>
    <center>

    <?php include('Crypto.php')?>
    <?php 

        error_reporting(0);

        $merchant_data='';
         $merchant_id=$_POST['merchant_id'];  
        $order_id=$_POST['order_id'];        
        $amount=$_POST['amount'];            
        $currency=$_POST['currency'];
        $redirect_url=$_POST['redirect_url'];         
        $cancel_url=$_POST['cancel_url'];
        $language=$_POST['language'];

        $working_key='123abc';//here i have entered cc avenue provided key 
        $access_code='WERT7CVN';//here i have entered cc avenue access code 

$merchant_data='merchant_id='.$merchant_id.'&order_id='.$order_id.
                '&amount='.$amount.'&currency='.$currency.
                '&redirect_url='.$redirect_url.'&cancel_url='.$cancel_url.
                '&language='.$language;

        foreach ($merchant_data as $key => $value){
            $merchant_data.=$key.'='.urlencode($value).'&';

        }

        $encrypted_data=encrypt($merchant_data,$working_key); // Method for encrypting the data.

    ?>
    <form method="post" name="redirect" action="https://secure.ccavenue.com/transaction/transaction.do?command=initiateTransaction"> 
    <?php
    echo "<input type=hidden name=encRequest value=$command>";
    echo "<input type=hidden name=encRequest value=$encrypted_data>";
    echo "<input type=hidden name=access_code value=$access_code>";
    ?>
    </form>
    </center>
    <script language='javascript'>document.redirect.submit();</script>
    </body>
    </html>

Solution

  • To run cc avenue on ec2 you need to be install bellow extension will support mcrypt

    step to install

    1) login to ssh with user e.g ec2-user (may be another according to your image)

    2) run command to login as root command:- sudo -s

    3)install mcrypt using command :- yum install php-mcrypt

    4)restart appache.