Wednesday, 26 February 2014

How to CCAvenue Payment Gateway Integration php?



  • Integrating CCavenue payment gateway is simple
  • We need a merchant id and working for implementing payment gateway
  • They use a redirect model for payment
  • ie the user will be rediected to there site for making the payment
  • Before for sending the details to CCavenue we need to save the details so that we can verify the details after the payment
  • we need to generate a signature(checksum) that is it contain some details like amount, orderid, working key, merchantid and rediecturl
  • On the buy page on submitting we need a serverside validation of the details the user have entered and after that the user details need to be stored in our DB after the payment is successfully completed 
  • After entering all the details we need to redirect to another page it contain a form and the CCavenue form variables which are in hidden and we need to auto submit after loading the page
----------------------Page content--------------------------------------
<?php
$Merchant_Id = "your_merchantid";//
$Amount = "amount";
$Order_Id ="orderid";//unique Id that should be passed to payment gateway
$WorkingKey = "working_key";//Given to merchant by ccavenue
$Redirect_Url ="sucessurl";
$Checksum = getCheckSum($Merchant_Id,$Amount,$Order_Id ,$Redirect_Url,$WorkingKey);                 // Validate All value
//creating a signature using the given details for security reasons
function getchecksum($MerchantId,$Amount,$OrderId ,$URL,$WorkingKey)
{
$str ="$MerchantId|$OrderId|$Amount|$URL|$WorkingKey";
$adler = 1;
$adler = adler32($adler,$str);
return $adler;
}
//functions
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 ;
}
return leftshift($s2 , 16) + $s1;
}
//leftshift function
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 ) ;
}
return cdec($str) ;
}
//cdec function
function cdec($num)
{
for ($n = 0 ; $n < strlen($num) ; $n++)
{
$temp = $num[$n] ;
$dec = $dec + $temp*pow(2 , strlen($num) - $n - 1);
}
return $dec;
}
?>
<form id="ccavenue" method="post" action="https://www.ccavenue.com/shopzone/cc_details.jsp">
<input type=hidden name="Merchant_Id" value="Merchant_Id">
<input type="hidden" name="Amount" value="Amount">
<input type="hidden" name="Order_Id" value="Order_Id">
<input type="hidden" name="Redirect_Url" value="success url">
<input type="hidden" name="TxnType" value="A">
<input type="hidden" name="ActionID" value="TXN">
<input type="hidden" name="Checksum" value="<?php echo $Checksum; ?>">
<input type="hidden" name="billing_cust_name" value="name of user">
<input type="hidden" name="billing_cust_address" value="address of user">
<input type="hidden" name="billing_cust_country" value="user country">
<input type="hidden" name="billing_cust_state" value="state of user">
<input type="hidden" name="billing_cust_city" value="city">
<input type="hidden" name="billing_zip" value="zip/pin code">
<input type="hidden" name="billing_cust_tel" value="telphone no">
<input type="hidden" name="billing_cust_email" value="emailid">
<input type="hidden" name="delivery_cust_name" value="user name">
<input type="hidden" name="delivery_cust_address" value="delivering address">
<input type="hidden" name="delivery_cust_country" value="delivering country">
<input type="hidden" name="delivery_cust_state" value="delivering state">
<input type="hidden" name="delivery_cust_tel" value="telphone no">
<input type="hidden" name="delivery_cust_notes" value="this is a test">
<input type="hidden" name="Merchant_Param" value="">
<input type="hidden" name="billing_zip_code" value="zip/pin">
<input type="hidden" name="delivery_cust_city" value="city">

<input type="submit" value="Buy Now" />
</form>

------------------End of page content--------------------------------------
  • After the successful payment,CCavenue will redirect to our successurl with the some details as post url/get url
  • there are mainly 3 auth_status are there they are 
  • Y successfully authorised by gateway
  • N Unsuccessful transaction
  • B not authenicated at this pont of time
  • we need to verify the payment gateway details send by CCavenue is tampered or not for that we have to use the Verify checksum function
       --------------------------------------------------------------------------------------------
