如何从联邦快递为客户生成退货标签

时间:2021-03-10 06:01:24

标签: api return label fedex

我正在尝试为 FedEx 中的客户生成退货标签,已阅读开发人员说明,但找不到合适的解决方案。

首先,我发现网络服务在 FedEx 中可用,并且有一个端点可以在 FedEx 中触发结果 Test URL Endpoint to trigger

然后我从我的 FedEx 帐户中生成了一个密钥、密码、帐号和仪表编号。

后来我通过 SOAP 调用生成返回标签没有解决方案

1 个答案:

答案 0 :(得分:0)

最后,我找到了一个代码并修改了它的某些部分以实现我期望的功能。

为客户生成退货标签的示例代码

解决方案:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://fedex.com/ws/ship/v26" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <soapenv:Body>

    <q0:ProcessShipmentRequest>

      <q0:WebAuthenticationDetail>

        <q0:UserCredential>

          <q0:Key>Key</q0:Key>

          <q0:Password>Password</q0:Password>

        </q0:UserCredential>

      </q0:WebAuthenticationDetail>

      <q0:ClientDetail>

        <q0:AccountNumber>Account</q0:AccountNumber>

        <q0:MeterNumber>Meter</q0:MeterNumber>

      </q0:ClientDetail>

      <q0:TransactionDetail>

        <q0:CustomerTransactionId>Express Return Example</q0:CustomerTransactionId>

      </q0:TransactionDetail>

      <q0:Version>

        <q0:ServiceId>ship</q0:ServiceId>

        <q0:Major>26</q0:Major>

        <q0:Intermediate>0</q0:Intermediate>

        <q0:Minor>0</q0:Minor>

      </q0:Version>

      <q0:RequestedShipment>

        <q0:ShipTimestamp>2021-04-29T12:00:00-05:00</q0:ShipTimestamp>

        <q0:DropoffType>BUSINESS_SERVICE_CENTER</q0:DropoffType>

        <q0:ServiceType>STANDARD_OVERNIGHT</q0:ServiceType>

        <q0:PackagingType>YOUR_PACKAGING</q0:PackagingType>

        <q0:Shipper>

          <q0:Contact>

            <q0:PersonName>Enter the shipper name</q0:PersonName>

            <q0:PhoneNumber>shippers contact</q0:PhoneNumber>

          </q0:Contact>

          <q0:Address>

            <q0:StreetLines>Enter street line</q0:StreetLines>

            <q0:StreetLines>Enter street another street line</q0:StreetLines>

            <q0:City>city name</q0:City>

            <q0:StateOrProvinceCode>state code</q0:StateOrProvinceCode>

            <q0:PostalCode>postal code</q0:PostalCode>

            <q0:CountryCode>US</q0:CountryCode>

          </q0:Address>

        </q0:Shipper>

        <q0:Recipient>

          <q0:Contact>

            <q0:CompanyName>Recipient company name</q0:CompanyName>

            <q0:PhoneNumber>phone number</q0:PhoneNumber>

          </q0:Contact>

          <q0:Address>

            <q0:StreetLines>Enter street line</q0:StreetLines>

            <q0:StreetLines>Enter street second line</q0:StreetLines>

            <q0:City>Enter city</q0:City>

            <q0:StateOrProvinceCode>TN</q0:StateOrProvinceCode>

            <q0:PostalCode>38125</q0:PostalCode>

            <q0:CountryCode>US</q0:CountryCode>

          </q0:Address>

        </q0:Recipient>

        <q0:ShippingChargesPayment>

          <q0:PaymentType>SENDER</q0:PaymentType>

          <q0:Payor>

            <q0:ResponsibleParty>

              <q0:AccountNumber>Account</q0:AccountNumber>

              <q0:Contact/>

            </q0:ResponsibleParty>

          </q0:Payor>

        </q0:ShippingChargesPayment>

        <q0:SpecialServicesRequested>

          <q0:SpecialServiceTypes>RETURN_SHIPMENT</q0:SpecialServiceTypes>

          <q0:ReturnShipmentDetail>

            <q0:ReturnType>PRINT_RETURN_LABEL</q0:ReturnType>

            <q0:Rma>

              <q0:Reason>Optional Reason</q0:Reason>

            </q0:Rma>

          </q0:ReturnShipmentDetail>

        </q0:SpecialServicesRequested>

        <q0:LabelSpecification>

          <q0:LabelFormatType>COMMON2D</q0:LabelFormatType>

          <q0:ImageType>PDF</q0:ImageType>

          <q0:LabelStockType>PAPER_4X6</q0:LabelStockType>

        </q0:LabelSpecification>

        <q0:PackageCount>1</q0:PackageCount>

        <q0:RequestedPackageLineItems>

          <q0:SequenceNumber>1</q0:SequenceNumber>

          <q0:Weight>

            <q0:Units>LB</q0:Units>

            <q0:Value>10.0</q0:Value>

          </q0:Weight>

          <q0:Dimensions>

            <q0:Length>5</q0:Length>

            <q0:Width>5</q0:Width>

            <q0:Height>5</q0:Height>

            <q0:Units>IN</q0:Units>

          </q0:Dimensions>

          <q0:CustomerReferences>

            <q0:CustomerReferenceType>RMA_ASSOCIATION</q0:CustomerReferenceType>

            <q0:Value>rma1234</q0:Value>

          </q0:CustomerReferences>

        </q0:RequestedPackageLineItems>

      </q0:RequestedShipment>

    </q0:ProcessShipmentRequest>

  </soapenv:Body>

</soapenv:Envelope>