Frage

I'm having issues attempting to track a package by Tracking Number Unique Identifier. I'm working with the sample PHP code from Fedex Developer Resource Center. How can I track it using the TrackingNumberUniqueIdentifier?

    $path_to_wsdl = __DIR__ . "/WSDL/FEDEX/TrackService_v6.wsdl";

    ini_set("soap.wsdl_cache_enabled", "0");

    $client = new \Soapclient($path_to_wsdl, array('trace' => 1));

    $request = array(
        'WebAuthenticationDetail' => array(
            'UserCredential' => array(
                'Key'      => #KEY#,
                'Password' => #PASSWORD#
            )
        ),
        'ClientDetail' => array(
            'AccountNumber' => #SHIPACCOUNT#,
            'MeterNumber'   => #METER#
        ),
        'Version' => array(
            'ServiceId'    => 'trck',
            'Major'        => '6',
            'Intermediate' => '0',
            'Minor'        => '0'
        ),
        'PackageIdentifier' => array(
            'Type'  => 'TRACKING_NUMBER_OR_DOORTAG',
            'Value' => '123456789012',
        ),

        'IncludeDetailedScans' => 1
        'TrackingNumberUniqueIdentifier' => '510987654321~123456789012~FX'
    );
War es hilfreich?

Lösung

When you desire to track a package using the FedEx API, you simply provided the tracking number or the door tag number; however, FedEx reuses the tracking numbers, so you may find that one of your tracking numbers has more than one set of events (or more than two shipments associated with it). When that happens, you must use the FedEx tracking number unique identifier (which has the tracking number as prefix) to get the desired set of events.

In case of your request, you are using a non-valid tracking number (123456789012) for the FedEx test environment and an unrelated tracking number unique identifier (510987654321~123456789012~FX). Notice that the suffix of the unique identifier is not the tracking number.

Sadly, FedEx does not provide test tracking number, so I recommend you to switch the endpoint to the production URL, and test the tracking service using real tracking numbers because the production tracking numbers don't work in the test environment.

Remember, don't use the tracking number unique identifier unless your tracking number has two shipments associated with it.

Regards,

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top