XML Flow Tutorial: Buying an Item
This tutorial consists of series of eBay API calls that describe a scenario for bidding on an auction item on eBay. This scenario helps illustrate the purpose of API calls and their constraints and dependencies when used together. Each step in the scenario gives a link to an XML call sample in the Trading API Reference. The samples show how to perform that step using the API.
In this scenario, a fictitious eBay buyer, Bountiful Buyer, makes API calls to add an item to her watch list, collect information about the item's seller, and bid on the item. The API calls in this tutorial, which are made on behalf of a buyer, are not typically incorporated into a selling application. Buyers purchase items through the eBay site, normally. However, these calls (specifically PlaceOffer) perform tasks which may be useful for automating testing, as they emulate buyer interaction that must be handled by a selling application.
|Note: PlaceOffer, which allows users to bid on an auction item, make an offer on a Best Offer enabled item, or purchase a Buy It Now or fixed-price item, is available to all developers for use in the eBay Sandbox. To use PlaceOffer in production, however, but you must go through an application/approval process with the eBay Partner Network. Please see the PlaceOffer documentation in the Trading API Reference for more information.|
This tutorial is the second in a series of tutorials for listing an item, buying the item, and completing the sale.
Listing an Item, in which a seller gathers eBay category information (and other metadata) and lists an item.
Completing a Sale, in which the seller ends an item, communicates with the buyer, and completes the sale.
What's in this Tutorial
This tutorial contains the following sections:
Complete Source Code
The API Flow tutorials use raw XML requests and responses. The XML call samples described in this tutorial can all be found in the Trading API Reference. Each step in the tutorial links to a corresponding XML call sample.
Before You Begin
All the calls in the tutorial are performed in the Sandbox environment, using a buyer test user. To make the calls in the tutorial, you must create your own Sandbox test user with a Sandbox authentication token. See Testing in the Sandbox in the Features Guide for more information.
The tutorial has no specific code requirements. You can run the XML samples in the API Test Tool on the eBay Developers Program website (you must log in).
Buying the Item
Bountiful Buyer is looking for a gift for her niece and decides that a collectable Harry Potter book would make the perfect present. While searching eBay's listings for Harry Potter books, she sees the book listed by Magical Bookseller.
Bountiful Buyer doesn't want to lose track of Magical Bookseller's listing, so she places a watch on it. This will allow her to find it again easily.
AddToWatchlist: add an item to the user's Watchlist
Bountiful Buyer likes to do her homework before bidding on an item. She uses GetUser to find out more about Magical Bookseller's record as an eBay seller.
Bountiful Buyer wants to know more about Magical Bookseller's past performance, so she uses GetFeedback to get detailed information about the seller's feedback scores.
GetFeedback: retrieve detailed feedback information on an eBay user
Pleased with Magical Bookseller's feedback scores, Bountiful Buyer makes a bid on the Harry Potter book.PlaceOffer: place a bid on an auction item
Notes and Next Steps
This section contains notes about the tutorial and suggestions for extending it.
Here are some suggestions for ways you could modify or extend the tutorial to learn more about the API:
- Get item information to determine programmatically whether to use PlaceOffer to bid, buy, or make an offer
- Program PlaceOffer capability into a testing application for use in the Sandbox
More information about the Trading API is available at these locations: