Classic ASP – CCAvenue Payment Gateway integration Help – Initiate Transact

By Initiate Transaction we mean to collect order details and sending customer to CCavenue for Payment

Merchants need an active CCAvenue account to start intrgration. Login to your CCAvenue M.A.R.S account and get the API credentials.

Login to your Merchant Account and download the intergration kit from Resources > Web Integration KIT > Download Integration Kits

You will find Following folder and files. Save files in your application.

bin > ASPEncKit.dll
libs > MCPG.CCA.Util.dll

You can keep both DLL in bin folder

‘From Settings tab > API Keys page copy and Save Merchant ID,  Access Code,  Encryption Key

Create a page ccavenue-start.asp and copy following Code

ASP code

     if request("btnpayment")<>"" then
     'if request("btnpayment.x")<>"" then 'use this if you want to use Image Button in Form
     MyNewRandomNum = Round(Rnd * 99) +1
     orderid = MyNewRandomNum + 267 ' You should use this as Transaction ID and should save to your Database. This will also appear in CCAvenue reports
     Merchant_Id = "" 'Put in the Merchant_Id in the quotes provided as shared by ccavenue. From Settings tab > API Keys page;
     strAccessCode = ""  'Put in the access code in the quotes provided as shared by ccavenue. From Settings tab > API Keys page;
     total="10" ' Don't Miss to give Value to Total, If missed you will not been able to see any error or CCAvenue Payment Window

    'Redirect_Url = "" 'This page will receive the Response from CCAvenue after Payment. You can Process your order here.
     Redirect_Url = "" 

     sbilling_cust_name="Test User"
     scurrency="USD" 'USD, INR You Might need to contact CCAvenue in order to get Multiple Currency Enabled in your Profile

           CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring  & "merchant_id="& Server.URLEncode(Merchant_Id) &""
     CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring & "&order_id=" & Server.URLEncode(orderid)  &""
     CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring & "&amount=" & Server.URLEncode(total)  &""
      CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring  & "&redirect_url="& Server.URLEncode(Redirect_Url) &""
      CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring  & "&billing_cust_name="& sbilling_cust_name &""
      CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring  & "&billing_cust_email="& sbilling_cust_email &""
     CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring & "&merchant_param1="& nitem_number  &""
     CCpaymentgatewayintegrationstring=CCpaymentgatewayintegrationstring & "&currency="& scurrency  &""
      url = "http://" & Request.ServerVariables("SERVER_NAME") &  "/CCAUtil.aspx?" +  lcase(CCpaymentgatewayintegrationstring) +   "&act=ENC" ' This will encrypt the string
     Set ServerXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
              "GET", url ,false
     ServerXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
     strEncRequest = ServerXmlHttp.ResponseText


      Response.redirect  CCAvenueProductionURL&"/transaction/"  + strEncRequest +  "&access_code="  +  strAccessCode

     end if

    <form action="ccavenue-start.asp" method="post" ID="Form1">
    <input type="image" src="/images/paymentnew_btncheckout.gif" border="0" name="btnpayment" alt="Make payments with ccavenue - it's fast, free and secure!" ID="Image2">
    <input type="submit" border="0" name="btnpayment" alt="Make payments with ccavenue - it's fast, free and secure!" ID="Image2"><br><br>

Next Chapter will be how to collect response from CCAvenue and process order

Proceed to

Error Code: 10002

Error Code complete list

More on CCavenue