Create FedEx Shipment action using FedEx Ship API

TeamTracks leverages the FedEx Ship API for organizations to create return shipping labels. If you are a FedEx customer, you can use the FedEx Create Shipment action to automatically create a return label and send it to your client all at the click of a button.

This version of the action is limited to the following

  1. The shipment is on the receiverโ€™s account and is paid by the receiver.

  2. Only one FedEx shipping account can be used.

Prerequisites

  1. FedEx Developer Account

  2. FedEx Shipping Account

Obtaining credentials for Test environment

Create a new project in FedEx developer portal with the Ship API to get API key and account number for the FedEx development environment.

FedEx Create Project_7

Select โ€˜Ships with FedEx and is using a third-party software solution that has requested API keysโ€™

FedEx Create Project_6

Provide info regarding Teamtracks. FedEx will ask you to consider a fedEx certified provider. DO NOT FALL FOR IT. IT IS A TRICK.!!!

FedEx Create Project_5

Select Ship API from the table of available APIs

FedEx Create Project_3

FedEx Create Project_4

Name the project and add a country. Currently only United States and Canada are supported.

Freight LTL and SmartPost Returns are not supported.


FedEx Create Project_2

Review and create the project.

FedEx Create Project_1

Use your test key to set up the action.

System Settings

You have the test key, it is time to set up TeamTracks. Start by adding the Test key to TeamTracks under system settings.

Adminโ€”>System Settingsโ€”>Shipping

Under the shipping tab, set environment type as development and enter the API key, Secret key and Account number from the โ€˜Test keyโ€™ section of  your project.

Production environment will not work until the Ship API is certified by FedEx.

Setting up the CreateFedExShipment (Beta) Action.

Create the action in the track you need to generate the return shipping labels from.

Action Setup

The action configuration is broadly divided into 5 main areas.

  1. Shipper Details - Info regarding the shipper, ie your client, who ships the product.

  2. Receiver Details - Info regarding the receiver, ie, you, the company, who receives and pays for the shipping.

  3. Service Details - Info regarding the shipment viz, payment type, pickup type, service type etc.

  4. Package Info - Weight of the package

  5. Response fields - These fields are used to store the FedEx response viz the shipping label, tracking number and cost.

These are all dropdowns that let you select a field from the current track. As admin, you need to create these fields in the track and map them in the action.

Payment Type

FedEx integration currently offers three payment types

  1. Sender - The payment is borne by the sender of the shipment.

  2. Recipient - The payment is borne by the recipient of the shipment. This option is the default and used when the company is issuing return shipping labels to the customer to ship the product back to the company. When this option is selected, the account number defined in system settings is used as the payment account.

  3. Third Party - The payment is borne by a third party other than the sender or receiver. This option should be used when the company is shipping products from the customer to a third part reapir sender or vice versa. When payor is third party, the details of the third party will need to be mapped to appropriate fields, including account number.

Field setup tips

The goal here is to provide you with as much flexibility as possible in the configuration. Since we are mapping fields to the action and not static values, it gives you the ability to dynamically change the shipment attributes using other automations like changefield action, lookup or choice fields.

  1. If you need static values for these inputs, you can define text fields with default value  being the static value you need.


Data Validation

FedEx is very particular with the data it accepts via the API. It is recommended that certain fields are setup as choice fields to eliminate the possibility of failures.

Fields with enumeration requirements

  1. Shipper & Receiver Country -See this link for country codes.

  2. Shipper & Receiver Province

    1. Canada Province codes here

    2. US State codes here

  3. Pickup Type - See this link for Pickup Types

  4. Service Type - See this link for available service types in US Region.

  5. Packaging Type - See this link for package types and weight limits.

  6. Package Weight Unit - Use KG for kilogram, LB for pounds, G for grams, OZ for ounce.

Field type requirements

Shipping label output field has to be a โ€˜Fileโ€™ field as it has to hold the FedEx shipping label as a pdf. The shipment cost output field and package weight value field must be a float fields.

Please ensure enough provisions are put in place to ensure that the addresses are correctly entered. FedEx checks the Postal code against the province and will show an error if the postal code is for the wrong province. The action does not do any other validations on the address.

Once the action is created, use a trigger or button to trigger the action in the workflow.

Provide enough safeguards so that multiple shipments are not created. It is recommended to put a {NotEquals โ€˜nullโ€™} check for either the label or tracking number fields for the trigger/button.

Triggering the action with a button

The action will create a history record on the object.

The details button on the history will give you the Raw Request and Raw Response for troubleshooting.

Moving the project to production

Create production keys

Once the setup is complete, you will need FedEx to certify the API before you can use the production environment.

Set up the production key from the developer portal and enter then in TeamTracks under system settings.

API certification

Follow instruction on the API certification page [https://developer.fedex.com/api/en-us/certification.html] to certify the API.

API certification is a 7 step process. You can start at step 3 as steps 1 and 2 are already done.

Since you will be emailing the shipping label to the customer, create a test shipping label using the test credentials and send the pdf file to FedEx along with the label cover sheet.

Switch TeamTracks to use production environment.

Once the API is certified by FedEx, switch the environment type to production under system settings and you are ready to issue return labels automatically to your customer.