Hack 22 Quick-Link to Transaction Details

figs/beginner.gif figs/hack22.gif

View the details of past purchases and sales without having to wade through the PayPal history listings.

If you buy and sell a lot with PayPal, you undoubtedly often need to look up past transactions in order to get the payment status, shipping address, customer notes, and other details, as well as issue refunds. Unfortunately, getting to the details of past transactions can be laborious, requiring that you click through three or four screens before you can search for a payment by transaction ID.

The good news is that there's a better way. PayPal provides a special URL that takes you directly to a payment's details page. You might have seen links like this in confirmation emails, where xxxxxxxxxxxxx is the transaction ID:


For example:


Click the link in the email or type it into your browser's address bar, and you'll be sent straight to the payment details for the specified transaction ID (after logging in, if necessary).

Whenever you click on a link that takes you to a PayPal page, you should make sure that https://www.paypal.com/ is then displayed in your web browser's address box (the s in https is especially important). Otherwise, you might unwittingly try to log into a spoof site?one that looks like PayPal, but exists only to divert your login information to an unauthroized third party.

3.10.1 Where to Get Transaction IDs

Since transaction IDs are the definitive way to reference a payment on PayPal, you'll see them in a lot of places at PayPal:

  • The Payment Details page, shown immediately after making a payment or in both PayPal History logs (for both buyers and sellers)

  • Downloaded logs obtained from the PayPal History page

  • Payment confirmation emails, such as "Receipt for your Payment" emails (for buyers) and "Notification of an Instant Payment Received" emails for eBay sellers

  • Instant Payment Notifications (IPNs) [Hack #65]

  • Payment Data Transfers (PDTs) [Hack #85]

If you're developing with the PayPal Web Services API, see Chapter 8 for several ways to obtain and use PayPal transaction IDs.

This technique works for both the sender and the recipient who are looking up the payment details by either transaction ID. It's also common for the other person involved in a payment to reference the transaction ID when emailing or calling you to inquire about an order.

One thing to watch out for is that PayPal assigns a different transaction ID to the sender and recipient of a transaction. This can sometimes be confusing when, for example, you look up a transaction using an ID given to you by the payment sender and you see a different transaction ID on the Payment Details page.

You will, of course, not be able to see the details for a payment that you weren't involved in!

3.10.2 Making a Web Interface

Once you have the transaction ID or a list of IDs, you can write a script to output a list of links that you (or your customers) can use to easily get to the transaction details page for each payment:



<a href="https://www.paypal.com/vst/id=4WC420852U475861R">4WC420852U475861R</a>

<a href="https://www.paypal.com/vst/id=93H8WR41HAV710IU9">93H8WR41HAV710IU9</a>



Or, create a simple web-based tool that includes an ID field and a Submit button, allowing you to look up a single transaction without having to remember the aforementioned URL:


<form action="https://www.paypal.com/cgi-bin/webscr">

<input type="hidden" name="cmd" value="_vst">

Transaction ID: <input type="text" name="id" value="">

<input type="submit" value="Get Details">



See [Hack #52] for a way to obtain the transaction ID programmatically (necessary to create a web interface like this one). Of course, the slickest way to do it is with the PayPal Web Services API [Hack #94] .