Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
eBay Commerce Cookbook Files
PHP Objective-C
branch: master


Updated Code Examples section description.
latest commit fc6adbe90a
@cahudson authored

eBay Commerce Cookbook:

Using eBay APIs: PayPal, Magento and More

eBay Commerce Cookbook

This is the source code repository for the eBay Commerce Cookbook. The repository contains all code for the 15 recipes / examples in the text so that you can download and run the examples more easily. If you find any errors or issues please let me know and I will do my best to update the examples.

Note that the examples were written over the course of the 2012 calendar year so as the various APIs employed are improved or modified the examples may need to be updated to follow any changes. Also note, as the title implies the cookbook is designed to highlight APIs from various eBay owned sites and properties. However the basic premise to each example for improving a commerce lifecycle can be applied using eBay APIs, other APIs, or your own homegrown code. In any of the cases I hope that the examples provide some benefit and spark some methods of differentiating your commerce flow.

If you have a good idea that results or just in general and want to share feel free to contact me. I always love to hear how people are creating new "mashes" and creating new paradigms in commerce!

Either way, have a blast with e, m, s, and x commerce! - Chuck


The book is called eBay Commerce Cookbook: Using eBay APIs: PayPal, Magento and More and is published by O’Reilly Media (Electronic - December 20, 2012, Print - January 4, 2013). It is available in Paperbook, Ebook, Kindle and via Safari Books Online.

You can inspect the source code and make improvements to it. If you want to contribute, please do so! Fork it, hack on it, and send back your changes! If you want to support the work further and read the full text on each example, you can do so by buying a copy of the book in digital or printed form.


The book consists of five chapters, each consisting of three recipes / examples, following a simplified commerce life cycle. The simplified commerce life cycle is not meant to be specific ecommerce, mcommerce, or scommerce but could represent any one of these commerce life cycles (and thus the over simplification). I have tried to involve the most common formats of commerce in the examples while incorporating newer technologies and APIs. Below is a breakdown of the chapters.

1Product Discoveryprovides examples covering the mapping of product availability to location using Milo, listing your products on eBay, and incorporating product reviews from eBay into your site.
2Product Presentationprovides examples including customizing the Magento storefront, personalizing a store experience with PayPal Access, and presenting similar items from eBay.
3Purchaseprovides examples including autogenerating coupons with Magento, payment preapproval, and donating on checkout with PayPal Adaptive Payments.
4Order Fulfillmentprovides examples covering shipping form creation with PayPal Instant Payment Notifications, shipping method extensions with Magento, and multiple supplier payment with PayPal chained payments.
5Consumption and Sharingincludes examples on facilitating social recommendations with QR codes, generating taste graphs and recommendations via Hunch, and social sharing using mashups through

The chapters are based on the stages in a simplified commerce lifecycle as shown in the image below.

Simplified Commerce Lifecycle

Code Examples - Recipes

In the book each example is documented fully with a challenge being solved, potential solution, and steps to setting up the example. The folders here follow the example numbering convention of the book, chapter number followed by example number in the chapter.

In the tables below you will find a detailed list of the examples by chapter, including the primary API used and a brief description. In this way you can seek out a specific example of a certain API if needed.

Chapter 1 - Product Discovery and Research
1.1Tapping into Product ReviewseBay ShoppingDisplay product reviews from eBay users based on a specific product and the eBay Shopping API.
1.2Mapping Product AvailabilityMiloMap onto Google Maps availability and stores for a specific product using the Milo API.
1.3Presenting Products through eBayeBay TradingDisplay products from eBay using the eBay Trading API.
Chapter 2 - Product Presentation
2.1Customizing a Magento StorefrontMagentoAdd in Facebook like / use integration in your Magento storefront with a Facebook App, X.Commerce messaging and Magento community edition. No code required.
2.2Personalizing a Store ExperiencePayPal AccessProviding an alternate sign in with a trusted third party, PayPal, incorporating the PayPal Access / Identity offering.
2.3Presenting Similar ItemseBay MerchandisingPresent similar items to a specific item from eBay using the eBay Merchandising API.
Chapter 3 - Enhancing the Payment Experience
3.1Autogenerating CouponsMagentoWrap the new Magento autogeneration of coupons to create a REST API for creating coupons dynamically. No code required
3.2Preapproval PaymentsPayPal AdaptiveUsing PayPal Adaptive Payments to provide preapproved payment solutions where customers can preapprove future payments.
3.3Giving Back at CheckoutPayPal AdaptiveProvide a way to give to charities directly in a single sales transaction using the PayPal Adaptive Payments parallel payment model.
Chapter 4 - Order Fulfillment
4.1Just-in-Time Shipping FormsPayPal IPNCreate in real time, shipping forms from PayPal Instant Payment Notifications for goods purchased.
4.2Simple Shipping ExtensionMagentoAdd your own shipping extension with personalized shipping methods and cost formulas into Magento.
4.3Multiple Supplier FulfillmentPayPal AdaptiveLeverage the PayPal Adaptive Payments offering to create a chained payment model for paying multiple vendors in a single transaction.
Chapter 5 - Consumption and Sharing
5.1Sharing with QR CodesRedLaserDynamically create QR codes for products with the Google API and then leverage the RedLaser API in an iPhone app to scan the code and launch a Scan It, Share It page.
5.2Creating a Taste GraphHunchUse the Hunch API to create a personalized taste graph based on a purchase of a product and a customer's twitter username.
5.3Social Recommendationsql.ioUse to aggregate three separate API calls to create personalized social recommendations from Hunch and eBay.

