473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

how to use $_REQUEST to get data from CCAVENUES

Dear All I have shopping cart of ccavenues and I have got the success to send my database values to ccavenues shopping cart and that work very perfectly and user is able to pay the success ful payment but...

I am not able to figure out how can i get the success / failer message of shopping cart to my database.

Means I want to save the successfull entry to my website sql database that .

IF payment is successfull got to account page of my site
}
else got to login.php

I am pasting the code there kindly help me out please

mypayment page which is sending value to cart. normally they call it checkout.php but i have kept the name payment.php


Expand|Select|Wrap|Line Numbers
  1. <?php
  2.                         include('usercheker.php'); // It to check user is logined or not.
  3.             $rs=mysql_query("Select * from user_info where ID=$usercci");
  4.             while($row1=mysql_fetch_array($rs))
  5.                 {
  6.                     $dob=$row1['DOB'];
  7.                     $country=$row1['COUNTRY'];
  8.                     $pid=$row1['ID'];        
  9.                     $plan=$row1['PLAN_AMT'];            
  10.                     $nm=$row1['NAME'];
  11.                     $m_tng=$row1['M_TNG'];
  12.                     $img=$row1['IMAGE'];
  13.                     $email=$row1['EMAIL'];
  14.                 }        
  15.                 require("libfuncs.php");
  16.  
  17.     $Merchant_Id = "M_web225514_s555" ;//This id(also User Id)  available at "Generate Working Key" of "Settings & Options" 
  18.     $Amount = "$plan" ;//your script should substitute the amount in the quotes provided here
  19.     $Order_Id = "$vvv" ;//your script should substitute the order description in the quotes provided here
  20.     $Redirect_Url = "http:/mydomain.com/success.php" ;//your redirect URL where your customer will be redirected after authorisation from CCAvenue
  21.  
  22.     $WorkingKey = "7m4xcvxcvxddddda6ls5"  ;//put in the 32 bit alphanumeric key in the quotes provided here.Please note that get this key ,login to your CCAvenue merchant account and visit the "Generate Working Key" section at the "Settings & Options" page. 
  23.     $Checksum = getCheckSum($Merchant_Id,$Amount,$Order_Id ,$Redirect_Url,$WorkingKey);
  24. ?>
  25.  
  26.             <form method="post" action="https://www.ccavenue.com/shopzone/cc_details.jsp">
  27.     <input type=hidden name=Merchant_Id value="<?php echo $Merchant_Id; ?>">
  28.     <input type=hidden name=Amount value="<?php echo $plan; ?>">
  29.     <input type=hidden name=Order_Id value="<?php echo $vvv; ?>">
  30.     <input type=hidden name=Redirect_Url value="<?php echo $Redirect_Url; ?>">
  31.     <input type=hidden name=Checksum value="<?php echo $Checksum; ?>">
  32.     <input type="hidden" name="billing_cust_name" value="<?php echo $nm; ?>"> 
  33.     <input type="hidden" name="billing_cust_address" value="<?php echo $city; ?>"> 
  34.     <input type="hidden" name="billing_cust_country" value="<?php echo $country; ?>"> 
  35.     <input type="hidden" name="billing_cust_state" value="<?php echo $state; ?>"> 
  36.     <input type="hidden" name="billing_zip" value="<?php echo $billing_zip; ?>"> 
  37.     <input type="hidden" name="billing_cust_tel" value="<?php echo $mobile; ?>"> 
  38.     <input type="hidden" name="billing_cust_email" value="<?php echo $email; ?>"> 
  39.     <input type="hidden" name="delivery_cust_name" value="<?php echo $nm; ?>"> 
  40.     <input type="hidden" name="delivery_cust_address" value="<?php echo $city; ?>"> 
  41.     <input type="hidden" name="delivery_cust_country" value="<?php echo $country; ?>"> 
  42.     <input type="hidden" name="delivery_cust_state" value="<?php echo $state; ?>"> 
  43.     <input type="hidden" name="delivery_cust_tel" value="<?php echo $mobile; ?>"> 
  44.     <input type="hidden" name="delivery_cust_notes" value="<?php echo $delivery_cust_notes; ?>"> 
  45.     <input type="hidden" name="Merchant_Param" value="<?php echo $Merchant_Param; ?>"> 
  46.     <input type="hidden" name="billing_cust_city" value="<?php echo $city; ?>"> 
  47.     <input type="hidden" name="billing_zip_code" value="<?php echo $city; ?>"> 
  48.     <input type="hidden" name="delivery_cust_city" value="<?php echo $city; ?>"> 
  49.     <input type="hidden" name="delivery_zip_code" value="<?php echo  $mobile; ?>"> 
  50.     <INPUT TYPE="submit" value="submit">
  51.     </form>

libfuncs.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. function getchecksum($MerchantId,$Amount,$OrderId ,$URL,$WorkingKey)
  3. {
  4.     $str ="$MerchantId|$OrderId|$Amount|$URL|$WorkingKey";
  5.     $adler = 1;
  6.     $adler = adler32($adler,$str);
  7.     return $adler;
  8. }
  9.  
  10. function verifychecksum($MerchantId,$OrderId,$Amount,$AuthDesc,$CheckSum,$WorkingKey)
  11. {
  12.     $str = "$MerchantId|$OrderId|$Amount|$AuthDesc|$WorkingKey";
  13.     $adler = 1;
  14.     $adler = adler32($adler,$str);
  15.  
  16.     if($adler == $CheckSum)
  17.         return "true" ;
  18.     else
  19.         return "false" ;
  20. }
  21.  
  22. function adler32($adler , $str)
  23. {
  24.     $BASE =  65521 ;
  25.  
  26.     $s1 = $adler & 0xffff ;
  27.     $s2 = ($adler >> 16) & 0xffff;
  28.     for($i = 0 ; $i < strlen($str) ; $i++)
  29.     {
  30.         $s1 = ($s1 + Ord($str[$i])) % $BASE ;
  31.         $s2 = ($s2 + $s1) % $BASE ;
  32.             //echo "s1 : $s1 <BR> s2 : $s2 <BR>";
  33.  
  34.     }
  35.     return leftshift($s2 , 16) + $s1;
  36. }
  37.  
  38. function leftshift($str , $num)
  39. {
  40.  
  41.     $str = DecBin($str);
  42.  
  43.     for( $i = 0 ; $i < (64 - strlen($str)) ; $i++)
  44.         $str = "0".$str ;
  45.  
  46.     for($i = 0 ; $i < $num ; $i++) 
  47.     {
  48.         $str = $str."0";
  49.         $str = substr($str , 1 ) ;
  50.         //echo "str : $str <BR>";
  51.     }
  52.     return cdec($str) ;
  53. }
  54.  
  55. function cdec($num)
  56. {
  57.  
  58.     for ($n = 0 ; $n < strlen($num) ; $n++)
  59.     {
  60.        $temp = $num[$n] ;
  61.        $dec =  $dec + $temp*pow(2 , strlen($num) - $n - 1);
  62.     }
  63.  
  64.     return $dec;
  65. }
  66. ?>


Redirect .php
Expand|Select|Wrap|Line Numbers
  1. <? require("libfuncs.php");
  2.  
  3. /*
  4.  
  5.     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.
  6.  
  7.     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. 
  8.  
  9. */
  10.  
  11.     $WorkingKey = "7m4fssiby9aqxa6ls5" ; //put in the 32 bit working key in the quotes provided here
  12.     $Merchant_Id= $_REQUEST[''];
  13.     $Amount= $_REQUEST[''];
  14.     $Order_Id= $_REQUEST[''];
  15.     $Merchant_Param= $_REQUEST['Merchant_Param'];
  16.     $Checksum= $_REQUEST['Checksum'];
  17.     $AuthDesc=$_REQUEST['AuthDesc'];
  18.  
  19.     $Checksum = verifyChecksum($Merchant_Id, $Order_Id , $Amount,$AuthDesc,$Checksum,$WorkingKey);
  20.  
  21.  
  22.     if($Checksum=="true" && $AuthDesc=="Y")
  23.     {
  24.         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.";
  25.  
  26.         //Here you need to put in the routines for a successful 
  27.         //transaction such as sending an email to customer,
  28.         //setting database status, informing logistics etc etc
  29.     }
  30.     else if($Checksum=="true" && $AuthDesc=="B")
  31.     {
  32.         echo "<br>Thank you for shopping with us.We will keep you posted regarding the status of your order through e-mail";
  33.  
  34.         //Here you need to put in the routines/e-mail for a  "Batch Processing" order
  35.         //This is only if payment for this transaction has been made by an American Express Card
  36.         //since American Express authorisation status is available only after 5-6 hours by mail from ccavenue and at the "View Pending Orders"
  37.     }
  38.     else if($Checksum=="true" && $AuthDesc=="N")
  39.     {
  40.         echo "<br>Thank you for shopping with us.However,the transaction has been declined.";
  41.  
  42.         //Here you need to put in the routines for a failed
  43.         //transaction such as sending an email to customer
  44.         //setting database status etc etc
  45.     }
  46.     else
  47.     {
  48.         echo "<br>Security Error. Illegal access detected";
  49.  
  50.         //Here you need to simply ignore this and dont need
  51.         //to perform any operation in this condition
  52.     }
  53. ?>
Sep 30 '11 #1
0 2077

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Pavils Jurjans | last post by:
Hallo, I am working on multilingual web-application, and I have to be very sure about how the international characters are encoded and decoded in the client-server form requests. There's a...
1
by: Tumurbaatar S. | last post by:
When a browser sends (get or post) a form data containing non-ASCII char-s (i.e. above 127), Request returns some char-s encoded like '&#nnn'. It seems that when I used a standard WindowsXP...
13
by: Fawke101 | last post by:
Hi there, I have an application that rips data from an SQL server and displays it in columnar form on an ASP page, using a Do until RS.EOF loop. I wish to add 2 arrows to each column (up and...
2
by: Fred | last post by:
I have a table (Tickdata; Contract,Price,Timecreated) which stores Timecreated as datetime. I need to request the maximum price where the Timecreated is greater than some value, in this case...
1
by: Markus | last post by:
Hello, I have an asp application with a logon form that posts form content (username and pw textbox) to itself in order to process and verify. If the application is set to windows integrated...
1
by: Lalit Singh | last post by:
Is there anyway I can log the HTTP request coming to IIS5? I wanted to track some human readable data in a web based application (asp.net/vb.net/.NetFramework 1.1) Thanks, Lalit
1
by: thallasridevi | last post by:
Hi All, I have page called page1.php with some hidden fields and i submitted the page to page2.php. I page2.php, i am able to get the values of hidden fields through $_REQUEST. And from this page...
8
by: =?ISO-8859-1?Q?m=E9choui?= | last post by:
Problem: - You have tree structure (XML-like) that you don't want to create 100% in memory, because it just takes too long (for instance, you need a http request to request the information from...
3
by: Joseph Geretz | last post by:
I'm using the Request Filter documentation which can be found here: http://msdn.microsoft.com/en-us/library/system.web.httprequest.filter.aspx In this example, two filters are installed, one...
1
bilibytes
by: bilibytes | last post by:
Hi everyone, I have new questions for tonight. I would like to know the best ways to prevent Denial Of Service Attacks. Well my question is a bit more precise than that. I can see of three...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.