Fulfillments
Fulfillments
Fulfillments are a multi-step process and this guide will go through all steps in detail. As a quick overview, the following are the steps required:
Statuses & Events
Statuses
Events
There is no event for deleting fulfillments since they instead get canceled, but their record will still remain.
Overview
The following is a typical lifecycle for a fulfillment.
Create fulfillment
Add the required inventory that needs to be shipped to the desired recipient from your specified location.
Pick Items (optional)
If your workflow does a pick and pack operation, you'll increment the `manifested_qty` field for each item.
Create parcel
Add the box or boxes into which you're going to pack the inventory items.
Pack parcel
Pack the items into the parcel(s) that you have added.
Generate shipping rates
Pass the fulfillment ID into the shipments API to get shipping rates for the parcel(s) you are shipping.
Get shipping label
Purchase a shipping label to complete the fulfillment. You can also set up private rates which do not require you to purchase a label if you are handling the shipping by yourself or sourcing a label off of the platform.
1. Create fulfillment
To create a fulfillment, you'll need to include the recipient, your location_id from where the fulfillment will be taking place, and the inventory or articles that you want to include. Some optional extra params are in the code example below as well.
There are two ways to go about working with inventory: either by using the inventory that is stored on Dispatch, or by bypassing it entirely if you are using a third party inventory solution. Both options are documented below.
Example
Internal Fulfillments
You may want to fulfill an order from one location within your org to another. In this case, the recipient location id must be defined.
This creates a fulfillment at location loc_afnHMjVUn3gnrvxU5zMvkX and a corresponding manifest at location loc_hj7gjrk5JaVvyATPDbyURp.
Using previously received parcels
If you have previously received parcels in the system that you want to send to a different location without unpacking them, you can specify them within the internal fulfillment
This will create a corresponding manifest at location loc_hj7gjrk5JaVvyATPDbyURp. Note that the corresponding manifest can not be marked as received until the fulfillment has been completed.
International Fulfillments
For international fulfillments, you need to set the type to international and provide tax identifiers and customs-related shipment options. The fulfillment type is also auto-determined by comparing sender and recipient address country codes.
Tax ID values (federal_tax_id, state_tax_id, and tax_identifiers[].tax_id) are encrypted at rest and masked in API responses for security. Only the last 4 characters are visible (e.g., "12-3456789" is returned as "******6789"). The full unmasked values are sent to shipping carriers for customs processing.
The shipment_options object for international fulfillments supports the following customs-related fields:
2. Pick Operation (optional)
If your workflow is a typical "pick and pack" operation, you may want to first pick all of your items to ensure that you have them in inventory and them pack them into one or more parcels. Pick operation is only enabled if either the active steps in your org settings for fulfillments has the pick step enabled or if you pass the active steps in fulfillment creation.
To do the pick operation, you can increment the verified_qty or defective_qty field. PackageX will automatically make sure that you do not go over the amount that was requested in the fulfillment.
The status of the fulfillment will automatically get updated to picked when all of the items have been accounted for.
You have to specify the layout to pick the quantity from
Example
3. Create parcel
Once the fulfillment has been created, it needs to be packed. But before that, one or more parcels need to be created. You can create a custom parcel by adding dimensions or by using a predefined package that you set up on the dashboard.
While predefined packages have a maximum weight which is checked by the API, manually created packages do not have a weight check.
Create custom parcel
Use predefined parcel
4. Pack parcel
Once the parcel for the fulfillment has been created, it is time to add items into it. You can specify adding items into the parcel the same way as when creating fulfillments or verifying manifests.
Example
Delete parcel
If you decide to delete the parcel from the fulfillment, any inventory attributed to that parcel will be removed and reset.
Example
5. Generate shipping rates
Since we've collected all of the shipping information throughout the process of creating and updating the fulfillment and the parcels within, we are able to generate shipping rates by just passing the fulfillment ID to the shipping API.
This will create a shipment ID on the fulfillment property, which you can use to retrieve the shipping rates and refresh the rates if the rates_generated_at timestamp is more than 15 minutes old.
Get rates first time
Refresh rates
If you need to refresh the shipping rates, make a call to the refresh endpoint with the shipment ID property on your fulfillment, no body needed.
6. Generate shipping label
Once you have found the shipping label that suits your needs, you can purchase it by passing the rate ID into the request body. There are additional options availible here, please see the shipments section.
In the response, you'll have the label_url with the PDF of your shipping label(s). If there are multiple shipping labels, the label_url property will combine all shipping labels into one PDF document for easy printing. Each parcel in the shipment will also have its own PDF document attached to it.
Example
Cancel Fulfillment / Update Status
To cancel a fulfillment, update its status to "canceled". If you change your mind, reset its status to "processing".
The same options are available if you want to force the system to do a partial fulfillment. You can manually update the status of the fulfillment to packed, then generate a shipping label.
Example
Update an Internal Transfer Fulfillment
An internal transfer fulfillment is updated in the same way as a regular fulfillment. The only difference is, as the articles are packed into the parcels, the articles will be removed from the corresponding manifest and the parcels will be linked to the manifest as well.
Retrieve Fulfillment
Get a single fulfillment using its id.