PayPal is an international payment gateway allowing businesses and individuals to transfer funds in a secure manner over the Internet. Using PayPal to accept payments has several advantages for online merchants: It is a recognized brand when it comes to Business to Consumer (B2C) transactions, creating a business account with PayPal is easier (and faster) than opening the merchant account required to accept credit card payments directly, and finally, because PayPal lends its name to the transaction, customers may feel more comfortable entering into a transaction with a previously unknown merchant. That being said, however, PayPal's transaction dispute system requires a tracking number from a shipped package to respond to a customer dispute. If the product is purely electronic (a download or access to a site, for example), your response to disputes will be quite limited.
Several of the API examples shown in this chapter make use of the cURL and OpenSSL libraries, which are not compiled into PHP by default. Please see Appendix C for more information on how the development box was configured to include these libraries.
This chapter covers the following:
An overview of the PayPal API
PayPal's development sandbox
How to accept payment via PayPal with a payment badge
Encrypting the transaction
Instant Payment Notification
How to search and retrieve transaction details
How to issue refunds
How to use the MassPay feature