Find the answer to your question
Advanced Search
As a seller, how do I find out in which order the buyer placed an item?
If you do not know the OrderID of the order which contains your item, you need to use GetOrders to get a list of all the orders for a date range. Then you need to iterate through each of the orders and within each order, iterate through each of the transactions, to check if it contains the ItemID that you need.
A couple of points to keep in mind when you use GetOrders:
- If the order is completed, then you will to look in the orders with the OrderStatus set to Completed, otherwise you would need to check the ones that are Active or Cancelled.
- Remember that the date range is in GMT, so make sure that you account for it when you set the range.
Here is a code snippet that uses SDK to look in the completed orders for the last seven days and find the Order that contains the item:
using System;
using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;
namespace SDK3Examples
{
{
{
// Credentials for the call
context.ApiCredential.ApiAccount.Developer = "devID";
context.ApiCredential.ApiAccount.Application = "appID";
context.ApiCredential.ApiAccount.Certificate = "certID";
context.ApiCredential.eBayToken = "token";
// Set the URL
context.SoapApiServerUrl = "https://api.sandbox.ebay.com/wsapi";
// Set logging
context.ApiLogManager = newApiLogManager();
context.ApiLogManager.ApiLoggerList.Add(new eBay.Service.Util.FileLogger("Messages.log", true, true, true));
context.ApiLogManager.EnableLogging = true;
// Set the version
context.Version = "595";
return context;
public string GetOrders( string ItemID)
{
try
{
//Get the orders for the last 7 days
otc = getOrders.GetOrders( DateTime.Now.AddDays(-7) , DateTime.Now, TradingRoleCodeType.Seller, OrderStatusCodeType.Completed);
//iterate through the OrderTyeCollection
foreach(OrderType ot in otc)
{
for(int i = 0;i < ot.TransactionArray.Count; i++)
{
ItemType it = ot.TransactionArray[i].Item;
if(it.ItemID == ItemID)
{
//ot.OrderID is the order ID
//now we do the required processing
catch(ApiException ex)
{