如何创建 FEDEX_ONE_RATE 货件

How to create FEDEX_ONE_RATE shipment

我已遵循 FedEx 开发人员指南,但仍然无法使用 FEDEX_ONE_RATE 创建 FedEx 货件。这是我试过的请求:

<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>

我在要求包含 return_details、code_details 等可以在特殊服务中提供的内容时遇到错误。 开发人员指南提到在 ShipmentSpecialServicesRequested/SpecialServiceTypes 中包含 'FEDEX_ONE_RATE'。但是,同样,return 同样的错误。

FEDEX_ONE_RATE 是一个 SpecialServiceType,因此它应该包含在 RequestedShipment/SpecialServicesRequested/SpecialServiceTypes 中。例如,您请求的 SpecialServicesRequested 元素将是(请注意,我使用的是 Ship Service 的 v26,它将 EMailNotificationDetail 替换为 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>