CCAvenue Payment Gateway integration Help - Initiate Transact

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
CCAUtil.aspx

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

Create a page CCavnue-asp.asp and copy following Code

Payment Form, Avoid using Order Details in form


<form action="CCavnue-asp.asp" method="post" ID="Form1">

    <input type="image" src="/images/payment/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">

</form>     

ASP code

<%
   
    if request("btnpayment")<>"" then

    'if request("btnpayment.x")<>"" then 'use this if you want to use Image Button in Form
 
    Randomize
    MyNewRandomNum = Round(Rnd * 457) 1
    MyNewRandomNum=MyNewRandomNum
    orderid = MyNewRandomNum 232 ' 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
   
    total=FormatNumber(total,,,,0)
    Redirect_Url = "http://example.com/ccavResponseHandler.asp" 'This page will receive the Response from CCAvenue after Payment. You can Process your order here.
    sbilling_cust_name="Test User"
    sbilling_cust_email="testuser@example.com"
    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"
 
    Set ServerXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
                
    ServerXmlHttp.open "GET", url ,false
    ServerXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    ServerXmlHttp.send
    strEncRequest = ServerXmlHttp.ResponseText

    'CCAvenueTestURL="https://test.ccavenue.com"
    CCAvenueProductionURL="https://secure.ccavenue.com"

    Response.redirect CCAvenueProductionURL&"/transaction/transaction.do?command=initiateTransaction&encRequest="   strEncRequest   "&access_code="   strAccessCode

    end if
%>

 

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

Contact us for any question on this topic

6/13/2018

CCAvenue integration kit for Third Party Shopping Cart - Drupal Magento wordpress

Click here to Read Complete Article

6/13/2018

CCAvenue gateway integration kit for Android and iOS

Click here to Read Complete Article

6/13/2018

CCAvenue gateway integration best practice

Click here to Read Complete Article

Search for any Payment Gateway PayPal , PayTm , BIKE BOT , Tech Help , Tech News

Click here to Contact for any Integration Help

Click here if you wants free ₹51 in bank account NOW!

Now how to make Money Online for Free

India Asian Gold Medals