Introduction: Hacks #87-100

PayPal's Web Services application programming interface (API) is the means by which you can interface directly with the PayPal platform to build applications and web sites that leverage features on the PayPal web site. Essentially, this means that you can integrate your order-processing and customer-service systems with the payment information stored on the PayPal web site.

No longer are you bound by the patchwork services afforded by services like Instant Payment Notification (IPN) [Hack #65] and Payment Data Transfer (PDT) [Hack #85] . Instead, the API provides a more seamless link between your application and the PayPal engine, allowing you to write slick, robust order-processing applications to help grow your business.

Currently, you cannot use PayPal's API to process credit card payments directly from your site. Your customers must still visit the PayPal web site to send payments to you, but you can subsequently use the API to retrieve the details about such payments, including those funded by credit cards.

The geek-impaired might not immediately see the benefit of writing more code to essentially duplicate the functionality that exists on the PayPal web site, but here are some specific benefits to consider:

  • Individual merchants can automate administrative tasks they do repeatedly.

  • Large merchants who conduct thousands of transactions a day no longer have to log into PayPal to review their transactions, view specific transaction details, or perform refunds [Hack #91] . This allows customer care representatives to work more efficiently.

  • Third parties can provide solutions to small or large businesses. Some solutions require customers to pay via the PayPal web site, but you can provide some services in which PayPal is never seen by the user. Therefore, you can make it appear as if you are providing the payment service (e.g., Mass Pay [Hack #96] . In addition, most of the administrative PayPal functionality can remain on your site.

You might be wondering at this point exactly how API, IPN, and PDT differ. In simplest terms, IPN and PDT are notifications initiated by PayPal (in the form of web requests) that let your server know when a transaction has completed. The API, on the other hand, is initiated by you and allows you to execute core PayPal functions from your application, whenever and however you like. These technologies can be used together for further automation.

Due to security concerns, the API is limited to a subset of the things you can do on the PayPal site. Specifically, you can do the following things:

  • Search for a transaction with the date, name, email, and other parameters [Hack #94] .

  • Retrieve the details of a single transaction [Hack #93], given the PayPal transaction ID.

  • Refund a payment [Hack #91] (in full, or partially).

  • Make payments from your account to other accounts using PayPal's Mass Pay service [Hack #96] .

A little programming experience will be extremely helpful in making use of the hacks in this chapter, most of which were written for Visual Studio .NET. See the "Database Coding and Platform Choices" section of the Preface for more details.

Most of the API functionality is usable by merchants as is, but there are ways to extend the basic functionality to do wonderful things that will make people mumble your name as you walk valiantly by?which is the point of this book anyway, isn't it?