C# 易趣API附加项调用返回“;如果指定自动转帐,则需要国内运输;错误

C# 易趣API附加项调用返回“;如果指定自动转帐,则需要国内运输;错误,c#,.net,ebay-api,ebay-net-sdk,C#,.net,Ebay Api,Ebay Net Sdk,我不熟悉易趣的API,我正在尝试打一个AddItem电话。但是,我不断得到一个错误: 如果指定自动转帐,则需要国内装运 我从SDK示例代码中一行接一行地复制了代码,它的编译和运行都很好,所以我觉得eBay的一端可能发生了某种变化 以下是我的一些代码: static ItemType BuildItem() { ItemType item = new ItemType(); item.AutoPaySpecified = false; i

我不熟悉易趣的API,我正在尝试打一个
AddItem
电话。但是,我不断得到一个错误:

如果指定自动转帐,则需要国内装运

我从SDK示例代码中一行接一行地复制了代码,它的编译和运行都很好,所以我觉得eBay的一端可能发生了某种变化

以下是我的一些代码:

static ItemType BuildItem()
    {
        ItemType item = new ItemType();

        item.AutoPaySpecified = false;

        item.Title = "Test Item";
        item.Description = "eBay SDK sample test item";

        item.ListingType = ListingTypeCodeType.Chinese;
        item.Currency = CurrencyCodeType.USD;
        item.StartPrice = new AmountType();
        item.StartPrice.Value = 20;
        item.StartPrice.currencyID = CurrencyCodeType.USD;

        item.ListingDuration = "Days_3";

        item.Location = "San Jose";
        item.Country = CountryCodeType.US;

        CategoryType category = new CategoryType();
        category.CategoryID = "11104";
        item.PrimaryCategory = category;

        item.Quantity = 1;
        item.ConditionID = 1000;
        item.ItemSpecifics = buildItemSpecifics();

        item.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();
        item.PaymentMethods.AddRange(
            new BuyerPaymentMethodCodeType[] { BuyerPaymentMethodCodeType.PayPal }
            );
        item.PayPalEmailAddress = "me@ebay.com";

        item.DispatchTimeMax = 1;
        item.ShippingDetails = BuildShippingDetails();

        item.ReturnPolicy = new ReturnPolicyType();
        item.ReturnPolicy.ReturnsAcceptedOption = "ReturnsAccepted";

        AmountType amount = new AmountType();
        amount.Value = 2.8;
        amount.currencyID = CurrencyCodeType.USD;
        item.StartPrice = amount;

        return item;
    }

    static NameValueListTypeCollection buildItemSpecifics()
    {
        NameValueListTypeCollection nvCollection = new NameValueListTypeCollection();

        NameValueListType nv1 = new NameValueListType();
        nv1.Name = "Platform";
        StringCollection nv1Col = new StringCollection();
        String[] strArr1 = new string[] { "Microsoft Xbox 360" };
        nv1Col.AddRange(strArr1);
        nv1.Value = nv1Col;
        NameValueListType nv2 = new NameValueListType();
        nv2.Name = "Genre";
        StringCollection nv2Col = new StringCollection();
        String[] strArr2 = new string[] { "Simulation" };
        nv2Col.AddRange(strArr2);
        nv2.Value = nv2Col;
        nvCollection.Add(nv1);
        nvCollection.Add(nv2);

        return nvCollection;
    }

    static ShippingDetailsType BuildShippingDetails()
    {
        ShippingDetailsType sd = new ShippingDetailsType();

        sd.ApplyShippingDiscount = true;
        AmountType amount = new AmountType();
        amount.Value = 2.8;
        amount.currencyID = CurrencyCodeType.USD;
        sd.PaymentInstructions = "eBay .Net SDK test instructions";

        // shipping type and shipping service options
        sd.ShippingType = ShippingTypeCodeType.Flat;
        ShippingServiceOptionsType shippingOptions = new ShippingServiceOptionsType();
        shippingOptions.ShippingService = ShippingServiceCodeType.ShippingMethodStandard.ToString();
        amount = new AmountType();
        amount.Value = 1;
        amount.currencyID = CurrencyCodeType.USD;
        shippingOptions.ShippingServiceAdditionalCost = amount;
        shippingOptions.ShippingServicePriority = 1;
        amount = new AmountType();
        amount.Value = 1.0;
        amount.currencyID = CurrencyCodeType.USD;
        shippingOptions.ShippingInsuranceCost = amount;

        sd.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection(
            new ShippingServiceOptionsType[] { shippingOptions }
            );

        return sd;
    }
我试图设置
item.AutoPay=false
item.autopaytimited=false-这两个似乎都不起作用。我在文件中搜索了一些关于国内航运的信息,但什么也没找到


有人知道为什么会发生这种情况吗?

您的shippingOptions字段缺少ShippingServiceCost,请尝试更改行:

shippingOptions.ShippingServiceAdditionalCost = amount;

或将分配添加到ShippingServiceCost


“如果指定了自动转帐,则需要国内装运”似乎意味着装运选项中缺少某些条件(即,取决于装运类型)字段。我在尝试添加计算配送所需的所有字段时遇到了相同的错误-如果没有所有字段,易趣将其解释为缺少ShippingServiceCost字段的统一费率配送。

您的shippingOptions字段缺少ShippingServiceCost,请尝试更改行:

shippingOptions.ShippingServiceAdditionalCost = amount;

或将分配添加到ShippingServiceCost

“如果指定了自动转帐,则需要国内装运”似乎意味着装运选项中缺少某些条件(即,取决于装运类型)字段。我在尝试添加计算运费所需的所有字段时遇到了相同的错误-如果没有所有字段,易趣将其解释为缺少ShippingServiceCost字段的统一费率运费