Find the answer to your question
Advanced Search
When I make an AddItem call using the .NET SDK, why do I get the following error messages, even though the Category and Currency are correct?
"The auction currency specified does not match the auction currency for the selected site.
The category you have selected is invalid. Please go back and select another category."
When you make an AddItem call, you have to make sure that the Site is set correctly. If you do not set the Site, it defaults to US and if you try to make an AddItem call for a non US listing, it will return the error message indicating that your Category and Currency are invalid. If you make a straight XML request, ensure that you have set the SiteID correctly in both the header and body. If you use the SDK, you can set the Site at either the APIContext level or at the call Level. I have highlighted the key line of code below.
Here is an example of how to list an item on the UK site using the .NET SDK.
using System;
using eBay.Service.Call;
using eBay.Service.Core.Sdk;
using eBay.Service.Util;
using eBay.Service.Core.Soap;
namespace SDK3Examples
{
{
{
AddItemCall addItem = new AddItemCall(GetContext());
addItem.Site = SiteCodeType.UK;
ItemType item = new ItemType();
// Set Defaults
item.Currency = CurrencyCodeType.GBP;
item.Country = CountryCodeType.GB;
item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
item.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] {BuyerPaymentMethodCodeType.PaymentSeeDescription});
// Set the other values
item.Title = "List Item on UK Site";
item.Quantity = 1;
item.Location = "London";
item.ListingDuration = ListingDurationCodeType.Days_7;
item.PrimaryCategory = new CategoryType();
item.PrimaryCategory.CategoryID = "14112";
item.StartPrice = new AmountType();
item.StartPrice.currencyID = CurrencyCodeType.GBP;
item.StartPrice.Value = 20;
item.UUID = UUID;
FeeTypeCollection fees = addItem.AddItem(item);
return item.ItemID;
}
public ApiContext GetContext()
{
ApiContext context = new ApiContext();
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 = "433";
return context;
}