eBay大中华区API开发者平台 开发者专区

搜 索
首页>API开发者平台>技术文档>使用.NET SDK计算Shipping Fee

技术文档

问题
使用.NET SDK计算Shipping Fee
解答
0
人觉得答案有帮助)
你可以调用GetItemShipping来获取某件商品的Shipping Fee信息。  

使用此SDK的C#例程:

private void GetItemShipping(string itemID, int quantity, string destinationPostalCode, CountryCodeType countryCode) 

  GetItemShippingCall call = new GetItemShippingCall(apiContext); 
  ShippingDetailsType Details = call.GetItemShipping(itemID, quantity, destinationPostalCode, countryCode);

  foreach (ShippingServiceOptionsTypeservice in Details .ShippingServiceOptions) 
 { 
      //Get values 
      service.ShippingService; 
      service.ShippingServicePriority; 
      service.ShippingServiceCost.Value; 
      service.ShippingInsuranceCost.Value; 
   } 

示例的SOAP请求如下:

<?xml version="1.0"encoding="utf-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
  <soapenv:Header> 
    <RequesterCredentialssoapenv:mustUnderstand="0"xmlns="urn:ebay:apis:eBLBaseComponents"> 
      <ebl:eBayAuthTokenxmlns:ebl="urn:ebay:apis:eBLBaseComponents">token</ebl:eBayAuthToken> 
    </RequesterCredentials> 
  </soapenv:Header> 
  <soapenv:Body> 
    <GetItemShippingRequestxmlns="urn:ebay:apis:eBLBaseComponents"> 
      <Version>523</Version> 
      <ItemID>4503623900</ItemID> 
      <QuantitySold>1</QuantitySold> 
      <DestinationPostalCode>44036</DestinationPostalCode> 
    </GetItemShippingRequest> 
  </soapenv:Body> 
</soapenv:Envelope>

响应如下:

<?xml version="1.0"encoding="utf-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
  <soapenv:Body> 
    <GetItemShippingResponse xmlns="urn:ebay:apis:eBLBaseComponents"> 
      <Timestamp>2005-09-12T19:49:16.539Z</Timestamp> 
      <Ack>Success</Ack> 
      <CorrelationID>00000000-00000000-00000000-00000000-00000000-00000000-0000000000</CorrelationID> 
      <Version>553</Version> 
      <Build>e553_core_Bundled_6134529_R1</Build> 
      <ShippingDetails> 
      <CalculatedShippingRate> 
          <OriginatingPostalCode>95125</OriginatingPostalCode>  
          <PackageDepth unit="inches" measurementSystem="English" confidenceFactor="0.0">1</PackageDepth>  
          <PackageLength unit="inches" measurementSystem="English" confidenceFactor="0.0">3</PackageLength>  
          <PackageWidth unit="inches" measurementSystem="English" confidenceFactor="0.0">2</PackageWidth>  
          <PackagingHandlingCosts currencyID="USD">0.0</PackagingHandlingCosts> 
          <ShippingIrregular>true</ShippingIrregular> 
          <ShippingPackage>LargeEnvelope</ShippingPackage> 
          <WeightMajor unit="lbs">0</WeightMajor> 
          <WeightMinor unit="oz">13</WeightMinor> 
        </CalculatedShippingRate> 
        <ShippingRateErrorMessage>No Error</ShippingRateErrorMessage> 
        <ShippingServiceOptions> 
          <ShippingInsuranceCostcurrencyID="USD">1.3</ShippingInsuranceCost> 
          <ShippingService>USPSPriority</ShippingService> 
          <ShippingServiceCostcurrencyID="USD">3.85</ShippingServiceCost> 
          <ShippingServicePriority>1</ShippingServicePriority> 
        </ShippingServiceOptions> 
        <ShippingServiceOptions> 
          <ShippingInsuranceCostcurrencyID="USD">1.3</ShippingInsuranceCost> 
          <ShippingService>USPSFirstClass</ShippingService> 
          <ShippingServiceCostcurrencyID="USD">3.13</ShippingServiceCost> 
          <ShippingServicePriority>2</ShippingServicePriority> 
        </ShippingServiceOptions> 
        <ShippingType>Calculated</ShippingType> 
      </ShippingDetails> 
    </GetItemShippingResponse> 
  </soapenv:Body> 
</soapenv:Envelope> 

 


版本信息

例程基于此特定的SDK版本:

API架构版本 523
.NET SDK版本 NET SDK v523.0 full release

 

 

 


答案对您有帮助吗?

是,对我很有帮助
否,没解决我的问题