Search code examples
ebay-api

Ebay trading API - Where's the postage?


I'm using the Ebay trading API to get the inventory of a user.

I'm using GetSellerList() with granularity = fine, then i iterate through the ItemTypeCollection for each ItemType. All the information i need is there except the postage.

The products do have postage on them of £7.50 but this is nowhere in the ItemType?

Any ideas how to find/get this?


Solution

  • Well i found it lurking way deep down here:

    myItemTypeCollection[x].ShippingDetails.ShippingServiceOptions[x].ShippingServiceCost.Value
    

    Please see here for the nuts and bolts of how to get the seller list from eBay: http://developer.ebay.com/devzone/xml/docs/reference/ebay/GetSellerList.html

    After you have called GetSellerList the below code should get the postage, i have only targeted the RoyalMail shipping service in this but if you inspect the object you'll see other options:

    //get the seller list from EBay
    ItemTypeCollection itemLists = apiGetSellerList.GetSellerList();  
    
    //loop through the itemTypeCollection to get each item
     foreach (ItemType oItem in itemLists)
                    {
    
                       foreach (ShippingServiceOptionsType shipType in oItem.ShippingDetails.ShippingServiceOptions)
                            {
                                ////loop through the various shipping options
                                switch (shipType.ShippingService)
                                {
                                    case "UK_RoyalMailSecondClassStandard":
                                        //this is the standard postage so add this
                                        addProduct.DeliveryStandard = (decimal)shipType.ShippingServiceCost.Value;
                                        break;
    
                                    default:
                                        break;
                                }
                            }
    }