You are previewing PayPal Hacks.
O'Reilly logo
PayPal Hacks

Book Description

If you've bought or sold items through eBay, or through hundreds of other online sites, then you're familiar with PayPal, the online payment service. With PayPal, a valid email address, and a credit card or bank account, you can easily send and receive payments online. Not a bank or financial institution itself, PayPal describes its service as one that builds on the financial infrastructure of bank accounts and credit cards, and using advanced propriety fraud prevention systems, creates a safe, global, real-time payment solution. Put simply, PayPal provides the means for people to conduct financial transactions online, instantly and securely. But there's more to PayPal than meets the eye. PayPal Hacks shows you how to make the most of PayPal to get the most out of your online business or transactions. Authors Shannon Sofield of Payloadz.com and PayPal evangelist David Nielsen guide you through the rigors of using and developing with PayPal. Whether you're building an ecommerce site using PayPal as a transaction provider, or simply trying to pay for an eBay auction without getting burned, PayPal Hacks will give you the skinny on this leading global online payment service. The collection of tips and tricks in PayPal Hacks shows you how to find or even build the right tools for using PayPal to buy and sell on eBay or as a transaction provider for ecommerce on your own site. Written for all PayPal users, from those just starting out to those developing sophisticated ecommerce sites, this book begins with the basics such as setting up your account, then moves quickly into specific tips and tools for buyers, sellers, and developers. With PayPal Hacks, you can:

  • Learn extra steps to help protect yourself while buying or selling on eBay

  • Save time and money with advanced tips and undocumented features

  • Learn dozens of easy-to-follow procedures to help you request and receive payments and fill orders

  • Use PayPal to handle subscriptions, affiliate systems, and donations

  • Create and customize your customers' checkout process

  • Effortlessly integrate PayPal's shopping cart system into your own website

  • Implement digital fulfillment with Instant Payment Notification (IPN) and Payment Data Transfer (PDT)

  • Develop and distribute ecommerce applications with the PayPal API

Each hack consists of a task to be accomplished or a creative solution to a problem, presented in a clear, logical, and task-oriented format. PayPal Hacks provides the tools and details necessary to make PayPal more profitable, more flexible, and more convenient.

