skip to Main Content

My eBay integration just broke after months of working properly and I’m not sure if its a bug or not on their end.

My buyer made 2 transactions of two different items and then combined them to save shipping. All this happened in a matter of a few minutes.

This had the following result :

  • New sales record created (which incidentally doesn’t show up in seller manager)
  • New OrderId created for the combined order. Contains the two transactions (as expected). This OrderId was assigned to the original 2 orders and the combined one (not expected!)
  • Three orders returned in call to GetOrders. All have the same OrderId value
  • The CreatedTime on each OrderType returned is different for each with the most recent order having the latest time (as expected).

What I’m trying to figure out is how I’m supposed to know not to ship all 3 orders. If my code hadn’t been trying to put these orders into a dictionary then I wouldn’t even have known there were duplicate OrderId values being returned.

I’m hoping there’s a property somewhere that indicates the order record was combined into another order – but I can’t find it.

Am I supposed to look at the time of the order and pick the most recent one? Or is there a way to exclude transactions that have been subsequently combined from the search results.

3

Answers


  1. Chosen as BEST ANSWER

    This is my C# code to check for dupes of this nature and return only the latest order. There's a lot of assertion checking in here but it hasn't crashed yet - then again I don't know if the codepath where o.Count() != 1 has ever been hit yet.

            // raw orders coming back from eBay
            var orderArrayRaw = getTransactions.ApiResponse.OrderArray.ToArray();
    
            // processed list to remove dupes
            var orderArray = orderArrayRaw.ToArray().GroupBy(x => x.OrderID).Select(o =>
            {
                // single unique order
                if (o.Count() == 1)
                {
                    return o.Single();
                }
                else
                {
                    // get most recent
                    var mostRecent = o.OrderByDescending(x => x.CreatedTime).First();
    
                    // get all the transaction IDs in the non-most-recent
                    var allTransactions = o.Except(new[] { mostRecent }).SelectMany(x => x.TransactionArray.ToArray().Select(t => t.TransactionID)).OrderBy(x => x).ToArray();
    
                    var combinedTransactions = mostRecent.TransactionArray.ToArray().Select(x => x.TransactionID).OrderBy(x => x).ToArray();
    
                    if (allTransactions.SequenceEqual(combinedTransactions))
                    {
                        // ok!
                        return mostRecent;
                    }
                    else
                    {
                        var dupes = orderArrayRaw.ToArray().GroupBy(x => x.OrderID).Where(x => x.Count() > 1);
                        var dupeIds = dupes.Select(x => x.Key).ToArray();
    
                        throw new ApplicationException("The following orders were returned more than once in the response " + string.Join(", ", dupeIds));
                    }
                }
    
    
            }).ToArray();
    

  2. It doesn’t guarantee that the latest order is the one with the combined order nodes. In my experience, it happened that the later order is only a suppose line item of the previous order. We reported countless times to ebay support on this and they only say that they’ll fix it soon.

    My solution for now is compare with the order’s PayPal transaction using the GetTransactionDetails API. I assumed the PayPal transaction should have the combined order records. What I did is, I created a map of ebay line items ({ItemID:Quantity}) and created a map of paypal transaction line items ({Number:Quantity}) then compared the two with the paypal transaction map as the reference. If an ebay order node doesn’t match with the paypal transaction, then ignore it and proceed to next order node until the one with the combined order is met. Sometimes, the one with combined order records comes first of the order nodes of the GetOrdersResponse, so just ignore the next ones when detected. Hope I helped.

    Login or Signup to reply.
  3. Looks like eBay orders are created when a buyer commits to buy for example winning the auction. So when they are about to make the payment they can combine these orders together and it would create another order with the transactions. I am having the same issues as well, just thinking what if we pass the order status only to retrieve the complete orders?

    A good presentation by eBay about the API https://youtu.be/n4UDGrO6H_g?t=1111

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search