//Verify the the checksum
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" ;
}
//functions
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 ;
}
return leftshift($s2 , 16) + $s1;
}
//leftshift function
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 ) ;
}
return cdec($str) ;
}
//cdec function
function cdec($num)
{
for ($n = 0 ; $n < strlen($num) ; $n++)
{
$temp = $num[$n] ;
$dec = $dec + $temp*pow(2 , strlen($num) - $n - 1);
}
return $dec;
}
           ---------------------------------------------------------------------------------
  • we need to pass the details into it, if it returns true than the details are ok and payment was successfull redirect to success page
  • if it returns false then the details are tampered while sending to our application and something wrong has occured and redirect to failed /unsuccessful page

How to Integrate a Payment Gateway with a Website?

Payment gateway integration into e-commerce websites is a good way of accepting payment for products or services offered by online shopping. This ensures that an online business owner stays completely hassle free for handling payment by customers.

1. Understand what a payment gateway is. A Payment Gateway is basically an application which enables the user to process all his transactions online or over the internet.
  • If you want to sell your services or products via internet or a website, you need to have a payment gateway integrated on your website to facilitate easy payment transfer between customers and the business.
  • Apart from this, the payment gateway should also secure the financial institution which pays on behalf of the customer and the financial institution which is accepting payment on behalf of the seller.
  • This software acts just as a liaison between the internet and your e-commerce website.Integrate a Payment Gateway Into a Website Step 2.jpg

  • 2. Set up a payment gateway if you want to take your website to the next level and receive more clients.
     If you have a business web host, you may already have a payment gateway access; otherwise you may need to ask your web host for this service or locate some other modes to integrate this into your site.
  • Integrate a Payment Gateway Into a Website Step 3.jpg
  • 3. Get what you need for the integration of payment gateway. The process of payment gateway integration requires some effort. This is one of the software applications that needs to be stored on the user’s server. It means that a user may require a little more disk space and bandwidth.
    • Check all the requirements of the software to ensure that your present hosting package can handle the development in technical requirements.Integrate a Payment Gateway Into a Website Step 4.jpg
    • 4. Ensure that the Internet Payment Gateway is compatible with all programming languages that are used on e-commerce sites. Check if you are making use of one of the following programming languages:
      • Visual Basic.Net
      • PHP
      • Perl/CGI
      • ASP.Net or ASP

How do I give my WordPress site an ‘MOT’? – 10 ways

WordPress is the most popular web platform globally and is generally a solid secure platform but as an open source application it is potentially vulnerable to attack. As we wrote recently in this blog the recent botnek attack was one such instance and the corrective action was easy to implement – change your username from admin and create a more secure password. Should you be worried by these attacks on WordPress? No – by regularly checking and maintaining your WordPress site, as you should do with a car – for example,  you will protect yourself from cyber attacks and be able to implement best practice maintenance for your WordPress site.  Below is a list of 10 ways in which you can give your site an ‘MOT’:
  1. WordPress Updates -  When WordPress updates are released update your site promptly. You will receive a notification when you log into the back end of your site.
  2. Plugin updates – When all plugins, themes and scripts are updated – update these quickly.  You will receive a notification when you log into the back end of your site. 
  3. Backup your site every night.
  4. Conduct regular automatic scans to detect vulnerabilities and infections.
  5. Create a clear defined recovery process and be ready to execute it.
  6. Use an automated tool to let you know the site is down, before your customers do – e.g. Pingdom
  7. Use Cloud Servers to host your site and to control the performance of your site. Note – Use Pingdom to test your sites performance against similar sites on the web. Most WordPress sites in typical hosting sites are significantly below average.
  8. Distribute your access globally
  9. Use Amazon S3 to store images – this is optimised for large image distribution
  10. Install a cache plugin to deliver significant speed increases.

A Home Group icon has appeared on my desktop, why?

To remove the Home desktop Group icon, you need to manually modify some registry key:

1. Open notepad and then copy the following text (without ===) into it.

================================
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
"{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93}"=dword:00000001
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu]
"{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93}"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel]
"{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93}"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu]
"{B4FB3F98-C1EA-428d-A78A-D1F5659CBA93}"=dword:00000001
===========================================
2. Save the txt file and rename to xxx.reg. Then double click xxx.reg to import the registry key.

Thursday, 20 February 2014

What is Cloud Computing

