Skip to content
Home » FedEx

FedEx

FedEx Integration Guide

Connect FTM’s Transportation Management System (TMS) with FedEx Freight APIs to request real-time LTL rate quotes, including Economy and Priority services.

Overview

The FedEx Freight integration enables FTM users to obtain live rate quotes and transit times directly from FedEx Freight.
Each Lane Quote record can retrieve:

  • Accurate Freight charges (Net Charge)
  • Estimated Transit Days
  • Service Type (Economy or Priority)

This integration consists of two Apex controllers:

  • FedexEconomyInteg → For FEDEX_FREIGHT_ECONOMY quotes
  • FedexPriorityInteg → For FEDEX_FREIGHT_PRIORITY quotes

Both controllers build, authenticate, and send JSON-based API requests to FedEx, parse the returned rate information, and display the results in Salesforce.


1️⃣ User Information

Purpose

The integration helps users:

  • Instantly get Economy and Priority rate quotes within the Lane Quote page.
  • Retrieve estimated transit days and total net charge directly from FedEx.
  • Avoid manual rate entry or website lookups.

How It Works (User Perspective)

  1. Open any Lane Quote record in FTM.
  2. Choose between Economy or Priority quote options.
  3. Click the “Get Data” button on the Visualforce page:
    • For Economy: runs FedexEconomyInteg.getData()
    • For Priority: runs FedexPriorityInteg.getData()
  4. FTM sends your lane’s details (pickup, delivery, freight class, weight, packaging, dimensions, payment type) to FedEx via API.
  5. Within seconds, the Total Net FedEx Charge and Transit Days are displayed.
  6. Optional: store these values into the Lane Quote for comparison and decision-making.

Key Features

✅ Supports both Economy and Priority Freight services
✅ Fetches real-time rates from FedEx API
✅ Displays Transit Days and Charges directly in Salesforce
✅ Uses secure OAuth2 authentication
✅ Fully configurable via FTM’s standard Lane Quote fields
✅ Compatible with sandbox and production environments

Important Notes

⚠️ U.S. and Canada addresses only (FedEx Freight service limitation)
⚠️ Requires a valid FedEx Freight Account Number (stored under User fields)
⚠️ No booking is performed, rate quote only
⚠️ Internet-accessible Salesforce org required (for API callouts)


Prerequisites

To use this integration:

  1. Ensure your User record has these populated:
    • FEDEX_AccountNumber__c
    • alternateBillingParty_FedExaccountNumber__c
  2. Ensure your Lane Quote record has valid:
    • Pickup & Delivery Address (City, State, Zip, Country)
    • Freight Class
    • Weight & Dimensions
    • Handling Units, Pieces, Sub-Packaging Type
    • Payment Type (e.g. “SENDER”, “THIRD_PARTY”)
  3. Verify you have access to the Visualforce pages connected to each integration.

Fields Used

ObjectFieldDescription
FreightTM__Lane_Quote__cFreightTM__Pickup_City__cOrigin City
FreightTM__Lane_Quote__cFreightTM__Delivery_City__cDestination City
FreightTM__Lane_Quote__cFreightTM__Pickup_Zip_Code__cOrigin Zip
FreightTM__Lane_Quote__cFreightTM__Delivery_Zip_Code__cDestination Zip
FreightTM__Lane_Quote__cFreight_Class__cFreight Class Code
FreightTM__Lane_Quote__cWeight_Value__cWeight Value
FreightTM__Lane_Quote__cweight_unit__cWeight Unit (e.g., LB)
FreightTM__Lane_Quote__cPieces__cNumber of Pieces
FreightTM__Lane_Quote__cHandling_Units__cHandling Units Count
FreightTM__Lane_Quote__cSub_Packaging_Type__cPackaging Type (PALLET, BOX, etc.)
FreightTM__Lane_Quote__cFEDEX_PaymentType__cPayment Type
FreightTM__Lane_Quote__cRole__cRole (SHIPPER / CONSIGNEE)
FreightTM__Lane_Quote__cRate_Request_Type__cACCOUNT / LIST
FreightTM__Lane_Quote__clength__c, width__c, height__c, Saia_Type__cDimensions & Units

2️ Developer Information

Apex Classes

  • FedexEconomyInteg
  • FedexPriorityInteg

Each controller:

  • Extends ApexPages.StandardController
  • Fetches data for the current Lane Quote (quoteId)
  • Builds request JSON dynamically using Lane Quote and User fields
  • Performs two-step authentication:
    1. POST /oauth/token → get Bearer Token
    2. POST /rate/v1/freight/rates/quotes → send quote request
  • Parses totalNetFedExCharge and transitDays from response

Endpoints

PurposeMethodURL
OAuth TokenPOSThttps://apis.fedex.com/oauth/token
Freight Rate QuotePOSThttps://apis.fedex.com/rate/v1/freight/rates/quotes

