PayPal Hacks. 100 Industrial-Strength Tips and Tools Free Open Book

PayPal Hacks. 100 Industrial-Strength Tips and Tools

Previous Section  < Day Day Up >  Next Section

Hack 99 Test IPN and PDT in the Sandbox

figs/moderate.gif figs/hack99.gif

Test Instant Payment Notification (IPN) and Payment Data Transfer (PDT) in the PayPal Sandbox.

Once you've deposited money into the Personal account in your Sandbox [Hack #87], you'll need to configure your Sandbox Business account to use either PDT or IPN (both of which are discussed at length in Chapter 7). This hack shows how to configure PDT.

As with the live PayPal site, to use PDT with the PayPal Sandbox, you must first configure some options in your Sandbox Business account Profile.

PDT works only when Auto Return is turned on. You must set this before using PDT in your web site.


To enable Auto Return and the PDT feature, follow these steps:

  1. Open the Sandbox, launch the Sandbox Business account, and log in.

  2. Click the My Account tab, and then click Profile.

  3. Click Website Payment Preferences and turn on the Auto Return option.

  4. Finally, turn on the Payment Data Transfer option.

  5. Click Save when you're done.

When you save your PDT preferences, an ITidentity token is generated and appears in a message at the top of the Website Payment Preferences page. In future visits, your ITidentity token will appear in the Payment Data Transfer section, below the On and Off options.


See [Hack #85] for additional PDT setup instructions and tips.

Now, when sending order information to PayPal, you can do it through a URL (GET) or via an HTML form (POST). Either way, you need to tell PayPal that the payment is going to a Sandbox account. Just add the parameter test_pdt=1 (or test_ipn=1 if you are using the IPN) to the URL (or include it as a variable in your HTML form).

When the transaction is complete, the pseudobuyer will be redirected to the URL you supplied in the ReturnURL parameter, along with several transaction parameters appended to the URL, including:


Transaction number (tx)

You'll use the transaction number to get the full set of transaction information [Hack #93] .


Status (st)

The status of the transaction is normally Completed. See [Hack #65] for explanations of the other status flags you might see here.


Amount of sale (amt)

The dollar (or whatever currency used) amount of the sale.


Currency (cc)

The currency used for the sale.

Once the Sandbox has sent you this information, you can set up your IPN or PDT logic as you need without worrying about real orders and real money being transacted. The return information from PayPal won't specify that it's a Sandbox transaction, though, so if it's important to you to know this, you can append a flag to your return URL, like this:

http://www.myreturnurl.com?test=1

PayPal appends its transaction information to this URL for both PDT and IPN, preserving your test parameter and thus helping you to distinguish test transactions from real ones.

--Rob Conery and Dave Nielsen

    Previous Section  < Day Day Up >  Next Section
    Index: [SYMBOL][A][B][C][D][E][F][G][H][I][J][L][M][N][O][P][Q][R][S][T][U][V][W][X][Y]


         Main Menu
    PayPal Hacks
    Table of Contents
    Copyright
    Credits
    Preface
    Chapter 1. Account Management
    Chapter 2. Making Payments
    Chapter 3. Selling with PayPal
    Chapter 4. Payment Buttons
    Chapter 5. Storefronts and Shopping Carts
    Chapter 6. Managing Subscriptions
    Chapter 7. IPN and PDT
    Chapter 8. The PayPal Web Services API
    Introduction: Hacks #87-100
    8.2 Create a Developer Account
    Hack 87 Set up the Sandbox
    Hack 88 Make Your First API Call
    Hack 89 Create a Wrapper Class for Your API Calls
    Hack 90 Use the PayPal API Wrapper Class
    Hack 91 Refund Payments with the API
    Hack 92 Handle Transaction Errors within the API Wrapper
    Hack 93 Retrieve Transaction Details with the API
    Hack 94 Search for PayPal Transactions
    Hack 95 Hack the API Wrapper
    Hack 96 Issue Payments en Masse with the Mass Pay API
    Hack 97 Pay Affiliates and Suppliers on a Schedule
    Hack 98 Search eBay for Listings that Accept PayPal
    Hack 99 Test IPN and PDT in the Sandbox
    Hack 100 Go Live
    Colophon
    Index


    More Books
    PHP Hacks
    Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
    The Koran (Holy Qur'an)
    Macromedia Flash 8 Bible
    Search Engine Optimization for Dummies
    YouTube Traffic
    PHP 5 for Dummies
    Harry Potter and The Chamber of Secrets
    Harry Potter and the Sorcerer's Stone
    The Pilgrim's Progress
    Wireless Hacks
    Flash Hacks. 100 Industrial-Strength Tips & Tools
    PayPal Hacks. 100 Industrial-Strength Tips and Tools
    Amazon Hacks
    Pdf Hacks
    The Da Vinci Code
    Google Hacks
    The Holy Bible
    Windows XP For Dummies
    Harry Potter and the Half-Blood Prince
    Seo Book
    Upgrading and Repairing Networks
    Macromedia Dreamweaver 8 UNLEASHED
    Windows XP Annoyances
    Windows XP Hacks
    Microsoft Windows XP Power Toolkit
    Teach Yourself MS Office In 24Hours
    iPod & iTunes Missing Manual
    PC Hacks 100 Industrial-Strength Tips and Tools
    PC Overclocking, Optimization, and Tuning - 2th Edition
    PC Hardware In A Nutshell 3rd Edition
    PC Hardware in a Nutshell, 2nd Edition
    Upgrading and Repairing PCs
    Google for Dummies
    MySQL Cookbook
    Teach Yourself Macromedia Flash 8 In 24 Hours
    PHP CookBook
    Sams Teach Yourself JavaScript in 24 Hours
    PHP5 Manual
    Free Games Paper Airplanes
    500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele