|< Day Day Up >|
Create payment buttons for auctions, such that the completed transaction updates the payment status on the auction web site automatically .
Merchants that sell using auction sites such as eBay often have to collect payment for their goods after the auction has ended. Sometimes, it can be confusing to the winning bidder how to complete payment, and you'll want to make it as easy as possible for your customers to send you money. Using some simple HTML, you can construct a payment button much like the payment buttons generated by PayPal for Shopping Cart and Web Accept purchases. You then present this button to the winning bidder in an email or on your web site to supplement the payment buttons already on the auction site.
4.5.1 The Easy Way
Since PayPal is an eBay company, it shouldn't be surprising that PayPal is well integrated with the eBay web site. For instance, if you indicate that you accept PayPal payments when constructing an eBay listing, a PayPal button will automatically appear for the winning bidder when the listing ends. Here's how to build the link between your eBay account and your PayPal account:
That's it! When your auction ends, a PayPal payment button will automatically appear at the top of the auction page, but for the winning bidder only.
Furthermore, you can configure PayPal to automatically insert a Pay Now button into each of your running auctions:
The PayPal Auction options include the following:
Figure 4-3. Buttons indicating that you prefer PayPal in an eBay listing
4.5.2 Making Your Own Button
Although eBay provides payment buttons for high bidders, you might want to supplement these buttons with your own. Plus, you might want to add eBay-like functionality to other auction sites, such as Yahoo!, uBid, Amazon.com, MSN, and Bidville auctions.
This code displays a simple Pay Now button that sends your customers to the PayPal web site and guides them through the payment process. The system automatically tracks the payment for this particular auction, so your customer will not have to enter any additional auction-related information. Plus, the auction site, provided that it's linked up with PayPal, will be notified automatically so that it can update the payment status of the auction for you and your bidder.
The goal of providing an extra payment button like this one is to reduce the chances that your customer (bidder) will use PayPal's Send Money function to pay for an auction; in that case, you would receive a payment not linked to its corresponding auction.
Here is the HTML code for an auction payment button, linked to a particular auction:
<form method="get" action="https://www.paypal.com/cgi-bin/webscr"> <input type="hidden" name="cmd" value=_cart> <input type="hidden" name="business" value=" email@example.com "> <input type="hidden" name="item_name_1" value=" Widget "> <input type="hidden" name="amount_1" value=" 1.00 "> <input type="hidden" name="quantity_1" value=" 1 "> <input type="hidden" name="site_1" value=" eBay "> <input type="hidden" name="ai_1" value=" 2540252652 "> <input type="hidden" name="ab_1" value=" your_ebay_id "> <input type="submit" name="upload" value="Pay Now"> </form>
This code is similar to the code used in [Hack #50] , with the exception of a few new variables : site_ n , ai_ n , and ab_ n , where n is a number representing the item in multiple item payments, starting with 1 (for example, include ab_1 , ab_2 , and ab_3 if you're requesting payment for three different auctions).
The site_ n variable defines the site on which the auction was listed, and it should be set to eBay for eBay auctions or Yahoo for Yahoo! Auctions. This value is case sensitive, so for other auction sites, you'd type uBid , Amazon , MSN , or Bidville . The second variable, ai_ n , should be set to the auction (or listing) number at the auction site. Finally, ab_ n , is your user ID at the auction site ( your_ebay_id in this example). Naturally, you'll need to replace all italicized text in the code with the details of your transaction.
The other variables, such as item_name_ n and amount_ n , can be modified as described in [Hack #28] .
4.5.3 Hacking the Hack
This hack demonstrates how you can create buttons that facilitate auction-specific payments. Naturally, creating a button for each auction manually would be a time-consuming process, but you can use the eBay API to automate this process. Start by sending a query to obtain the information for each of your completed auctions using a GetTransactionDetails call, and then assemble your buttons and email them to the high bidders. The technical procedures involved with implementing this type of system go beyond the scope of this book, but extensive information can be found in David A. Karp's eBay Hacks (O'Reilly).
If you use an off-site listing tool or a third-party listing service to build your auctions, you might be able to tie your application into the application's local database. However, you will also need a means of obtaining completed-item details (such as the final price and high-bidder contact information). For an example that shows how to build payment buttons dynamically, see [Hack #54] .
|< Day Day Up >|