Authentication (OAuth 2.0)

  1. Create a FedEx Developer account and register your app.
  2. Obtain:
    • CLIENT_ID
    • CLIENT_SECRET
    • GRANT_TYPE = client_credentials
  3. Store them in a static resource named CredFed as JSON:
{
  "CLIENT_ID": "your_client_id_here",
  "CLIENT_SECRET": "your_secret_here",
  "GRANT_TYPE": "client_credentials"
}

4. The Apex code reads it using:

PageReference credentialsPageRef = new PageReference('/resource/CredFed');
String credentialsContent = credentialsPageRef.getContent().toString();

API Request Structure

Endpoint:

POST https://apis.fedex.com/rate/v1/freight/rates/quotes

Body Example (simplified):

{
  "rateRequestControlParameters": { "returnTransitTimes": true },
  "accountNumber": { "value": "773496030" },
  "freightRequestedShipment": {
    "serviceType": "FEDEX_FREIGHT_PRIORITY",
    "shipper": {
      "address": {
        "city": "Irving",
        "stateOrProvinceCode": "TX",
        "postalCode": "75063",
        "countryCode": "US"
      }
    },
    "recipient": {
      "address": {
        "city": "Beverly",
        "stateOrProvinceCode": "MA",
        "postalCode": "01915",
        "countryCode": "US"
      }
    },
    "shippingChargesPayment": {
      "paymentType": "SENDER",
      "payor": {
        "responsibleParty": {
          "accountNumber": { "value": "00702520" }
        }
      }
    },
    "freightShipmentDetail": {
      "role": "SHIPPER",
      "alternateBillingParty": {
        "accountNumber": { "value": "00702520" },
        "address": {
          "streetLines": ["314 N MIDDLETOWN RD"],
          "city": "MEDIA",
          "stateOrProvinceCode": "PA",
          "postalCode": "19063",
          "countryCode": "US"
        }
      },
      "lineItem": [{
        "freightClass": "CLASS_050",
        "handlingUnits": "1",
        "pieces": 1,
        "subPackagingType": "PALLET",
        "id": "books",
        "weight": { "units": "LB", "value": "1200.00" },
        "dimensions": { "length": 40, "width": 69, "height": 48, "units": "IN" }
      }]
    },
    "rateRequestType": ["ACCOUNT"]
  }
}

Response Example

{
  "transactionId": "abcd123",
  "output": {
    "rateReplyDetails": [
      {
        "serviceType": "FEDEX_FREIGHT_PRIORITY",
        "ratedShipmentDetails": [
          {
            "totalNetFedExCharge": 1200.50,
            "totalBaseCharge": 1100.00
          }
        ],
        "commit": {
          "transitDays": {
            "description": "2 business days"
          }
        }
      }
    ]
  }
}

Parsed Fields

JSON FieldDescriptionUsed For
output.rateReplyDetails[0].ratedShipmentDetails[0].totalNetFedExChargeTotal charge in USDDisplay/Store in FTM
output.rateReplyDetails[0].commit.transitDays.descriptionTransit time textExtracted as number (e.g., 2)
serviceTypeFEDEX_FREIGHT_PRIORITY / ECONOMYInternal reference

Implementation Notes

  • Both classes are global virtual for easy extension.
  • FedEx credentials are read from a static resource (CredFed).
  • ServiceType differs per integration class:
    • FedexEconomyInteg “FEDEX_FREIGHT_ECONOMY”
    • FedexPriorityInteg“FEDEX_FREIGHT_PRIORITY”
  • Handles dynamic country-to-code mapping for 200+ countries.
  • Parses and extracts numeric days from text like “2 business days”.
  • Displays callout result in Visualforce, optionally updating fields.

Error Handling

ErrorMeaningSuggested Action
401 UnauthorizedInvalid credentialsVerify CLIENT_ID / CLIENT_SECRET
403 ForbiddenFedEx account not authorized for Freight APIContact FedEx support
400 Bad RequestMissing required address/fieldsCheck Lane Quote inputs
500 Server ErrorFedEx API temporary issueRetry after short delay

Testing

You can simulate requests using a test Lane Quote ID:

FedexPriorityInteg.makeCallout(‘a0HXXXXXXXXXXXX’);

FedexEconomyInteg.makeCallout(‘a0HXXXXXXXXXXXX’);

Or run directly from the Visualforce button “Get Data”.

Deployment Checklist

✅ Add Remote Site Settings for https://apis.fedex.com
✅ Upload CredFed static resource (JSON credentials)
✅ Ensure Lane Quote page references the correct Visualforce page (FedexPriorityInteg.page, FedexEconomyInteg.page)
✅ Verify user field permissions for:

  • FEDEX_AccountNumber__c
  • alternateBillingParty_FedExaccountNumber__c

✅ Ensure Apex class access is granted to target profiles


Support

📧 FTM Integration Support: [email protected] 

📧 FedEx Developer Support: [email protected] 

Leave a Reply

Your email address will not be published. Required fields are marked *


Let's Talk!

Thanks for stopping by! We're here to help, please don't hesitate to reach out.

Watch a Demo