易趣SDK添加订单交易ID

时间:2013-05-30 01:46:14

标签: ebay-api

我正在使用eBay SOAP SDK示例。我正在尝试添加订单,但它要求我提供交易ID。我如何获得交易ID?我输入了1号,它说它找不到它。我今天刚刚注册,我的商店是空的。

        private void BtnAddOrder_Click(object sender, System.EventArgs e)
    {
        try
        {
            TxtOrderId.Text = "";

            AddOrderCall apicall = new AddOrderCall(Context);


            OrderType order = new OrderType();
            order.TransactionArray = new TransactionTypeCollection();
            order.ShippingDetails = new ShippingDetailsType();
            order.PaymentMethods = new BuyerPaymentMethodCodeTypeCollection();

            TransactionType tr1 = new TransactionType();
            tr1.Item = new ItemType();
            tr1.Item.ItemID = TxtItemIdOne.Text;
            tr1.TransactionID = TxtTransactionIdOne.Text;
            order.TransactionArray.Add(tr1);

            TransactionType tr2 = new TransactionType();
            tr2.Item = new ItemType();
            tr2.Item.ItemID = TxtItemIdTwo.Text;
            tr2.TransactionID = TxtTransactionIdTwo.Text;
            order.TransactionArray.Add(tr2);

            order.ShippingDetails.PaymentInstructions = TxtPaymentInstructions.Text;
            ShippingServiceOptionsType shpopt = new ShippingServiceOptionsType();
            shpopt.ShippingService = CboShipSvc.SelectedItem.ToString();
            shpopt.ShippingServicePriority = 1;

            order.ShippingDetails.ShippingServiceOptions = new ShippingServiceOptionsTypeCollection();
            shpopt.ShippingServiceCost = new AmountType();
            shpopt.ShippingServiceCost.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);

            if (TxtShipCost.Text.Length > 0) 
            {
                shpopt.ShippingServiceCost.Value = Convert.ToDouble(TxtShipCost.Text);
            }
            order.ShippingDetails.ShippingServiceOptions.Add(shpopt);

            order.Total = new AmountType();
            order.Total.currencyID = CurrencyUtility.GetDefaultCurrencyCodeType(Context.Site);
            if (TxtTotal.Text.Length > 0)
                order.Total.Value = Convert.ToDouble(TxtTotal.Text);
            order.CreatingUserRole = (TradingRoleCodeType) Enum.Parse(typeof(TradingRoleCodeType), CboRole.SelectedItem.ToString());

            order.PaymentMethods.AddRange(new BuyerPaymentMethodCodeType[] {BuyerPaymentMethodCodeType.PaymentSeeDescription});

            string orderid = apicall.AddOrder(order);


            TxtOrderId.Text = orderid;

        }
        catch(Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

    }

1 个答案:

答案 0 :(得分:1)

此调用用于加入两个订单,以便买方可以一起付款。 见AddOrder Reference。 它要求您从商店中获取交易ID以加入一个订单。如果它找不到交易ID,那么您可能已经输入了不存在的交易ID。在你的情况下,几乎绝对是这种情况。 (如果我没记错的话,交易ID是9位数的字符串。)

我认为你在寻找的是PlaceOffer Reference。 你需要有一些物品。

使用Ebay API祝你好运。