简体   繁体   中英

Is FedEx shipping api works in India Domestic

I tried to implement fedex api to calculate the cost of shipping betwnn to zip codes of a country. It is working fine for USA. It is also working from USA to other country(tried for IN and AU). But when I tried it for two zip codes from India or Australia as shipper and recipient address. It is giving below error :-

The transaction returned an Error.
Severity: ERROR
Source: crs
Code: 691
Message: The PurposeOfShipmentType is null, empty or invalid.
LocalizedMessage: The PurposeOfShipmentType is null, empty or invalid.

Don't know what is the issue. I checked the value for PurposeOfShipmentType in wsdl file it is showing below xml code :-

First occurrence
<xs:element name="Purpose" type="ns:PurposeOfShipmentType" minOccurs="0">
        <xs:annotation>
          <xs:documentation>The reason for the shipment. Note: SOLD is not a valid purpose for a Proforma Invoice.</xs:documentation>
        </xs:annotation>
      </xs:element>

second occurrence
<xs:simpleType name="PurposeOfShipmentType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="GIFT"/>
      <xs:enumeration value="NOT_SOLD"/>
      <xs:enumeration value="PERSONAL_EFFECTS"/>
      <xs:enumeration value="REPAIR_AND_RETURN"/>
      <xs:enumeration value="SAMPLE"/>
      <xs:enumeration value="SOLD"/>
    </xs:restriction>
  </xs:simpleType>

Don't understanding what should be the value. Below is array which I am sending into $client ->getRates($request) function

$request = Array
(
[WebAuthenticationDetail] => Array
    (
        [UserCredential] => Array
            (
                [Key] => *******
                [Password] => *******
            )

    )

[ClientDetail] => Array
    (
        [AccountNumber] => *****
        [MeterNumber] => *****
    )

[TransactionDetail] => Array
    (
        [CustomerTransactionId] =>  *** Rate Available Services Request using PHP ***
    )

[Version] => Array
    (
        [ServiceId] => crs
        [Major] => 16
        [Intermediate] => 0
        [Minor] => 0
    )

[ReturnTransitAndCommit] => 1
[RequestedShipment] => Array
    (
        [DropoffType] => REGULAR_PICKUP
        [ShipTimestamp] => 2014-10-03T11:37:53+02:00
        [Shipper] => Array
            (
                [Address] => Array
                    (
                        [StreetLines] => Array
                            (
                                [0] => 10 Fed Ex Pkwy
                            )

                        [City] => Memphis
                        [StateOrProvinceCode] => 
                        [PostalCode] => 110016
                        [CountryCode] => IN
                    )

            )

        [Recipient] => Array
            (
                [Address] => Array
                    (
                        [StreetLines] => Array
                            (
                                [0] => 13450 Farmcrest Ct
                            )

                        [City] => Herndon
                        [StateOrProvinceCode] => 
                        [PostalCode] => 302015
                        [CountryCode] => IN
                    )

            )

        [ShippingChargesPayment] => Array
            (
                [PaymentType] => SENDER
                [Payor] => Array
                    (
                        [ResponsibleParty] => Array
                            (
                                [AccountNumber] => 510087500
                                [Contact] => 
                                [Address] => Array
                                    (
                                        [CountryCode] => IN
                                    )

                            )

                    )

            )

        [PackageCount] => 2
        [RequestedPackageLineItems] => Array
            (
                [0] => Array
                    (
                        [SequenceNumber] => 1
                        [GroupPackageCount] => 1
                        [Weight] => Array
                            (
                                [Value] => 2
                                [Units] => LB
                            )

                        [Dimensions] => Array
                            (
                                [Length] => 10
                                [Width] => 10
                                [Height] => 3
                                [Units] => IN
                            )

                    )

                [1] => Array
                    (
                        [SequenceNumber] => 2
                        [GroupPackageCount] => 1
                        [Weight] => Array
                            (
                                [Value] => 5
                                [Units] => LB
                            )

                        [Dimensions] => Array
                            (
                                [Length] => 20
                                [Width] => 20
                                [Height] => 10
                                [Units] => IN
                            )

                    )

            )

    )

)

In order for the India to India domestic shipping to work you need to add in a PurposeOfShipment type to the request. This line is not standard in Magento's code for Fedex shipping. That line will be added into CustomsClearanceDetail header as a child under CommercialInvoice then a line under that is Purpose which can have any value that PurposeOfShipment has.

Here is an example of the request I used that returned proper shipping estimates for India to India shipping.

'CustomsClearanceDetail' => array(
     'CommercialInvoice' => array(
       'Purpose' => "SOLD"
    )
),

If I am not wrong, Fedex's Test Account doesn't return India specific info. Unless until its certified by the Fedex team and they provide you with the Production Key, you might not get the Rates aggreed for your account. Please do correct me if my understanding is wrong

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM