CCAvenue Payment Gateway integration Help – Process Payment – Classic ASP

Now you have learned how to start CCAvenue Payment Gateway integration Help – Initiate Transact the Integration at CCavenue.

In this article we will see how to receive and parse the response received from CCavenue payment gateway.

You will get the encrypted response from the CCAvenue. You need to Decrypt it using the DLL and .APX page provided in Integration kit.

Classic ASP code is as follows, page name should be what you gave in Redirect_Url Variable during payment initiation.

  <%
        
Dim strResponse,destURL,http_obj,decResponse
Dim objpairs,storage,k,htmlStr

       
strResponse =  Request.Form("encResp")
'destURL = "http://" & Request.ServerVariables("SERVER_NAME") & "/worldpay/CCAUtil.aspx"
destURL = "http://" & Request.ServerVariables("SERVER_NAME") & "/CCAUtil.aspx?encResponse=" + strResponse + "&act=DEC"
Set http_obj = Server.CreateObject("Microsoft.XMLHTTP")
http_obj.open "GET", destURL , false
http_obj.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
http_obj.send 

   set objPairs = Server.CreateObject("Scripting.Dictionary")
storage = Split(decResponse,"&")
     
 
For Each Item in storage
    Dim temp
    temp = Split(item,"=")
    objPairs.add temp(0), temp(1)
Next
 
 
   Order_Id= trim(objPairs.Item("order_id"))
   Amount=trim(objPairs.Item("amount"))
   
   scurrency=objPairs.Item("currency")

 
	billing_cust_name=objPairs.Item("billing_name")
       


	billing_cust_address=objPairs.Item("billing_address")
      

	billing_cust_country=objPairs.Item("billing_country")
     

	billing_cust_tel=objPairs.Item("billing_tel")
      

	billing_cust_email=objPairs.Item("billing_email")
      

	delivery_cust_name=objPairs.Item("delivery_name")
     

	delivery_cust_address=objPairs.Item("delivery_address")
     

	delivery_cust_tel=objPairs.Item("merchant_param3")
     

	delivery_cust_notes=objPairs.Item("merchant_param2")
     

	Merchant_Param=objPairs.Item("merchant_param1")
     
	
	Param_returnarr=Split(Merchant_param,"#")      

      Checksum =objPairs.Item("order_status")
	  
	  if (Checksum = "Success") then
	  'Process order, do check amount value
	  Else
	  ' Send user to error page
	  End if
	  
	  
%>