Cloud computing is a type of computing that relies on sharing computing resources rather than having local servers or personal devices to handle applications.
In cloud computing, the word cloud (also phrased as "the cloud") is used as a metaphor for "the Internet," so the phrase cloud computing means "a type of Internet-based computing," where different services -- such as servers, storage and applications -- are delivered to an organization's computers and devices through the Internet.
Cloud computing is comparable to grid computing, a type of computing where unused processing cycles of all computers in a network are harnesses to solve problems too intensive for any stand-alone machine.



Cloud Computing Applications

The applications of cloud computing are practically limitless. With the right middleware, a cloud computing system could execute all the programs a normal computer could run. Potentially, everything from generic word processing software to customized computer programs designed for a specific company could work on a cloud computing system.
Why would anyone want to rely on another computer system to run programs and store data? Here are just a few reasons:
  • Clients would be able to access their applications and data from anywhere at any time. They could access the cloud computing system using any computer linked to the Internet. Data wouldn't be confined to a hard drive on one user's computer or even a corporation's internal network.
  • It could bring hardware costs down. Cloud computing systems would reduce the need for advanced hardware on the client side. You wouldn't need to buy the fastest computer with the most memory, because the cloud system would take care of those needs for you. Instead, you could buy an inexpensive computer terminal. The terminal could include a monitor, input devices like a keyboard and mouse and just enough processing power to run the middleware necessary to connect to the cloud system. You wouldn't need a large hard drive because you'd store all your information on a remote computer.
  • Corporations that rely on computers have to make sure they have the right software in place to achieve goals. Cloud computing systems give these organizations company-wide access to computer applications. The companies don't have to buy a set of software or software licenses for every employee. Instead, the company could pay a metered fee to a cloud computing company.
  • Servers and digital storage devices take up space. Some companies rent physical space to store servers and databases because they don't have it available on site. Cloud computing gives these companies the option of storing data on someone else's hardware, removing the need for physical space on the front end.
  • Corporations might save money on IT support. Streamlined hardware would, in theory, have fewer problems than a network of heterogeneous machines and operating systems.
  • If the cloud computing system's back end is a grid computing system, then the client could take advantage of the entire network's processing power. Often, scientists and researchers work with calculations so complex that it would take years for individual computers to complete them. On a grid computing system, the client could send the calculation to the cloud for processing. The cloud system would tap into the processing power of all available computers on the back end, significantly speeding up the calculation.
While the benefits of cloud computing seem convincing, are there any potential problems? Find out in the next section.

What is Cloud Computing Architecture?

When talking about a cloud computing system, it's helpful to divide it into two sections: the front end and the back end. They connect to each other through a network, usually the Internet. The front end is the side the computer user, or client, sees. The back end is the "cloud" section of the system.
The front end includes the client's computer (or computer network) and the application required to access the cloud computing system. Not all cloud computing systems have the same user interface. Services like Web-based e-mail programs leverage existing Web browsers like Internet Explorer or Firefox. Other systems have unique applications that provide network access to clients.
On the back end of the system are the various computers, servers and data storage systems that create the "cloud" of computing services. In theory, a cloud computing system could include practically any computer program you can imagine, from data processing to video games. Usually, each application will have its own dedicated server.
A central server administers the system, monitoring traffic and client demands to ensure everything runs smoothly. It follows a set of rules called protocols and uses a special kind of software called middleware. Middleware allows networked computers to communicate with each other. Most of the time, servers don't run at full capacity. That means there's unused processing power going to waste. It's possible to fool a physical server into thinking it's actually multiple servers, each running with its own independent operating system. The technique is called server virtualization. By maximizing the output of individual servers, server virtualization reduces the need for more physical machines.
If a cloud computing company has a lot of clients, there's likely to be a high demand for a lot of storage space. Some companies require hundreds of digital storage devices. Cloud computing systems need at least twice the number of storage devices it requires to keep all its clients' information stored. That's because these devices, like all computers, occasionally break down. A cloud computing system must make a copy of all its clients' information and store it on other devices. The copies enable the central server to access backup machines to retrieve data that otherwise would be unreachable. Making copies of data as a backup is called redundancy.
What are some of the applications of cloud computing? Keep reading to find out.