Reputation: 57
How get FEDEX_ONE_RATE API using php
I tried to get by JeremyDunn/php-fedex-api-wrapper but not use standard rates comes good, when I tried to 'FEDEX_ONE_RATE' nothing change.
Try 1
$rateRequest->ShipmentSpecialServicesRequested->SpecialServiceTypes = 'FEDEX_ONE_RATE';
Try 2
$rateRequest->VariableOptions = array(SimpleType\ServiceOptionType::_FEDEX_ONE_RATE);
The above both method it's request are appended the parameter but results are nothing changed.
Any one help me.
Upvotes: 0
Views: 767
Reputation: 57
Finally I got Resolved
This is the working code for postman (SOAP Request)
$url = 'https://ws.fedex.com:443/web-services/rate';
//SAND BOX
$url = 'https://wsbeta.fedex.com:443/web-services/rate';
// LIVE
$xml = '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://fedex.com/ws/rate/v28"> <SOAP-ENV:Body>
<RateRequest>
<WebAuthenticationDetail>
<UserCredential>
<Key>.....</Key>
<Password>....</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>....</AccountNumber>
<MeterNumber>....</MeterNumber>
</ClientDetail>
<Version>
<ServiceId>crs</ServiceId>
<Major>28</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<VariableOptions>FEDEX_ONE_RATE</VariableOptions>
<RequestedShipment>
<DropoffType>REGULAR_PICKUP</DropoffType>
<PackagingType>FEDEX_SMALL_BOX</PackagingType>
<Shipper>
<Address>
<StateOrProvinceCode>TN</StateOrProvinceCode>
<PostalCode>38017</PostalCode>
<CountryCode>US</CountryCode>
<Residential>false</Residential>
</Address>
</Shipper>
<Recipient>
<Address>
<StateOrProvinceCode>CA</StateOrProvinceCode>
<PostalCode>90028</PostalCode>
<CountryCode>US</CountryCode>
<Residential>false</Residential>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>.....</AccountNumber>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<RateRequestTypes>LIST</RateRequestTypes>
<PackageCount>1</PackageCount>
<RequestedPackageLineItems>
<GroupPackageCount>1</GroupPackageCount>
<Weight>
<Units>LB</Units>
<Value>10.00</Value>
</Weight>
</RequestedPackageLineItems>
</RequestedShipment>
</RateRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>';
Upvotes: 0
Reputation: 754
Difficult to say without looking at your exact request, but assuming that your are submitting a RateRequest
, then you need to:
FEDEX_ONE_RATE
as a ServiceOptionType
in the RateRequest.VariableOptions
.FEDEX_SMALL_BOX
, FEDEX_MEDIUM_BOX
, FEDEX_LARGE_BOX
, FEDEX_EXTRA_LARGE_BOX
, FEDEX_PAK
, FEDEX_TUBE
, FEDEX_ENVELOPE
).See the FedEx documentation for all the details.
For example, using the following request:
<RateRequest>
<WebAuthenticationDetail>
<UserCredential>
<Key>...</Key>
<Password>...</Password>
</UserCredential>
</WebAuthenticationDetail>
<ClientDetail>
<AccountNumber>...</AccountNumber>
<MeterNumber>...</MeterNumber>
</ClientDetail>
<Version>
<ServiceId>crs</ServiceId>
<Major>28</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<VariableOptions>FEDEX_ONE_RATE</VariableOptions>
<RequestedShipment>
<DropoffType>REGULAR_PICKUP</DropoffType>
<PackagingType>FEDEX_SMALL_BOX</PackagingType>
<Shipper>
<Address>
<StateOrProvinceCode>TN</StateOrProvinceCode>
<PostalCode>38017</PostalCode>
<CountryCode>US</CountryCode>
<Residential>false</Residential>
</Address>
</Shipper>
<Recipient>
<Address>
<StateOrProvinceCode>CA</StateOrProvinceCode>
<PostalCode>90028</PostalCode>
<CountryCode>US</CountryCode>
<Residential>false</Residential>
</Address>
</Recipient>
<ShippingChargesPayment>
<PaymentType>SENDER</PaymentType>
<Payor>
<ResponsibleParty>
<AccountNumber>...</AccountNumber>
</ResponsibleParty>
</Payor>
</ShippingChargesPayment>
<RateRequestTypes>LIST</RateRequestTypes>
<PackageCount>1</PackageCount>
<RequestedPackageLineItems>
<GroupPackageCount>1</GroupPackageCount>
<Weight>
<Units>LB</Units>
<Value>10.00</Value>
</Weight>
</RequestedPackageLineItems>
</RequestedShipment>
</RateRequest>
The corresponding response would be (I've omitted a lot of the details in order to highlight the important parts):
<RateReply>
<HighestSeverity>SUCCESS</HighestSeverity>
<Notifications>
<Severity>SUCCESS</Severity>
<Source>crs</Source><Code>0</Code>
<Message>Request was successfully processed. </Message>
<LocalizedMessage>Request was successfully processed. </LocalizedMessage>
</Notifications>
<Version>
<ServiceId>crs</ServiceId>
<Major>28</Major>
<Intermediate>0</Intermediate>
<Minor>0</Minor>
</Version>
<RateReplyDetails>
<ServiceType>FIRST_OVERNIGHT</ServiceType>
...
<PackagingType>FEDEX_SMALL_BOX</PackagingType>
<DestinationAirportId>BUR</DestinationAirportId>
<ActualRateType>PAYOR_ACCOUNT_PACKAGE</ActualRateType>
<RatedShipmentDetails>
...
</RatedShipmentDetails>
</RateReplyDetails>
<RateReplyDetails>
<ServiceType>FIRST_OVERNIGHT</ServiceType>
...
<PackagingType>FEDEX_SMALL_BOX</PackagingType>
<AppliedOptions>FEDEX_ONE_RATE</AppliedOptions>
<DestinationAirportId>BUR</DestinationAirportId>
<ActualRateType>PAYOR_ACCOUNT_PACKAGE</ActualRateType>
<RatedShipmentDetails>
<ShipmentRateDetail>
<SpecialRatingApplied>FEDEX_ONE_RATE</SpecialRatingApplied>
...
</ShipmentRateDetail>
...
</RatedShipmentDetails>
</RateReplyDetails>
</RateReply>
I.e. for each ServiceType
(e.g. FIRST_OVERNIGHT
) two set of rates are returned: one without and one with the FEDEX_ONE_RATE
applied (as highlighted by the presence of the AppliedOptions
and SpecialRatingApplied
elements in the RateReplyDetails
).
Upvotes: 1