### Install FedexRest Library Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Instructions for installing the FedexRest PHP library using Composer. This command adds the library as a dependency to your project. ```php composer require whatarmy/fedex-rest "^0.5" ``` -------------------------------- ### Create FedEx Shipment with PHP Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Provides an example of creating a FedEx shipment using PHP. This involves setting shipment details such as account number, service type, packaging, pickup type, payment, ship date, label options, shipper, recipients, and line items. The `request()` method initiates the shipment creation. ```php $request = (new CreateShipment()) ->setAccessToken((string) $this->auth->authorize()->access_token) ->setAccountNumber(749999999) ->setServiceType(ServiceType::_FEDEX_GROUND) ->setLabelResponseOptions(LabelResponseOptionsType::_URL_ONLY) ->setPackagingType(PackagingType::_YOUR_PACKAGING) ->setPickupType(PickupType::_DROPOFF_AT_FEDEX_LOCATION) ->setShippingChargesPayment((new ShippingChargesPayment()) ->setPaymentType('SENDER') ) ->setShipDatestamp((new \DateTime())->add(new \DateInterval('P3D'))->format('Y-m-d')) ->setLabel((new Label()) ->setLabelStockType(LabelStockType::_STOCK_4X6) ->setImageType(ImageType::_PDF) ) ->setShipper( (new Person) ->setPersonName('SHIPPER NAME') ->setPhoneNumber('1234567890') ->withAddress( (new Address()) ->setCity('Collierville') ->setStreetLines('SHIPPER STREET LINE 1') ->setStateOrProvince('TN') ->setCountryCode('US') ->setPostalCode('38017') ) ) ->setRecipients( (new Person) ->setPersonName('RECEIPIENT NAME') ->setPhoneNumber('1234567890') ->withAddress( (new Address()) ->setCity('Irving') ->setStreetLines('RECIPIENT STREET LINE 1') ->setStateOrProvince('TX') ->setCountryCode('US') ->setPostalCode('75063') ) ) ->setLineItems((new Item()) ->setItemDescription('lorem Ipsum') ->setWeight( (new Weight()) ->setValue(1) ->setUnit(WeightUnits::_POUND) ) ->setDimensions((new Dimensions()) ->setWidth(12) ->setLength(12) ->setHeight(12) ->setUnits(LinearUnits::_INCH) ) )->request(); ``` -------------------------------- ### FedEx Shipment Tracking Response Example Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This snippet illustrates a portion of a FedEx REST API response for shipment tracking. It includes details about package units, shipment possession status, scan events with location information, available notifications, delivery attempts, and service details. ```APIDOC FedExShipmentTrackingResponse: # ... other fields ... unit: "KG" shipmentDetails: possessionStatus: true scanEvents: - date: "2014-01-06T10:18:00-05:00" eventType: "PU" eventDescription: "Picked up" scanLocation: streetLines: [""] city: "FLORENCE" stateOrProvinceCode: "SC" postalCode: "29506" countryCode: "US" residential: false countryName: "United States" locationId: "0295" locationType: "PICKUP_LOCATION" derivedStatusCode: "PU" derivedStatus: "Picked up" availableNotifications: - "ON_DELIVERY" - "ON_EXCEPTION" - "ON_ESTIMATED_DELIVERY" deliveryDetails: deliveryAttempts: "0" deliveryOptionEligibilityDetails: - option: "INDIRECT_SIGNATURE_RELEASE" eligibility: "INELIGIBLE" - option: "REDIRECT_TO_HOLD_AT_LOCATION" eligibility: "INELIGIBLE" - option: "REROUTE" eligibility: "INELIGIBLE" - option: "RESCHEDULE" eligibility: "INELIGIBLE" destinationServiceArea: "EDDUNAVAILABLE" originLocation: locationContactAndAddress: address: city: "FLORENCE" stateOrProvinceCode: "SC" countryCode: "US" residential: false countryName: "United States" lastUpdatedDestinationAddress: city: "Jefferson" stateOrProvinceCode: "GA" countryCode: "US" residential: false countryName: "United States" serviceCommitMessage: message: "No scheduled delivery date available at this time." type: "ESTIMATED_DELIVERY_DATE_UNAVAILABLE" serviceDetail: type: "GROUND_HOME_DELIVERY" description: "FedEx Home Delivery" shortDescription: "HD" standardTransitTimeWindow: window: ends: # ... end time details ... ``` -------------------------------- ### Cancel Shipment API Example Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Demonstrates how to cancel a FedEx shipment using the API. It requires authentication via an access token and specifies the account number and tracking number for the shipment to be cancelled. The response indicates the transaction status and details of the cancellation. ```php $request = (new CancelShipment()) ->setAccessToken((string) $this->auth->authorize()->access_token) ->setAccountNumber(749999999) ->setTrackingNumber(794953555571) ->request(); ``` ```php stdClass Object ( [transactionId] => 99ba99f9-9999-99f9-a99d-9a9c9e9ac99a [output] => stdClass Object ( [alerts] => Array ( [0] => stdClass Object ( [code] => VIRTUAL.RESPONSE [message] => This is a Virtual Response. [alertType] => NOTE ) ) [cancelledShipment] => 1 [cancelledHistory] => 1 ) ) ``` -------------------------------- ### Create FedEx Rates Request Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Demonstrates building a FedEx shipping rates request using the FedEx PHP SDK. It shows how to set access tokens, account numbers, pickup types, shipper and recipient addresses, and line item details before making the request. ```php $request = (new CreateRatesRequest) ->setAccessToken((string)$this->auth->authorize()->access_token) ->setAccountNumber(740561073) ->setRateRequestTypes('ACCOUNT', 'LIST') ->setPickupType(PickupType::_DROPOFF_AT_FEDEX_LOCATION) ->setShipper( (new Person) ->withAddress( (new Address()) ->setPostalCode('38017') ->setCountryCode('US') ) ) ->setRecipient( (new Person) ->withAddress( (new Address()) ->setPostalCode('75063') ->setCountryCode('US') ) ) ->setLineItems((new Item()) ->setWeight( (new Weight()) ->setValue(1) ->setUnit(WeightUnits::_POUND) ) ) ->request(); ``` -------------------------------- ### FedEx API Documentation Links Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Provides links to the official FedEx API documentation for various services. These links are essential for understanding the full capabilities and specifications of each API. ```APIDOC FedEx Rest API Documentation: https://developer.fedex.com/api/en-us/get-started.html Services: Ship API: Create Shipment: https://developer.fedex.com/api/en-us/catalog/ship/docs.html#operation/Create%20Shipment Cancel Shipment: https://developer.fedex.com/api/en-us/catalog/ship/docs.html#operation/Cancel%20Shipment Create Tag: https://developer.fedex.com/api/en-us/catalog/ship/docs.html#operation/Create%20Tag Cancel Tag: https://developer.fedex.com/api/en-us/catalog/ship/docs.html#operation/CancelTag Track API: Track by Tracking Number: https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html#operation/Track%20by%20Tracking%20Number Track Document: https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html Track Multiple Piece Shipment: https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html Send Notification: https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html Track By Tracking Control Number: https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html Track By References: https://developer.fedex.com/api/en-us/catalog/track/v1/docs.html Address Validation API: Validate Address: https://developer.fedex.com/api/en-us/catalog/address-validation/v1/docs.html#operation/Validate%20Address Locations Search API: Find Locations: https://developer.fedex.com/api/en-us/catalog/locations/v1/docs.html Ground End of Day Close API: (No specific link provided in source) Pickup Request API: Create Pickup: (No specific link provided in source) Cancel Pickup: (No specific link provided in source) Check Pickup Availability: (No specific link provided in source) Postal Code Validation API: (No specific link provided in source) Rate Quotes API: (No specific link provided in source) Service Availability API: (No specific link provided in source) Other: OAuth Authorization: https://developer.fedex.com/api/en-us/catalog/authorization/v1/docs.html ``` -------------------------------- ### PHP Sample Response Structure for FedEx API Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This snippet illustrates a typical response object from the FedEx REST API. It details transaction identifiers, shipment specifics like service type and dates, and piece-level tracking data including delivery timestamps and document URLs. ```PHP stdClass Object ( [transactionId] => 99ba99f9-9999-99f9-a99d-9a9c9e9ac99a [output] => stdClass Object ( [transactionShipments] => Array ( [0] => stdClass Object ( [masterTrackingNumber] => 794699999999 [serviceType] => FEDEX_GROUND [shipDatestamp] => 2023-01-22 [serviceName] => FedEx Ground® [pieceResponses] => Array ( [0] => stdClass Object ( [masterTrackingNumber] => 794699999999 [deliveryDatestamp] => 2023-01-25 [trackingNumber] => 794699999999 [additionalChargesDiscount] => 0 [netRateAmount] => 0 [netChargeAmount] => 0 [netDiscountAmount] => 0 [packageDocuments] => Array ( [0] => stdClass Object ( [url] => https://wwwtest.fedex.com/document/v2/document/retrieveThermal/SH,31b7d2e9c193913c794699999999_SHIPPING_Z/isLabel=true&autoPrint=false [contentType] => LABEL [copiesToPrint] => 1 [docType] => PDF ) ) [currency] => USD [customerReferences] => Array ( ) [codcollectionAmount] => 0 [baseRateAmount] => 17.4 ) ) [completedShipmentDetail] => stdClass Object ( [usDomestic] => 1 [carrierCode] => FDXG [masterTrackingId] => stdClass Object ( [trackingIdType] => FEDEX [trackingNumber] => 794699999999 ) [serviceDescription] => stdClass Object ( [serviceId] => EP1000000134 [serviceType] => FEDEX_GROUND [code] => 92 [names] => Array ( [0] => stdClass Object ( [type] => long [encoding] => utf-8 [value] => FedEx Ground® ) [1] => stdClass Object ( [type] => long [encoding] => ascii [value] => FedEx Ground ) [2] => stdClass Object ( [type] => medium [encoding] => utf-8 [value] => Ground® ) [3] => stdClass Object ( [type] => medium ``` -------------------------------- ### FedEx Shipping Service and Rate Information Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This entry details the structure of a FedEx API response for shipping services. It includes service types, names, packaging options, and comprehensive rate breakdowns such as base charges, discounts, surcharges (like fuel), and total net charges. It also specifies weight details and currency. ```APIDOC FedExShippingResponse: serviceType: string - The type of FedEx service (e.g., FEDEX_2_DAY). serviceName: string - The human-readable name of the service (e.g., FedEx 2Day®). packagingType: string - The type of packaging used for the shipment (e.g., YOUR_PACKAGING). ratedShipmentDetails: Array of RateDetailObjects - Contains details about the rated shipment. RateDetailObject: rateType: string - The type of rate applied (e.g., ACCOUNT, PAYOR). ratedWeightMethod: string - The method used for rating weight (e.g., ACTUAL, DIM). totalDiscounts: number - Total discounts applied to the shipment. totalBaseCharge: number - The base charge for the shipment before surcharges and discounts. totalNetCharge: number - The final net charge for the shipment. totalNetFedExCharge: number - The net charge specific to FedEx. shipmentRateDetail: ShipmentRateDetailObject - Detailed breakdown of shipment rates. ShipmentRateDetailObject: rateZone: string - The rate zone applicable to the shipment. dimDivisor: number - Dimensional divisor used for calculating shipping costs. fuelSurchargePercent: number - Percentage of fuel surcharge applied. totalSurcharges: number - Total amount of all surcharges. totalFreightDiscount: number - Total discount applied to freight charges. surCharges: Array of SurchargeObject - List of individual surcharges applied. pricingCode: string - The pricing code used (e.g., PACKAGE, WEIGHT). totalBillingWeight: WeightObject - The total weight used for billing purposes. currency: string - The currency of the charges (e.g., USD). SurchargeObject: type: string - The type of surcharge (e.g., FUEL, TAX). description: string - Description of the surcharge. amount: number - The amount of the surcharge. WeightObject: units: string - The unit of weight (e.g., LB, KG). value: number - The weight value. ServiceValueObject: type: string - Type of service value (e.g., medium, short, abbrv). encoding: string - Encoding of the value (e.g., ascii, utf-8). value: string - The actual service value (e.g., FedEx 2Day® AM, E2AM, TA). ``` -------------------------------- ### FedEx Shipping Rate Response Structure Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This entry describes the typical structure of a FedEx shipping rate response, detailing various financial components and shipment characteristics. It includes base charges, surcharges, taxes, discounts, and weight information, often represented as nested objects and arrays. ```APIDOC FedExRateResponse: # Represents the overall rate details for a shipment. # Contains financial summaries and detailed breakdowns. totalSurcharges: number # The sum of all surcharges applied to the shipment. # Example: 17.16 netFedExCharge: number # The net charge after applying discounts and surcharges, specific to FedEx. # Example: 131.55 totalTaxes: number # The total amount of taxes applied to the shipment. # Example: 0 netCharge: number # The final net charge for the shipment after all adjustments. # Example: 131.55 totalRebates: number # The total value of rebates applied to the shipment. # Example: 0 billingWeight: BillingWeightObject # Details about the weight used for billing purposes. totalFreightDiscounts: number # The total amount of discounts applied to the freight charges. # Example: 0 surcharges: SurchargeObject[] # An array of surcharge objects, detailing each applied surcharge. currency: string # The currency code for all monetary values (e.g., 'USD'). # --- Nested Objects --- BillingWeightObject: # Represents the weight used for billing. units: string # The unit of weight (e.g., 'LB' for pounds, 'KG' for kilograms). value: number # The numerical value of the weight. # Example: 1 SurchargeObject: # Details of an individual surcharge. type: string # The type code for the surcharge (e.g., 'FUEL'). description: string # A human-readable description of the surcharge. # Example: 'Fuel Surcharge' amount: number # The monetary amount of the surcharge. # Example: 17.16 # --- Additional Rate Details (often within shipmentRateDetail) --- rateType: string # The type of rate applied (e.g., 'LIST'). ratedWeightMethod: string # The method used to determine the rated weight (e.g., 'ACTUAL'). totalDiscounts: number # Total discounts applied to this specific rate calculation. # Example: 0 totalBaseCharge: number # The base charge before any surcharges or discounts. # Example: 114.39 totalNetFedExCharge: number # Net FedEx charge for this specific rate calculation. # Example: 131.55 shipmentRateDetail: ShipmentRateDetailObject # Detailed breakdown of the rate calculation for the shipment. ratedPackages: RatedPackageObject[] # Array of package-specific rate details. ShipmentRateDetailObject: # Detailed breakdown of rate calculation. rateZone: string # The rate zone applicable to the shipment. # Example: '06' dimDivisor: number # Dimensional divisor used in calculations. # Example: 0 fuelSurchargePercent: number # The percentage applied for fuel surcharge. # Example: 15 totalFreightDiscount: number # Total freight discount for this detail. # Example: 0 surCharges: SurchargeObject[] # Array of surcharges specific to this rate detail. pricingCode: string # The pricing code used (e.g., 'PACKAGE'). totalBillingWeight: BillingWeightObject # Billing weight for this specific rate detail. rateScale: number # The rate scale identifier. # Example: 14 RatedPackageObject: # Details for an individual package. groupNumber: number # The group number the package belongs to. # Example: 0 effectiveNetDiscount: number # The net discount applied to this package. # Example: 0 ``` -------------------------------- ### FedEx REST API Rate Response Details Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This entry describes the structure of the rate response data obtained from the FedEx REST API. It includes details on package rates, shipment rates, surcharges, and weight information, typically returned after a rate request is processed. The structure is presented in a format suitable for API documentation. ```APIDOC FedExRateResponse: rateReplyDetails: Array of objects, each representing a rate detail. rateReplyDetails[n]: Object effectiveNetDiscount: Number packageRateDetail: Object rateType: String (e.g., PAYOR_ACCOUNT_PACKAGE, LIST) ratedWeightMethod: String (e.g., ACTUAL) baseCharge: Number netFreight: Number totalSurcharges: Number netFedExCharge: Number totalTaxes: Number netCharge: Number totalRebates: Number billingWeight: Object units: String (e.g., LB, KG) value: Number totalFreightDiscounts: Number surcharges: Array of objects surcharges[m]: Object type: String (e.g., FUEL) description: String (e.g., Fuel Surcharge) amount: Number currency: String (e.g., USD) shipmentRateDetail: Object (Optional, may be present in some rate types) rateZone: String dimDivisor: Number fuelSurchargePercent: Number totalSurcharges: Number totalFreightDiscount: Number surCharges: Array of objects (Similar structure to packageRateDetail.surcharges) surCharges[m]: Object type: String description: String amount: Number pricingCode: String (e.g., PACKAGE) totalBillingWeight: Object units: String value: Number currency: String (e.g., USD) ``` -------------------------------- ### FedEx Shipping Service and Rate Details Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This entry describes the structure of data returned for a specific FedEx shipping service. It includes service identifiers, packaging types, and detailed rating information such as base charges, discounts, surcharges (like fuel), and weight details. The structure is presented in a format resembling a PHP stdClass object array, common in API responses. ```APIDOC FedExServiceDetails: serviceType: string - Example: "PRIORITY_OVERNIGHT" serviceName: string - Example: "FedEx Priority Overnight®" packagingType: string - Example: "YOUR_PACKAGING" ratedShipmentDetails: array of FedExRatedShipmentDetail FedExRatedShipmentDetail: rateType: string - Example: "ACCOUNT" ratedWeightMethod: string - Example: "ACTUAL" totalDiscounts: number - Example: 0 totalBaseCharge: number - Example: 83.39 totalNetCharge: number - Example: 95.9 totalNetFedExCharge: number - Example: 95.9 shipmentRateDetail: FedExShipmentRateDetail ratedPackages: array of FedExRatedPackage FedExShipmentRateDetail: rateZone: string - Example: "06" dimDivisor: number - Example: 0 fuelSurchargePercent: number - Example: 15 totalSurcharges: number - Example: 12.51 totalFreightDiscount: number - Example: 0 surCharges: array of FedExSurcharge pricingCode: string - Example: "PACKAGE" totalBillingWeight: FedExWeight currency: string - Example: "USD" rateScale: string - Example: "1574" FedExSurcharge: type: string - Example: "FUEL" description: string - Example: "Fuel Surcharge" amount: number - Example: 12.51 FedExRatedPackage: groupNumber: number - Example: 0 effectiveNetDiscount: number - Example: 0 packageRateDetail: FedExPackageRateDetail FedExPackageRateDetail: ... (details for individual package rates) FedExWeight: units: string - Example: "LB" value: number - Example: 1 Service Codes Example: [0] => stdClass Object ( [serviceType] => FIRST_OVERNIGHT [serviceCategory] => parcel [description] => First Overnight [astraDescription] => 1ST OVR [serviceTypeCode] => Array ( [0] => stdClass Object ( [type] => fedex_first_overnight [encoding] => ascii [value] => FedEx First Overnight ) [4] => stdClass Object ( [type] => short [encoding] => utf-8 [value] => FO ) [5] => stdClass Object ( [type] => short [encoding] => ascii [value] => FO ) [6] => stdClass Object ( [type] => abbrv [encoding] => ascii [value] => FO ) ) ) ``` -------------------------------- ### FedEx Rate Response Structure Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This snippet outlines the common fields found in a FedEx rate response object. It includes details on pricing, weight, surcharges, and currency, representing a typical data payload for shipping rate inquiries. ```data-structure { "rateType": "string", "ratedWeightMethod": "string", "baseCharge": "number", "netFreight": "number", "totalSurcharges": "number", "netFedExCharge": "number", "totalTaxes": "number", "netCharge": "number", "totalRebates": "number", "billingWeight": { "units": "string", "value": "number" }, "totalFreightDiscounts": "number", "surcharges": [ { "type": "string", "description": "string", "amount": "number" } ], "currency": "string", "shipmentRateDetail": { "rateZone": "string", "dimDivisor": "number", "fuelSurchargePercent": "number", "totalSurcharges": "number", "totalFreightDiscount": "number", "surCharges": [ { "type": "string", "description": "string", "amount": "number" } ], "pricingCode": "string", "totalBillingWeight": { "units": "string", "value": "number" }, "currency": "string", "rateScale": "number" }, "ratedPackages": "array" } ``` -------------------------------- ### PHP: Create FedEx Tag Request Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This snippet demonstrates how to build a `CreateTagRequest` object for the FedEx API using PHP. It showcases setting various shipping details such as account number, service type, packaging, pickup, shipper and recipient addresses, and line item information. The code relies on a fluent interface for object construction. ```PHP $request = (new CreateTagRequest()) ->setAccessToken((string) $this->auth->authorize()->access_token) ->setAccountNumber(740561073) ->setServiceType(ServiceType::_FEDEX_GROUND) ->setPackagingType(PackagingType::_YOUR_PACKAGING) ->setPickupType(PickupType::_DROPOFF_AT_FEDEX_LOCATION) ->setShipDatestamp((new \DateTime())->add(new \DateInterval('P3D'))->format('Y-m-d')) ->setShipper( (new Person) ->setPersonName('SHIPPER NAME') ->setPhoneNumber('1234567890') ->withAddress( (new Address()) ->setCity('Collierville') ->setStreetLines('RECIPIENT STREET LINE 1') ->setStateOrProvince('TN') ->setCountryCode('US') ->setPostalCode('38017') ) ) ->setRecipients( (new Person) ->setPersonName('RECEIPIENT NAME') ->setPhoneNumber('1234567890') ->withAddress( (new Address()) ->setCity('Irving') ->setStreetLines('RECIPIENT STREET LINE 1') ->setStateOrProvince('TX') ->setCountryCode('US') ->setPostalCode('75063') ) ) ->setLineItems((new Item()) ->setItemDescription('lorem Ipsum') ->setWeight( (new Weight()) ->setValue(1) ->setUnit('LB') )) ->request(); ``` -------------------------------- ### FedEx Rate Response Structure Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This section details the typical structure of a response from the FedEx REST API when requesting shipping rates. It includes information on rated weight, base charges, net charges, surcharges, and billing weight details. ```APIDOC FedExRateResponse: # Represents a single rate detail object within the response. RateDetail: # Type of rate applied (e.g., LIST,$.;ACTUAL). rateType: string # Method used for rating (e.g., ACTUAL, WEIGHT). ratedWeightMethod: string # Total discounts applied to the rate. totalDiscounts: number # Total base charge before surcharges and discounts. totalBaseCharge: number # Net charge after all adjustments. totalNetCharge: number # Net charge specific to FedEx services. totalNetFedExCharge: number # Details about the shipment's rating, including zones and surcharges. shipmentRateDetail: # The shipping zone for the shipment. rateZone: string # Dimensional divisor used in calculations. dimDivisor: number # Percentage of fuel surcharge. fuelSurchargePercent: number # Total amount of all surcharges. totalSurcharges: number # Total freight discount applied. totalFreightDiscount: number # Array of surcharge objects. surCharges: [ { # Type of surcharge (e.g., FUEL). type: string # Description of the surcharge. description: string # Level at which the surcharge applies (e.g., PACKAGE). level: string # Amount of the surcharge. amount: number } ] # Total billing weight of the shipment. totalBillingWeight: # Unit of weight (e.g., LB, KG). units: string # Numerical value of the weight. value: number # Currency of the charges. currency: string # Array of rated packages, if applicable. ratedPackages: [ # Object representing a single rated package. # (Structure not fully detailed in provided text) ] # Base charge for the shipment. baseCharge: number # Net freight charge. netFreight: number # Total surcharges applied. totalSurcharges: number # Net charge from FedEx. netFedExCharge: number # Total taxes applied. totalTaxes: number # Net charge for the shipment. netCharge: number # Total rebates applied. totalRebates: number # Billing weight details. billingWeight: # Unit of weight (e.g., LB, KG). units: string # Numerical value of the weight. value: number # Total freight discounts. totalFreightDiscounts: number # Array of surcharge objects specific to this rate detail. surcharges: [ { # Type of surcharge (e.g., FUEL). type: string # Description of the surcharge. description: string # Level at which the surcharge applies (e.g., PACKAGE). level: string # Amount of the surcharge. amount: number } ] # Currency of the charges. currency: string # Example of a nested rate detail object (potentially for different service types or options). # This structure mirrors the RateDetail above but might represent a different calculation path. RateDetail_Alternative: rateType: string ratedWeightMethod: string totalDiscounts: number totalBaseCharge: number totalNetCharge: number totalNetFedExCharge: number shipmentRateDetail: rateZone: string dimDivisor: number fuelSurchargePercent: number totalSurcharges: number totalFreightDiscount: number surCharges: [ { type: string description: string level: string amount: number } ] totalBillingWeight: units: string value: number currency: string ratedPackages: [ # Object representing a single rated package. # (Structure not fully detailed in provided text) ] currency: string ``` -------------------------------- ### FedEx Shipping Rate Response Structure Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This entry details the hierarchical structure of a FedEx API response for shipping rates. It includes information on package details, charges, surcharges, and service descriptions. The structure is presented in a schema-like format for clarity. ```APIDOC FedExRateResponse: // Represents the overall response from a FedEx rating request. output: { // Contains the primary output details of the rating request. // ... other output fields ... ratedShipment: // Details about the rated shipment. // ... other ratedShipment fields ... ratedPackages: [ // Array of packages included in the shipment. { // Details for a single package. groupNumber: number, effectiveNetDiscount: number, packageRateDetail: // Detailed rate information for the package. { rateType: string, // e.g., PAYOR_LIST_PACKAGE ratedWeightMethod: string, // e.g., ACTUAL baseCharge: number, netFreight: number, totalSurcharges: number, netFedExCharge: number, totalTaxes: number, netCharge: number, totalRebates: number, billingWeight: // Weight used for billing purposes. { units: string, // e.g., LB value: number }, totalFreightDiscounts: number, surcharges: [ // Array of surcharges applied to the package. { type: string, // e.g., FUEL description: string, // e.g., Fuel Surcharge amount: number } ], currency: string // e.g., USD } } ], currency: string // e.g., USD }, operationalDetail: // Operational details related to the shipment. { ineligibleForMoneyBackGuarantee: string, // Empty if eligible, otherwise a reason. astraDescription: string, // e.g., 2DAY AM airportId: string, // e.g., EWR serviceCode: string // e.g., 49 }, signatureOptionType: string, // e.g., SERVICE_DEFAULT serviceDescription: // Description of the service used. { serviceId: string, // e.g., EP1000000023 serviceType: string, // e.g., FEDEX_2_DAY_AM code: string, // e.g., 49 names: [ // Array of service names in different formats. { type: string, // e.g., long encoding: string, // e.g., utf-8 value: string // e.g., FedEx 2Day® AM } ] } } ``` -------------------------------- ### FedEx Package Tracking and Rating Response Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This entry details the structure of a FedEx API response for completed package information. It includes tracking identifiers, package sequence, and comprehensive rating details such as actual rates, billing weight, base charges, discounts, surcharges, taxes, and net charges. The structure is presented as a data schema. ```APIDOC FedExPackageResponse: # ... other fields ... completedPackageDetails: Array of PackageDetail PackageDetail: sequenceNumber: Integer trackingIds: Array of TrackingId groupNumber: Integer packageRating: PackageRating TrackingId: trackingIdType: String (e.g., "FEDEX") trackingNumber: String PackageRating: actualRateType: String (e.g., "PAYOR_ACCOUNT_PACKAGE") effectiveNetDiscount: Number packageRateDetails: Array of PackageRateDetail PackageRateDetail: rateType: String (e.g., "PAYOR_ACCOUNT_PACKAGE") ratedWeightMethod: String (e.g., "ACTUAL") minimumChargeType: String billingWeight: Weight baseCharge: Number totalFreightDiscounts: Number netFreight: Number totalSurcharges: Number netFedExCharge: Number totalTaxes: Number netCharge: Number totalRebates: Number surcharges: Array of Surcharge Weight: units: String (e.g., "LB") value: Number Surcharge: surchargeType: String (e.g., "RETURN_LABEL") level: String (e.g., "PACKAGE") description: String amount: Number ``` -------------------------------- ### FedEx Rate Response Structure Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Details the structure of a FedEx REST API response for shipping rate calculations. This includes package rate details, surcharges, billing weight, and currency information. ```APIDOC FedExRateResponse: groupNumber: integer effectiveNetDiscount: float packageRateDetail: rateType: string (e.g., PAYOR_ACCOUNT_PACKAGE, LIST) ratedWeightMethod: string (e.g., ACTUAL) baseCharge: float netFreight: float totalSurcharges: float netFedExCharge: float totalTaxes: float netCharge: float totalRebates: float billingWeight: units: string (e.g., LB, KG) value: float totalFreightDiscounts: float surcharges: array of SurchargeDetail currency: string (e.g., USD) shipmentRateDetail: rateZone: string dimDivisor: integer fuelSurchargePercent: float totalSurcharges: float totalFreightDiscount: float surCharges: array of SurchargeDetail pricingCode: string (e.g., PACKAGE) totalBillingWeight: units: string value: float SurchargeDetail: type: string (e.g., FUEL) description: string amount: float ``` -------------------------------- ### FedEx Track by Tracking Number API Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Shows how to use the Track by Tracking Number API to retrieve shipment tracking information. Requires a valid tracking number and an OAuth access token. ```php $response = (new \FedexRest\Services\Track\TrackByTrackingNumberRequest()) ->setTrackingNumber('020207021381215') //set tracking number ->setAccessToken('some_access_token') //oAuth access token ->request(); // The $response object contains the tracking details. ``` -------------------------------- ### FedEx Shipment Rating Details Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md This snippet illustrates the structure of data returned for a FedEx shipment rating. It includes origin and destination details, delivery date, service code, packaging, transit time, and a comprehensive breakdown of shipment rating details such as base charges, surcharges, and total net charges. ```php-data ( [originLocationNumber] => 386 [destinationLocationNumber] => 752 [deliveryDate] => 2023-01-31 [deliveryDay] => TUE [ineligibleForMoneyBackGuarantee] => [serviceCode] => 92 [packagingCode] => 01 [deliveryEligibilities] => Array ( [0] => SATURDAY_DELIVERY ) [transitTime] => TWO_DAYS [publishedDeliveryTime] => [scac] => ) [shipmentRating] => stdClass Object ( [actualRateType] => PAYOR_ACCOUNT_PACKAGE [shipmentRateDetails] => Array ( [0] => stdClass Object ( [rateType] => PAYOR_ACCOUNT_PACKAGE [rateScale] => [rateZone] => 4 [ratedWeightMethod] => ACTUAL [dimDivisor] => 0 [fuelSurchargePercent] => 5.5 [totalBillingWeight] => stdClass Object ( [units] => LB [value] => 1 ) [totalBaseCharge] => 11.46 [totalFreightDiscounts] => 0 [totalNetFreight] => 11.46 [totalSurcharges] => 1.68 [totalNetFedExCharge] => 13.14 [totalTaxes] => 0 [totalNetCharge] => 13.14 [totalRebates] => 0 [totalDutiesAndTaxes] => 0 [totalAncillaryFeesAndTaxes] => 0 [totalDutiesTaxesAndFees] => 0 [totalNetChargeWithDutiesAndTaxes] => 0 [surcharges] => Array ( [0] => stdClass Object ( [surchargeType] => RETURN_LABEL [level] => PACKAGE [description] => Printed return label [amount] => 1.05 ) [1] => stdClass Object ( [surchargeType] => FUEL [level] => PACKAGE [description] => FedEx Ground Fuel [amount] => 0.63 ) ) ) ) ) ``` -------------------------------- ### FedEx Package Rate Structure Source: https://github.com/whatarmy/fedexrest/blob/develop/README.md Details the structure of the package rate information returned by the FedEx REST API. This includes rate type, weight details, base charges, surcharges, taxes, and service descriptions. It represents a single package's rating. ```APIDOC FedExPackageRate: groupNumber: Integer effectiveNetDiscount: Float packageRateDetail: rateType: String (e.g., PAYOR_LIST_PACKAGE) ratedWeightMethod: String (e.g., ACTUAL) baseCharge: Float netFreight: Float totalSurcharges: Float netFedExCharge: Float totalTaxes: Float netCharge: Float totalRebates: Float billingWeight: units: String (e.g., LB, KG) value: Float totalFreightDiscounts: Float surcharges: Array of SurchargeDetail currency: String (e.g., USD) operationalDetail: ineligibleForMoneyBackGuarantee: Boolean (or empty string) astraDescription: String (e.g., FXG) airportId: String (e.g., EWR) serviceCode: String (e.g., 92) signatureOptionType: String (e.g., SERVICE_DEFAULT) serviceDescription: serviceId: String (e.g., EP1000000134) serviceType: String (e.g., FEDEX_GROUND) code: String (e.g., 92) names: Array of ServiceName SurchargeDetail: type: String (e.g., FUEL) description: String (e.g., Fuel Surcharge) level: String (e.g., PACKAGE) amount: Float ServiceName: type: String (e.g., long, medium) encoding: String (e.g., utf-8, ascii) value: String (e.g., FedEx Ground®) ```