Making a Better PHP Library for Google Checkout

Google Checkout LogoLong before Google had produced their own [PHP example code]( for [Google Checkout](, I had the need to create my own. It was a library based upon the idea of keeping e-commerce online simple. My goal was to make it possible to implement a server and to persist transactional and order state information in a database with very little code. I would like to think I have succeeded. Take for example, the following code sample:
if ($code) {
$discount = Discount::findByCode($code);
function doOrderStateChangeNotification($request,$response) {
if ($request->financialState() == “CHARGED”) {
// do something
Then in a separate file, we’ll call it `server.php`, you would need:
$server = new MySQLGoogleCheckoutServer();
print $server->handlePost();
And that’s all you have to do to create a simple server capable of recording a new purchase in your system and then keeping the state of that purchase up to date. The library offers a number of other capabilities as well depending upon your unique purchasing workflow and policies. From this server you can also issue commands to Google, to refund, cancel or archive an order for example.
I am continuing my work to document the library more completely, and to provide a more robust set of examples. In the meantime, I thought others might find this library useful and might also want to help me in its testing and development. The library is available for *free* under an open source license (BSD). [Download]( “My PHP Google Checkout” and learn more by visiting its [project homepage](
If you have questions or need specific [documentation]( please let me know. I will use this feedback to help me prioritize what to work on next.


3 Comments on “Making a Better PHP Library for Google Checkout”

  1. tech news says:

    thank you for sharing this information.

  2. abbas says:

    thanks for your aerticle.
    where is MySQLGoogleCheckoutServer.php ?
    my site is:

  3. Dinheiro says:

    Thank you for sharing this information.
    Thanks a lot!

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s