Preface
There has never been a better time to have a keen interest in commerce. The Web has truly accelerated globalization and connected us all through a common network. Information can now be shared at mind-boggling rates, and entrepreneurs everywhere can truly reach a global audience if theyre clever (and sometimes lucky) enough to supply the market with what it demands. However, this is old news. Back in the mid-1990s, not long after the Internet officially birthed the Web, buyers and sellers could already transact through eBay, and PayPal soon arrived as the de facto way for money to change hands with the least amount of friction. Fast forward a decade or so, and a lot of exciting things have happened. eBay acquired PayPal back in 2002, and while PayPal continues to be the preferred way to exchange money on eBay, it has since evolved into a powerful platform that offers a vast number of API-based products that allow you to monetize your ideas as seamlessly as possible. If youre interested in tapping into these tremendous possibilities, this book is for you. As an Up and Running title, it doesnt provide complete or exhaustive documentation on all of PayPals products or even provide very specific direction on handling some of the most common idiosyncrasies that you might encounter. However, it does aim to present some of the most popular products in fully integrated realistic scenarios with sample project code that you can study and adapt for your particular needs. As the title suggests, this book is designed to get you up and running; it is not a definitive guide.
Each chapter focuses primarily on the topic of integrating commerce payment flows into a reference application thats provided in . While one viable approach to demonstrating the integration of PayPal products might have been to introduce a distinct sample application in each chapter, a pragmatic decision to use a single application as a foundation and customize it in various ways according to the content of each chapter was chosen instead. This approach hopefully has the virtues of the sample application being sophisticated enough that its realistic, fun, and useful, while still allowing each chapter to stand alone and be as atomic and instructive as possible.
Notes About the Second Edition
The first edition version of this book, authored by Michael Balderas, essentially presented a consolidation of PayPals online documentation and PHP sample code that focused on using the Name-Value Pairs (NVP) APIs for accessing a variety of the most commonly used PayPal products such as Express Checkout, Website Payments Pro, and Adaptive Payments. This edition builds upon that importantalbeit fairly abstractfoundation with expanded content, including additional coverage on the exciting new Express Checkout for Digital Goods product and Instant Payment Notifications (IPNs), and includes accompanying sample project code that concretely pulls it all together with a realistic web application. As such, a primary goal of this book is to present PayPal products in a fairly standalone, chapter-by-chapter fashion with the key concepts for integrating each product fully implemented as a sample project. Like any other book, this book tells a coherent (and hopefully enjoyable) story from cover to cover. Although you should be able to skip directly to content of interest with minimal difficulty, youll get the greatest benefit if you at least skim the entire book before hopping around too much. Appropriate references will be included to any foundational content from previous chapters as needed.
Intended Audience
This book is for any programmer who wants to accept payments for their goods or services through PayPal by using some of PayPals most popular products. You might be a multimillion-dollar corporation, an individual with an open source project looking to accept donations, a nonprofit requesting donations to help a cause, or a software developer writing mobile apps for cell phones. Regardless, PayPal can provide you with solutions, no matter who you are or how much monetary volume youre processing. The code samples in this book are provided as Python web applications that can be deployed on Google App Engine (GAE) with minimal fuss. Python code is inherently highly readable, and reasonable efforts are made to keep it that way versus using any advanced syntax or nonintuitive Python idioms. Furthermore, the code for the sample web applications has been kept as austere and clear of common Python dependenciessuch as Djangoas possible so that it is as universally reusable and portable to other languages as possible.
The official Python tutorial is worth perusing if this is your first encounter with Python; however, you really dont need to actually do any Python programming to benefit from this book. The source code and inline comments should be clear enough that its a fairly trivial exercise for you to port them to your programming platform of choice, and the choice of NVP APIs for PayPal interaction ensures that the payment flows are inherently trivial to understand if you have any programming experience.
How This Book Is Organized
Here is a brief summary of the chapters in the book and what you can expect from each:
Provides a 10,000-foot overview of interacting with PayPal APIs as web services and introduces GAE, the primary development platform thats used throughout the book.
Showcases Express Checkout, PayPals premier checkout solution, and demonstrates how to implement a basic Express Checkout payment flow for Tweet Relevance.
Teaches you how to tailor and improve the Express Checkout flow established in the previous chapter as an Express Checkout for Digital Goods payment flow.
Introduces Adaptive Payments and shows you how to implement an Adaptive Payments checkout flow for Tweet Relevance in which funds are sent to multiple recipients.
Teaches you how to accept credit cards directly from your site using Website Payments Pros Direct Payment option as a checkout option for Tweet Relevance.
Demonstrates how to use Instant Payment Notifications (IPNs) to handle custom actions associated with a payment, such as sending a confirmation email to a customer when a purchase is completed.
Introduces Tweet Relevance, the foundational reference application thats used throughout the book as a baseline project.