Table of Contents

  1. Special Upgrade Offer
  2. A Note Regarding Supplemental Files
  3. Credits
    1. About the Authors
    2. Contributors
    3. Acknowledgments
      1. Shannon Sofield
      2. Dave Nielsen
      3. Dave Burchell
  4. Preface
    1. Why PayPal Hacks?
    2. Getting Started with the Code in This Book
      1. Server-Side Scripting
      2. Client-Side (Browser) Scripting
      3. Desktop Applications
    3. Database Coding and Platform Choices
    4. Further Study
    5. How to Use This Book
    6. How This Book Is Organized
    7. Conventions Used in This Book
    8. Using Code Examples
    9. How to Contact Us
    10. Got a Hack?
  5. 1. Account Management
    1. Introduction: Hacks #1-9
    2. 1. Create a PayPal Account
    3. 2. Verify Your PayPal Account
      1. 1.3.1. Add a Bank Account
      2. 1.3.2. Confirm an Account and Get Free Cash
    4. 3. Confirm Your Mailing Address
      1. 1.4.1. Expanded Use Enrollment
      2. 1.4.2. Confirming a Second Address
    5. 4. Pay When You’ve Forgotten Your Password
    6. 5. Restore Your Account if It Has Been Limited
      1. 1.6.1. Filing an Appeal
      2. 1.6.2. A Last Resort
      3. 1.6.3. Avoiding Suspicion
      4. 1.6.4. See Also
    7. 6. Create a Separate Login for Each Employee
      1. 1.7.1. Adding a New User
      2. 1.7.2. Setting Privileges
      3. 1.7.3. Adding an Administrative Account
      4. 1.7.4. Responding if Something Goes Wrong
    8. 7. Access Member Information
      1. 1.8.1. Looking Up a User’s Status
      2. 1.8.2. Understanding the User Status
      3. 1.8.3. Checking Your Reputation as a Seller
      4. 1.8.4. Checking Your Reputation as a Buyer
    9. 8. Manage PayPal Email
      1. 1.9.1. Setting Up Multiple Email Addresses
      2. 1.9.2. Using Different Email Addresses
      3. 1.9.3. Filtering Your Incoming Email
      4. 1.9.4. Setting Notification Preferences
    10. 9. Get Help from PayPal
      1. 1.10.1. Email Support
      2. 1.10.2. Telephone Support
      3. 1.10.3. Support Forums
      4. 1.10.4. eBay University
  6. 2. Making Payments
    1. Introduction: Hacks #10-16
    2. 10. Send Money to Anyone
      1. 2.2.1. Sending a Payment via Email
      2. 2.2.2. What If They Don’t Sign Up?
    3. 11. Choose How to Fund Payments
      1. 2.3.1. Overriding the Funding Source Hierarchy
      2. 2.3.2. eBay-only Payment Methods
      3. 2.3.3. Buying from Outside the USA
    4. 12. Use Your PayPal Funds Anywhere
    5. 13. Pay from a Cell Phone
      1. 2.5.1. Sending Money
      2. 2.5.2. Checking the Payment
      3. 2.5.3. Requesting Payment with a Text Message
    6. 14. Pay Seller Fees when Buying
      1. 2.6.1. Calculating the Fees Yourself
      2. 2.6.2. Covering the Recipient’s Fees Using Mass Pay
    7. 15. Send Money Without Creating a PayPal Account
    8. 16. Dispute Merchandise Payments
      1. 2.8.1. PayPal Buyer Protection
      2. 2.8.2. Buyer Protection Etiquette
      3. 2.8.3. Can I Get My Money Back?
        1. 2.8.3.1. Does PayPal just take the buyer’s word?
        2. 2.8.3.2. What does significantly “not as described” mean?
        3. 2.8.3.3. Where does the refund come from?
        4. 2.8.3.4. What happens to bad sellers? I want justice!
  7. 3. Selling with PayPal
    1. Introduction: Hacks #17-27
    2. Upgrade to Business Class
    3. Set Your Payment Receiving Preferences
    4. Identify Yourself to Your Customers
    5. 17. Request Money the PayPal Way
      1. 3.5.1. Requesting Money from Multiple People
      2. 3.5.2. Sending Custom Requests to Multiple Recipients
    6. 18. Ask for Money in Your Own Way
      1. 3.6.1. Creating a Request URL
      2. 3.6.2. Choosing the Best Approach
    7. 19. Request Money Without an Account
      1. 3.7.1. See Also
    8. 20. Get Your Money
      1. 3.8.1. Withdraw Without Withdrawing
      2. 3.8.2. Transfer to a Bank Account
      3. 3.8.3. Auto-Sweep
      4. 3.8.4. Just Send Me a Check
      5. 3.8.5. Get Paid to Use the PayPal Debit Card
    9. 21. Refund a Payment
    10. 22. Quick-Link to Transaction Details
      1. 3.10.1. Where to Get Transaction IDs
      2. 3.10.2. Making a Web Interface
    11. 23. Lower Your Seller Fees
      1. 3.11.1. Apply for the Merchant Rate
      2. 3.11.2. Ask for eChecks
      3. 3.11.3. Receive Money into Your Personal Account
      4. 3.11.4. Enroll in the PayPal Money Market
      5. 3.11.5. Use the PayPal ATM/Debit Card
      6. 3.11.6. Let Your Customers Pay
    12. 24. Protect Yourself from Buyer Fraud
      1. 3.12.1. Qualifying for Seller Protection
      2. 3.12.2. Checking the Buyer’s User Status
      3. 3.12.3. Conducting a Little Reconnaissance
    13. 25. Protect Yourself from Chargebacks
      1. 3.13.1. Protecting Yourself
      2. 3.13.2. Shipping Products
      3. 3.13.3. Responding When You Receive a Chargeback
      4. 3.13.4. Providing Additional Information About Your Case
    14. 26. Avoid Chargebacks on Digital Goods
      1. 3.14.1. Shipping a Physical Version
      2. 3.14.2. Thinking Outside the Disk
    15. 27. Handle Merchandise Disputes Effectively
      1. 3.15.1. First Response
      2. 3.15.2. Preventive Maintenance
  8. 4. Payment Buttons
    1. Introduction: Hacks #28-44
    2. 28. Create a Buy Now Button
      1. 4.2.1. The Code
      2. 4.2.2. Hacking the Hack
    3. 29. Use a Custom Button Image
      1. 4.3.1. Preparing the Image and Code
      2. 4.3.2. Button Design 101
    4. 30. Create a Purchase Button for Services
    5. 31. Create an Auction Payment Button
      1. 4.5.1. The Easy Way
      2. 4.5.2. Making Your Own Button
      3. 4.5.3. Hacking the Hack
    6. 32. Provide Purchase Options with Drop-Down Listboxes
      1. 4.6.1. Hacking the Hack
    7. 33. Include More Than Two Option Fields
    8. 34. Override Shipping and Handling Preferences
    9. 35. Build Notification Tracking
      1. 4.9.1. Hacking the Hack
      2. 4.9.2. See Also
    10. 36. Hack-Proof Your Payment
      1. 4.10.1. The Code
      2. 4.10.2. Hacking the Hack
      3. 4.10.3. Plan B: Obfuscate Your Button Code
    11. 37. Hack-Proof Your Buttons with Encryption
      1. 4.11.1. OpenSSL and Keys
      2. 4.11.2. Basic Button Encryption Using OpenSSL
    12. 38. Include Payment Buttons in Email Messages
      1. 4.12.1. Creating PayPal Payment Hyperlinks
      2. 4.12.2. Using the PayPal Payment Wizard
      3. 4.12.3. Including More than One Button in an Email
    13. 39. Hide Your Email Address from Spammers
    14. 40. Accept Donations
      1. 4.14.1. Establishing Suggested Giving Levels
      2. 4.14.2. Requiring Information from Your Donors
    15. 41. PayPal-Enable Your Flash
      1. 4.15.1. Snap in the PayPal Connection
      2. 4.15.2. Hacking the Hack
    16. 42. Get More Out of Dreamweaver and PayPal
      1. 4.16.1. Drag and Drop eCommerce
      2. 4.16.2. Hacking the Hack
    17. 43. Provide Options with ASP.NET Web Controls
      1. 4.17.1. Using the .NET Payment Controls
      2. 4.17.2. Creating Your Own PayPal Control
    18. 44. Try Accepting Payments in a Bogus Currency
  9. 5. Storefronts and Shopping Carts
    1. Introduction: Hacks #45-50
    2. 45. Hack Shopping Cart Buttons
      1. 5.2.1. Hacking the Hack
    3. 46. Create Shopping Cart Links
      1. 5.3.1. The Code
      2. 5.3.2. Shortening the Link
    4. 47. Specify the Size of the Shopping Cart Window
      1. 5.4.1. The Code
      2. 5.4.2. Hacking the Hack
    5. 48. Deal with Design and Layout Issues
    6. 49. Put Both Cart Buttons in One Form
      1. 5.6.1. The Code
      2. 5.6.2. The Right Tools for the Right Job
    7. 50. Integrate a Third-Party Shopping Cart with PayPal
      1. 5.7.1. Aggregating Your Cart
      2. 5.7.2. Uploading Shopping Cart Details to PayPal
      3. 5.7.3. Adding Additional Items
      4. 5.7.4. Hacking the Hack
    8. 51. Customize Checkout Pages
      1. 5.8.1. Using Multiple Custom Page Styles
      2. 5.8.2. Getting the Most from Custom Page Style Banners
    9. 52. Display the Merchant Transaction ID on Your Return Page
      1. 5.9.1. The PayPal Button Code
      2. 5.9.2. Creating Your Return Page
    10. 53. Remember Your Customers
      1. 5.10.1. Tracking Buyers with Cookies
      2. 5.10.2. The Return Page
      3. 5.10.3. Cookies at Work
      4. 5.10.4. Hacking the Hack
      5. 5.10.5. See Also
    11. 54. Create a Dynamic Storefront
      1. 5.11.1. Creating the Storefront Database
      2. 5.11.2. Building the Template
      3. 5.11.3. Including Product Details
    12. 55. Add Dynamic Storefront Details
      1. 5.12.1. Adding More Product Information to Your Table
      2. 5.12.2. Product Details Page
      3. 5.12.3. Hacking the Hack
    13. 56. Insert Dynamic Images
      1. 5.13.1. Inserting the Image
      2. 5.13.2. Link the Image to PayPal
    14. 57. Build an Order-Tracking Page
      1. 5.14.1. Asking the Question
      2. 5.14.2. Getting the Answer
      3. 5.14.3. Hacking the Hack
    15. 58. Offer Discount Coupons
      1. 5.15.1. Accepting Coupons on the Client Side
      2. 5.15.2. Hacking the Hack
      3. 5.15.3. Verifying Coupons on the Server Side
    16. 59. Increase Search Engine Exposure
      1. 5.16.1. Modifying the PayPal Button Factory Code
      2. 5.16.2. Hacking the Hack
    17. 60. Sell Digital Goods with PayLoadz
      1. 5.17.1. See Also
  10. 6. Managing Subscriptions
    1. Introduction: Hacks #61-64
    2. 61. Sell Subscriptions to Your Online Content
      1. 6.2.1. Creating a Subscribe Button
      2. 6.2.2. Setting Up Your Database
      3. 6.2.3. Processing Subscriber Notifications
      4. 6.2.4. Controlling Access to Your Valued Content
      5. 6.2.5. Hacking the Hack
    3. 62. Offer Tiered Subscriptions
      1. 6.3.1. Creating a Premium Subscription Button
      2. 6.3.2. Adding a Tier Field to Your Database
      3. 6.3.3. Inserting Tier Information with Each New Subscription
      4. 6.3.4. Restricting Access Based on Tier
      5. 6.3.5. Encouraging Subscribers to Upgrade
    4. 63. Time Your Subscriptions to End on Specific Dates
      1. 6.4.1. Hacking the Trial Period
      2. 6.4.2. Hacking the Hack
    5. 64. Manage Subscription Passwords the Easy Way
      1. 6.5.1. .htpasswd and .htaccess
      2. 6.5.2. Getting the Code
      3. 6.5.3. Adding Users Manually
      4. 6.5.4. Hacking the Hack
      5. 6.5.5. See Also
  11. 7. IPN and PDT
    1. Introduction: Hacks #65-86
    2. What IPN and PDT Are
    3. How IPN Works
    4. Advantages of PDT
    5. 65. Receive Instant Payment Notifications
      1. 7.5.1. The Code
      2. 7.5.2. Running the Code
    6. 66. Troubleshoot Instant Payment Notifications
      1. 7.6.1. Adding Email to IPN
      2. 7.6.2. Using a Return URL
      3. 7.6.3. Capturing Errors
      4. 7.6.4. Using a Third-Party Testing Script
    7. 67. Send a Purchase Confirmation Email with IPN
      1. 7.7.1. The Code
    8. 68. Process Shopping Carts with IPN
      1. 7.8.1. The Code
      2. 7.8.2. The Results
    9. 69. Use IPN with eBay Listings
      1. 7.9.1. The Code
      2. 7.9.2. The Results
    10. 70. Track Your eBay Products with IPN
      1. 7.10.1. Preparing Your Database
      2. 7.10.2. Listing the Item Number on eBay
      3. 7.10.3. The Code
    11. 71. Deliver Digital Goods with IPN
      1. 7.11.1. The Code
      2. 7.11.2. See Also
    12. 72. Deliver Digital Goods with a Return Page
      1. 7.12.1. Augmenting the PayPal Button Code
      2. 7.12.2. Creating an IPN Page
      3. 7.12.3. Building the Return Page
    13. 73. Implement Price Checking with IPN
      1. 7.13.1. Simple Price Checking with Single Item Purchases
      2. 7.13.2. Price Checking for Shopping Cart Purchases
      3. 7.13.3. Sending a Price Check Alert
    14. 74. Provide an Order Summary with IPN
      1. 7.14.1. The Code
    15. 75. Upsell Your Customers
      1. 7.15.1. The Return Page’s Job
      2. 7.15.2. The Code
      3. 7.15.3. Running the Code
    16. 76. Enable Multiple IPN Pages
      1. 7.16.1. The IPN Multiplexer
      2. 7.16.2. Turning off Secondary Verification to Eliminate Extra Postings
      3. 7.16.3. Hacking the Hack
    17. 77. Use Mass Pay to Create an Affiliate System
      1. 7.17.1. Creating Your Business Model
      2. 7.17.2. Building a Button for Your Affiliate
      3. 7.17.3. Recording Referred Purchases
      4. 7.17.4. Notifying Your Affiliates
      5. 7.17.5. Paying Your Affiliates en Mass
      6. 7.17.6. Hacking the Hack
    18. 78. Manage Your Inventory with IPN
      1. 7.18.1. Updating the Inventory Count
      2. 7.18.2. Creating the Selling Page
      3. 7.18.3. Alerting Yourself if Inventory Is Low
    19. 79. Display Donation Goals on Your Web Site
      1. 7.19.1. Recording Donations
      2. 7.19.2. Building the Donation Page
      3. 7.19.3. Hacking the Hack
    20. 80. Display a Recent Donor List
      1. 7.20.1. The Donation Button
      2. 7.20.2. The Database Table
      3. 7.20.3. The IPN Page
      4. 7.20.4. The Donation Page
      5. 7.20.5. Hacking the Hack
    21. 81. Capture Customer Information with IPN
      1. 7.21.1. The Database Table
      2. 7.21.2. The IPN Page
    22. 82. Insert Payment Details into a Database with IPN
      1. 7.22.1. The Database Table
      2. 7.22.2. The IPN Page
    23. 83. Insert Cart Details into a Database
      1. 7.23.1. The Database Table
      2. 7.23.2. Single-Item Purchases IPN Page
      3. 7.23.3. A Shopping Cart IPN
    24. 84. Track Google Referrals
      1. 7.24.1. Modifying Your Google AdWord Placement
      2. 7.24.2. Setting up Your Selling Page
      3. 7.24.3. Creating Your IPN Processing Page
      4. 7.24.4. See Also
    25. 85. Process Payments like a Credit Card with PDT
      1. 7.25.1. PDT in Action
      2. 7.25.2. Tracking Your Users: Before and After
      3. 7.25.3. Retrieving the Order
    26. 86. Synchronizing PDT and IPN
      1. 7.26.1. The Code
      2. 7.26.2. Hacking the Hack
  12. 8. The PayPal Web Services API
    1. Introduction: Hacks #87-100
    2. 8.2. Create a Developer Account
    3. 87. Set up the Sandbox
      1. 8.3.1. Creating a Sandbox Account
      2. 8.3.2. Confirming Your Sandbox Email Addresses
      3. 8.3.3. Verifying Bank Accounts in the Sandbox
      4. 8.3.4. Adding Funds (and Getting Rich Quick)
    4. 88. Make Your First API Call
      1. 8.4.1. Setting Up the SSL Certificate
      2. 8.4.2. SOAP-Enabling Your Application
      3. 8.4.3. Getting Started with PayPal’s APIClient Tool
      4. 8.4.4. Setting up a Test Transaction
      5. 8.4.5. Making Your First Call
    5. 89. Create a Wrapper Class for Your API Calls
      1. 8.5.1. Handling the Basics
      2. 8.5.2. Creating Your Own Certificate Handler
    6. 90. Use the PayPal API Wrapper Class
    7. 91. Refund Payments with the API
      1. 8.7.1. Running the Hack
      2. 8.7.2. The Results
    8. 92. Handle Transaction Errors within the API Wrapper
      1. 8.8.1. Using the Error Handler
    9. 93. Retrieve Transaction Details with the API
      1. 8.9.1. The Code
      2. 8.9.2. Running the Hack
    10. 94. Search for PayPal Transactions
      1. 8.10.1. The Code
      2. 8.10.2. Running the Hack
    11. 95. Hack the API Wrapper
      1. 8.11.1. The Code
      2. 8.11.2. Running the Hack
      3. 8.11.3. Importing into Quicken and QuickBooks
    12. 96. Issue Payments en Masse with the Mass Pay API
      1. 8.12.1. Setting up the Request
      2. 8.12.2. The Code
      3. 8.12.3. Running the Hack
    13. 97. Pay Affiliates and Suppliers on a Schedule
      1. 8.13.1. The Code
      2. 8.13.2. Running The Hack
    14. 98. Search eBay for Listings that Accept PayPal
      1. 8.14.1. The Code
      2. 8.14.2. Running the Hack
      3. 8.14.3. Hacking the Hack
    15. 99. Test IPN and PDT in the Sandbox
    16. 100. Go Live
      1. 8.16.1. Performance and Efficiency
      2. 8.16.2. Finishing Up
  13. Index
  14. About the Authors
  15. Colophon
  16. Special Upgrade Offer
  17. Copyright