Search code examples
fedex

How to create FEDEX_ONE_RATE shipment


I have followed FedEx developer guide but still can not create FedEx shipment with FEDEX_ONE_RATE. This is the request that I have tried:

<ProcessShipmentRequest xmlns="http://fedex.com/ws/ship/v16">
<WebAuthenticationDetail>
    <UserCredential>
        <Key>[masked]</Key>
        <Password>[masked]</Password>
    </UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
    <AccountNumber>[masked]</AccountNumber>
    <MeterNumber>[masked]</MeterNumber>
    <Localization>
        <LanguageCode>en</LanguageCode>
        <LocaleCode>us</LocaleCode>
    </Localization>
</ClientDetail>
<Version>
    <ServiceId>ship</ServiceId>
    <Major>16</Major>
    <Intermediate>0</Intermediate>
    <Minor>0</Minor>
</Version>
<RequestedShipment>
    <ShipTimestamp>2021-01-24T04:21:29.42-07:00</ShipTimestamp>
    <DropoffType>REGULAR_PICKUP</DropoffType>
    <ServiceType>PRIORITY_OVERNIGHT</ServiceType>
    <PackagingType>FEDEX_PAK</PackagingType>
    <Shipper>
        <Contact>
            <PersonName/>
            <CompanyName>[masked]</CompanyName>
            <PhoneNumber>[masked]</PhoneNumber>
        </Contact>
        <Address>
            <StreetLines>211 Swathmore Ave</StreetLines>
            <StreetLines>#101</StreetLines>
            <City>High Point</City>
            <StateOrProvinceCode>NC</StateOrProvinceCode>
            <PostalCode>27263</PostalCode>
            <CountryCode>US</CountryCode>
        </Address>
    </Shipper>
    <Recipient>
        <Contact>
            <PersonName>[masked]</PersonName>
            <CompanyName/>
            <PhoneNumber>[masked]</PhoneNumber>
        </Contact>
        <Address>
            <StreetLines>3570 STANFORD DR</StreetLines>
            <City>LAKE HAVASU CITY</City>
            <StateOrProvinceCode>AZ</StateOrProvinceCode>
            <PostalCode>86406-7268</PostalCode>
            <CountryCode>US</CountryCode>
            <Residential>true</Residential>
        </Address>
    </Recipient>
    <ShippingChargesPayment>
        <PaymentType>SENDER</PaymentType>
        <Payor>
            <ResponsibleParty>
                <AccountNumber>[masked]</AccountNumber>
                <Contact>
                    <PersonName/>
                    <CompanyName>[masked]</CompanyName>
                    <PhoneNumber>[masked]</PhoneNumber>
                </Contact>
            </ResponsibleParty>
        </Payor>
    </ShippingChargesPayment>
    <SpecialServicesRequested>
        <SpecialServiceTypes>EMAIL_NOTIFICATION</SpecialServiceTypes>
        <EMailNotificationDetail>
            <PersonalMessage/>
            <Recipients>
                <EMailNotificationRecipientType>RECIPIENT</EMailNotificationRecipientType>
                <EMailAddress>[masked]</EMailAddress>
                <NotificationEventsRequested>ON_SHIPMENT</NotificationEventsRequested>
                <NotificationEventsRequested>ON_TENDER</NotificationEventsRequested>
                <NotificationEventsRequested>ON_EXCEPTION</NotificationEventsRequested>
                <NotificationEventsRequested>ON_DELIVERY</NotificationEventsRequested>
                <Format>HTML</Format>
                <Localization>
                    <LanguageCode>en</LanguageCode>
                </Localization>
            </Recipients>
            <Recipients>
                <EMailNotificationRecipientType>OTHER</EMailNotificationRecipientType>
                <EMailAddress>[masked]</EMailAddress>
                <NotificationEventsRequested>ON_SHIPMENT</NotificationEventsRequested>
                <NotificationEventsRequested>ON_TENDER</NotificationEventsRequested>
                <NotificationEventsRequested>ON_EXCEPTION</NotificationEventsRequested>
                <NotificationEventsRequested>ON_DELIVERY</NotificationEventsRequested>
                <Format>HTML</Format>
                <Localization>
                    <LanguageCode>en</LanguageCode>
                </Localization>
            </Recipients>
        </EMailNotificationDetail>
        <ShipmentSpecialServicesRequested>
            <SpecialServicesType>FEDEX_ONE_RATE</SpecialServicesType>
        </ShipmentSpecialServicesRequested>
    </SpecialServicesRequested>
    <LabelSpecification>
        <LabelFormatType>COMMON2D</LabelFormatType>
        <ImageType>PNG</ImageType>
        <LabelStockType>PAPER_4X6</LabelStockType>
    </LabelSpecification>
    <RateRequestTypes>LIST</RateRequestTypes>
    <PackageCount>1</PackageCount>
    <RequestedPackageLineItems>
        <GroupPackageCount>1</GroupPackageCount>
        <Weight>
            <Units>LB</Units>
            <Value>1</Value>
        </Weight>
        <Dimensions>
            <Length>1</Length>
            <Width>1</Width>
            <Height>1</Height>
            <Units>IN</Units>
        </Dimensions>
    </RequestedPackageLineItems>
</RequestedShipment>

I got error asking to include return_details, code_details and so on that can be given in special service. The Developer's Guide mentioned to include 'FEDEX_ONE_RATE' in ShipmentSpecialServicesRequested/SpecialServiceTypes. But that, too, return same error.


Solution

  • FEDEX_ONE_RATE is a SpecialServiceType, so it should be included in RequestedShipment/SpecialServicesRequested/SpecialServiceTypes. For example, the SpecialServicesRequested element of your request would be (please note that I'm using v26 of the Ship Service, which replaces EMailNotificationDetail with EventNotificationDetail):

    <SpecialServicesRequested>
        <SpecialServiceTypes>FEDEX_ONE_RATE</SpecialServiceTypes>
        <SpecialServiceTypes>EVENT_NOTIFICATION</SpecialServiceTypes>
        <EventNotificationDetail>
            <AggregationType>PER_SHIPMENT</AggregationType>
            <PersonalMessage>Personal message</PersonalMessage>
            <EventNotifications>
                <Role>RECIPIENT</Role>
                <Events>ON_SHIPMENT</Events>
                <NotificationDetail>
                    <NotificationType>EMAIL</NotificationType>
                    <EmailDetail>
                        <EmailAddress>john@fedex.com</EmailAddress>
                        <Name>John Smith</Name>
                    </EmailDetail>
                    <Localization>
                        <LanguageCode>EN</LanguageCode>
                    </Localization>
                </NotificationDetail>
                <FormatSpecification>
                    <Type>HTML</Type>
                </FormatSpecification>
            </EventNotifications>
        </EventNotificationDetail>
    </SpecialServicesRequested>