API Usage

There are at least a dozen different API sets used through out the examples of the book. Each of the APIs have special licensing and terms of usage. It is of course your responsibility to determine any requirements for your project based on the licensing terms. Below is a list of the core APIs employed linked to the documentation of the APIs. Where applicable the limits and key terms have been included in the book, however the various third party API owners may change these at anytime so it is recommeneded that you verify with any provider that you may be incorporating.

eBay Merchandising API eBay Shopping API eBay Trading API Google Infographics QR Codes Hunch Magento Milo PayPal Access PayPal Adaptive Payments PayPal Instant Payment Notification (IPN) RedLaser

Using Code Examples

The examples provided in the book and posted here were designed to help you get your job done. In general you may use the code examples in your programs and documentation, but of course the code comes without warranty and you should take all means to "productize" the code for your specific project. You do not need to contact O'Reilly for permission unless you’re reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from this book does not require permission. Selling or distributing a CD-ROM of examples from O’Reilly books does require permission. Answering a question by citing this book and quoting example code does not require permission. Incorporating a significant amount of example code from this book into your product’s documentation does require permission.

We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN. For example: “eBay Commerce Cookbook by Charles Hudson (O’Reilly). Copyright 2013 Charles Hudson, 978-1-4493-2015-7.”

If you feel your use of code examples falls outside fair use or the permission given here, feel free to contact O'Reilly Media at

Contributions and Updates

The world of technology is changing at a rocket pace and trying to keep up with more than a dozen different APIs can be challenging. If you find a new update or change please let me know. I will review and include in any updates if appropriate. As well it may get posted here or on the O'Reilly Media book discussion area. In either case not only will I benefit from the new information but everyone else following along. Have fun mashing together the various APIs.

We encourage you to fork our work and make your own improvements under the terms of the license. If you have any changes you want to send back our way, please make a regular pull request via Github. If the authors like your changes, they may integrate them into the official book and give you a credit in the next edition. If you just have an issue to report, please use the regular Github issue system.

Book Details

Paperback Version:
Title: eBay Commerce Cookbook
Paperback: 208 pages
Publisher: O'Reilly Media (January 4, 2013)
Language: English
ISBN-10: 1449320155
ISBN-13: 978-1449320157
Kindle Version:
Title: eBay Commerce Cookbook
File Size: 6125 KB
Print Length: 208 pages
Simultaneous Device Usage: Unlimited
Publisher: O'Reilly Media; 1 edition (December 20, 2012)
Sold by: Amazon Digital Services, Inc.
Language: English
Other formats:
Ebook, Safari Books Online

O'Reilly Animal

Mississippi Kite (Ictinia mississippiensis)

Mississippi Kite

"The Mississippi Kite (Ictinia mississippiensis) is a small bird of prey in the family Accipitridae. It is 12 to 15 inches (30–37 cm) beak to tail and has a wingspan averaging 3 feet (91 cm). Weight is from 214 to 388 grams (7.6-13.7 oz).[1] Adults are gray with darker gray on their tail feathers and outer wings and lighter gray on their heads and inner wings. Males and females look alike, but the males are slightly paler on the head and neck. Young kites have banded tails and streaked bodies.[2] Mississippi Kites have narrow, pointed wings and are graceful in flight, often appearing to float in the air. It is not uncommon to see several circling in the same area. Their diet consists mostly of insects which they capture in flight. They eat cicada, grasshoppers, and other crop-damaging insects, making them economically important. They have also been known to eat small vertebrates, including amphibians, reptiles, mammals, and occasionally birds. Their call is a high-pitched squeak, sounding similar to that of a squeaky dog toy." - - Mississippi Kite - Mississippi Kite

Something went wrong with that request. Please try again.