Question Detail

Payment Gateway Integration

6 years ago Views 1973 Visit Post Reply

How to integrate payment gateway integration in android app. Please provide a proper sample.


Thread Reply

Anonymous

- 6 years ago

We are utilizing CCAvenue app for android. You have to ask for the Android Integration Kit, however, your test account authorization, for example, MerchanId, Access Code, Encryption Key, from CCAvenue then you can do a "Consistent" integration with your Android App. Next, you should take this information stream: 

  1. Demand for payment choices from Mobile App to CCAvenue 
  2. JSON information with payment choices returned 
  3. Demand for encryption key from Mobile App to Merchant server 
  4. Demand for encryption key from Merchant server to CCAvenue 
  5. Dynamic encryption key returned 
  6. Encryption key sent from Merchant server to Mobile App 
  7. Exchange with scrambled information sent from Mobile App to CCavenue 
  8. Handled exchange status came back to Merchant server 
  9. Exchange status pulled by Mobile App 

Expectation this makes a difference!

DOWNLOAD SOURCE CODE

Anonymous

- 6 years ago

PHP Script for Integration of CCAvenue Payment Gateway :

CCavenue is most popular Payment gateway for online Shopping in india. It provide payment through using International credit card of your Bank (who has bond with CCavenue) online Account or using it’s debit card(ATM card). It is one of the most secure place that provides money to online shop.

For Integrate it with your website you should have CCavenue account and they give you a merchant id and a unique key for your site that is most important for money transaction.

Php Function’s Require TO Validate Require Value for CCAvenue Payment.

It requires 2 files commonly.,like

File #1 : ccavenueValidate.php

<?php

    function getCheckSum($MerchantId,$Amount,$OrderId ,$URL,$WorkingKey)
    {
        $str ="$MerchantId|$OrderId|$Amount|$URL|$WorkingKey";
        $adler = 1;
        $adler = adler32($adler,$str);
        return $adler;
    }

    function verifyCheckSum($MerchantId,$OrderId,$Amount,$AuthDesc,$CheckSum,$WorkingKey)
    {
        $str = "$MerchantId|$OrderId|$Amount|$AuthDesc|$WorkingKey";
        $adler = 1;
        $adler = adler32($adler,$str);

        if($adler == $CheckSum)
            return "true" ;
        else
            return "false" ;
    }

    function adler32($adler , $str)
    {
        $BASE =  65521 ;

        $s1 = $adler & 0xffff ;
        $s2 = ($adler >> 16) & 0xffff;
        for($i = 0 ; $i < strlen($str) ; $i++)
        {
            $s1 = ($s1 + Ord($str[$i])) % $BASE ;
            $s2 = ($s2 + $s1) % $BASE ;
            //echo "s1 : $s1 <BR> s2 : $s2 <BR>";

        }
        return leftshift($s2 , 16) + $s1;
    }

    function leftshift($str , $num)
    {

        $str = DecBin($str);

        for( $i = 0 ; $i < (64 - strlen($str)) ; $i++)
            $str = "0".$str ;

        for($i = 0 ; $i < $num ; $i++)
        {
            $str = $str."0";
            $str = substr($str , 1 ) ;
            //echo "str : $str <BR>";
        }
        return cdec($str) ;
    }

    function cdec($num)
    {

        for ($n = 0 ; $n < strlen($num) ; $n++)
        {
            $temp = $num[$n] ;
            $dec =  $dec + $temp*pow(2 , strlen($num) - $n - 1);
        }

        return $dec;
    }
?>

File #2 : form.php

Processing Page Code CCAvenue Passing Parameter That Require for Complete the Shopping In this page data comes from checkout form of shopping cart collect and validate according CCAcenue rules and arrange in given format and send it CCAenue sever for payment Processing.

<?php
    include(ccavenueValidate.php);
    $ccavenuemerchantId= "";//This id(also User Id)  available at "Generate Working Key" of "Settings & Options"
    $Amount = $orderdata[5];//your script should substitute the amount in the quotes provided here
    $orderId= $orderdata[0];;//your script should substitute the order description in the quotes provided here
    $WorkingKey = "";//Given to merchant by ccavenue
    $returnUrl ="http://www.example.com/shopping.php"; //url of your successpage
    $Checksum = getCheckSum($Merchant_Id,$Amount,$orderId,$Redirect_Url,$WorkingKey); // Validate All value
?>

<p align="center" style="font-family:Calibri; font-size:24px;color:#3670A7;">Processing to CCAvenue..............</p>

<form id="submittoserver" method="post" action="https://www.ccavenue.com/shopzone/cc_details.jsp">
    <input type="hidden" name="Merchant_Id" value="<?php echo $ccavenuemerchantId; ?>">
    <input type="hidden" name="Amount" value="<?php echo $Amount; ?>">
    <input type="hidden" name="Order_Id" value="<?php echo $ orderId; ?>">
    <input type="hidden" name="Redirect_Url" value="<?php echo $ returnUrl; ?>">
    <input type="hidden" name="Checksum" value="<?php echo $Checksum; ?>">
    <input type="hidden" name="billing_cust_name" value="<?php echo $orderdata[7].$orderdata[8];?>"> <!--Pass Customer Full Name -->
    <input type="hidden" name="billing_cust_address" value="<?php echo $orderdata[9].$orderdata[10];?>"><!--Pass Customer Full Address-->
    <input type="hidden" name="billing_cust_country" value="<?php echo $orderdata[15];?>"> <!--Pass Customer Country -->
    <input type="hidden" name="billing_cust_state" value="<?php echo $orderdata[14];?>"><!--Pass Customer State -->
    <input type="hidden" name="billing_cust_city" value="<?php echo $orderdata[13];?>"> <!--Pass Customer City -->
    <input type="hidden" name="billing_zip" value="<?php echo $orderdata[16];?>"> <!--Pass Customer Zip Code-->
    <input type="hidden" name="billing_cust_tel" value="<?php echo $orderdata[11];?>"> <!--Pass Customer Phone No-->
    <input type="hidden" name="billing_cust_email" value="<?php echo $orderdata[12];?>"> <!--Pass Customer Email address-->
    <input type="hidden" name="delivery_cust_name" value="<?php echo $orderdata[7].$orderdata[8];?>"> <!--Pass Same or other other detail fill by customer-->
    <input type="hidden" name="delivery_cust_address" value="<?php echo $orderdata[9].$orderdata[10];?>">
    <input type="hidden" name="delivery_cust_country" value="<?php echo $orderdata[15];?>">
    <input type="hidden" name="delivery_cust_state" value="<?php echo $orderdata[14];?>">
    <input type="hidden" name="delivery_cust_tel" value="<?php echo $orderdata[11];?>">
    <input type="hidden" name="delivery_cust_notes" value="">
    <input type="hidden" name="Merchant_Param" value="">
    <input type="hidden" name="billing_zip_code" value="<?php echo $orderdata[16];?>">
    <input type="hidden" name="delivery_cust_city" value="<?php echo $orderdata[13];?>">
    <input type="hidden" name="delivery_zip_code" value="<?php echo $orderdata[16];?>">

</form>

Please refer the above example and also refer the following link CCAvenue Integration PDF

I think this may help you to resolve your problem.

Anonymous

- 6 years ago

Try PayU money instead. PayU money is the best payment gateway in India. You can easily integrate it to your website or Android application that too for free of cost.

You can integrate PayU money to your Android application by simply downloading the PayU money SDK. The best part about integrating PayU money to your application is that all the transactions being made on it will be safe and secure.

Integrate PayU money to your Android application for giving seamless payment experience to your customers.

More