What is Payment Gateway integration? A payment gateway can be defined as a third party service, which is a combination of hardware and software that provides an interface to the bank credit card processing network. The credit card information is collected and is transferred over the Internet to the credit card processors in the encrypted format for transaction purpose. Some well-known payment gateways are AuthorizeNet, Google Checkout, USAePay, Verisign and Paypal.
What is google checkout?
- Using Google checkout buying from stores across the web becomes simple and also facilitates you to keep track of all the orders.
- The Google Checkout’s fraud protection policy protects you against all the unauthorized purchases made via Google Checkout. Another advantage is that the Google Checkout does not share the history of the purchasers with other sellers.
- With Google checkout your email is well protected and is kept confidential. Tracking down your purchase history list is also simple.
Methods to Integrate with Google checkout: Google checkout Provides three different types of integration methods
Buy Now Buttons (Provided by Google Checkout)
Valid e-Commerce Partners
Google Checkout API (Code Integration with Google Checkout) 1) Buy Now Buttons If you do not require the shopping card functionality, you can simply integrate with Google Checkout using the Google checkout Buy Now buttons. You can have these buttons be displayed next to the products you are selling by just adding the Google checkout’s HTML code to your website. Visitors/Buyers who click this button will be automatically directed to the secure Google Checkout page where they can complete their purchase.
Integration requirements: You have a working knowledge of your website's HTML 2)e-Commerce Partners If your shopping card application is being provided by one of the Google checkout’s partners, you can simply integrate your shopping cart and order processing functionalities with Google Checkout.
Integration requirements: You have a shopping cart provided by an valid e-commerce partner.
3)Google Checkout API Integrating our website which has shopping cart and order processing system via the Google Checkout API (Sample Codes) is a simple process.
The Google Checkout API is available in the following Codes:
- ASP (Active Server Pages)
- .Net (Visual Studio .Net)
- PHP (Hypertext Preprocessor)
- Java 1.5
- Java 1.4
Integrating with Google checkout by using the Google Checkout API with PHP can be seen in the Sample Code. You can download the Sample code provided by the Google Checkout API (PHP) from here » PHP Sample Code
**Before going to use the Sample code provided by Google checkout you need to check the following configuration settings are available in your PHP server. 1) PHP Version- PHP v4.3.0 or later (But Not greater or equal to PHP 5.0, because Current Google checkout API codes supports only the Lower versions of PHP 5.0).
2)CURL - libcurl v7.9.0 or later libcurl is an implementation of CURL (PHP supports libcurl, that allows you to connect and communicate to many different types of servers by using different protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols), which allows you to send XML over HTTPS using server-to-server HTTP POST requests.
3)libxml-2.4.14 or later. libxml installs a DOM XML library (This Dom XML library is used to parse and construct the XML Messages).
Some Important PHP Library Files provided by the Google Checkout
- GlobalAPIFunctions.php - This library contains functions
that are used to communicate with multiple Google Checkout APIs.
Some Important Functions are
- GetMerchantID - The GetMerchantID function returns
your Google Checkout merchant ID ( You can get this Merchant ID by Registering as a Merchant with the Google Checkout). - GetMerchantKey - The GetMerchantKey function
returns your Google Checkout merchant key ( You can get this Merchant key by Registering as a Merchant with the Google Checkout) - CalcHmacSha1 -The CalcHmacSha1 function uses
a checkout shopping cart XML file, which contains information about an order, and your merchant key to compute a cryptographically secure HMAC-SHA1 value
- SendRequest - The SendRequest function verifies
that you have provided values for all of the parameters needed to send a Google Checkout or Order Processing API request.
- ResponseHandlerAPIFunctions.php - This library contains
functions that handle synchronous responses that Google Checkout sends in response to your API requests. Some Important Functions are
- ProcessXmlData - The ProcessXmlData function creates a DOM object representation of the XML document received from Google Checkout
- ProcessRequestReceivedResponse - The ProcessRequestReceivedResponse function receives a synchronous Google Checkout response to an API request originating from your site.
- ProcessErrorResponse - The ProcessErrorResponse function receives a synchronous Google Checkout response to an API request originating from your site.
- CheckoutAPIFunctions.php - This library contains
functions for systematically building XML documents that can be included in Google Checkout Checkout API requests Some Important Functions are
- CreateItem - The CreateItem function constructs the XML for a single
- in a shopping cart(Here we have to list our each products as a item) .
- CreateShoppingCart - The CreateShoppingCart function constructs the XML for the element in a Checkout API request.
- CreateCheckoutShoppingCart - The CreateCheckoutShoppingCart function returns the XML structure, which contains all of the items and checkout-related information for an order.
The Screen Shots for the Google Checkout Integration For an Online Event Registration 1) Your Cart
2) Sign in to Google Checkout
3) Review & Place Your Order
4) Thanks Page
A Sample Shoping Cart with Google Checkout Button
Your Sample Cart Page
Return top After Pressing the Google Checkout Button, You will get the Following Sign in Page
Sign in to Google Checkout In This below page you can view two different items
1) The Event name (The event which you need to book online)
2) The Service Charge (The Service Charge Amount for the Particular Event Ticket)
In this Page if you are an already existing user, You will given your Email address as user name and your password to login into the Review & Place the Order page. Else you will have a provision to enter your Credit card details and need to create an account with the Google checkout.
Return top After Successful Register/Sign up You will get the Following page
Review & Place Your Order
In This Review & Place order page you will confirm your Order details and Place your order. After the Successful Placement of order, A copy of your order will be emailed to the Merchant and also a copy to the person who place the order.
An Additional feature available in the Google Checkout is an copy will be stored in your Purchase history list.
Return top
Thanks Page
After Pressing the Place order button you will get the following page
Return top
Vital Informations needed to Configure the Google Checkout **
- PHP Version- PHP v4.3.0 or later
- CURL - libcurl v7.9.0 or later
- libxml-2.4.14 or later.
- SSL Certificate ** - If you are an merchant, and needed to calculate the Order Status after the Order Placement means you need to Install SSL Certificate (Secure Socket Layer,This is a certificate which is installed on a secure server. It is used to identify the merchant using it and to encrypt the credit card) in your server and place a php file to Capture the Response from the Google Checkout.
Sample Merchant Calculation Coding to Capture the Response Acknowledgement from the Google Checkout for the Every order. // Retrieve the XML sent in the HTTP POST request to the ResponseHandler
$xml_response = $HTTP_RAW_POST_DATA;
Get rid of PHP's magical escaping of quotes
if (get_magic_quotes_gpc()) {
$xml_response = stripslashes($xml_response);
// Capture the Return Response XML from the Google Checkout.
fnWriteXml($xml_response);
}
function fnWriteXml($string){
$file="ssl_return.txt";
if(file_exists($file)) {
$fileid = fopen($file,"a");
$strmsg = ""; $strmsg.= "***************************************************\r\n";
$strmsg.=$string;
$strmsg.="\r\n***************************************************\r\n";
fwrite($fileid,$strmsg); fclose($fileid); }else{
$fileid = fopen($file,"a");
$strmsg = $string;
fwrite($fileid,$strmsg);
fclose($fileid);
} }
By Downloading the file ssl_return.txt you will get the Response XML From the Google Checkout.Parse the Response XML, according to your needs and manipulate the Merchant Calculation Codings. Functional Definitions : stripslashes - Returns a string with backslashes stripped off.(\' becomes ' and so on.) Double backslashes are made into a single backslash. get_magic_quotes_gpc() - Gets the current active configuration setting of magic quotes. fopen - This key word is used to open the specified file in the Specified server path If the open fails, the function returns FALSE. for Example : fopen("sample.txt","a");
Here the First argument is the File name and the second one is the File open mode type. Some of the File open mode types are('r'-Read only, 'r+'- Reading & Writing, 'w'- Writing only, 'w+' - Reading & writing,'a'- Append writing only,'a+'- Reading & Append Writing only) file_exists- Returns TRUE if the file specified by filename exists; else it returns FALSE. * This function will not work on remote files; fwrite - it writes the contents of string to the file stream pointed to by fp. If the length argument is given, writing will stop after length bytes have been written or the end of string is reached, whichever comes first. fclose- The file pointed to by fp is closed. Returns TRUE on success, FALSE on failure.
courtsy: http://www.macronimous.com |
No comments:
Post a Comment