AfterShip Tracking Common Scenario
One of the most common usage of the Commerce API is to import shipments to AfterShip Tracking, in order to send out the order/shipment update notification. Also the shopper can also visit AfterShip branded tracking page to view the order/shipment latest status or registering email/sms updates.
This document will describe several common usage scenarios for AfterShip Tracking, provided for your reference.
Please be sure to reach out to the AfterShip support team or contact your customer success manager to activate your store ID for AfterShip Tracking usage.
1. Import the Order and Fulfillments
For importing shipments to AfterShip Tracking via Commerce API, you need to create both order and fulfillment resources.
You can import the your order with order
endpoints, and also import your fulfillment with fulfillment
endpoints. Once you have successfully imported order and fulfillment, you can view the shipments under the AfterShip Tracking admin portal.
All sample requests in this page will include only the minimum required fields necessary to utilize the desired feature. For detailed definitions of other fields, please visit Order API Reference and Fulfillment API Reference.
Also, please check different common scenario subpages for the requirements of the specific scenario.
1.1 Order Resource Common Required Fields
The following table outlines the common required fields for the order resource, applicable to all scenarios mentioned below. Please ensure that you include all fields listed here. Depending on your specific use case, additional fields may be necessary to meet the requirements. Detailed descriptions of scenario-specific required fields will be provided in subsequent sections of this documentation.
Field | Description | Sample |
---|---|---|
id | The unique identifier of the order. For most of the case it should be the same as the order ID of your system. | CM1011 |
delivery_method | The method by which the order will be delivered. | shipping |
number | The order name | CM1011 |
currency | The currency of the order | USD |
status | The status of the order | open |
order_total | The total price of the order | 9.5 |
items | Items of order | - |
items.*.id | A unique identifier for the line item in your system | 9716591689898 |
items.*.product_title | The title of the product | Mobile Phone Case |
items.*.quantity | The number of items that have been purchased | 1 |
source_created_at | The date and time (ISO 8601 format) when an order was created | 2023-02-16T01:00:10Z |
source_updated_at | The date and time (ISO 8601 format) when an order was updated. | 2023-02-16T01:00:10Z |
Sample request body for creating an order
preparing...
1.2 Fulfillment Resource Common Required Fields
For all information and logic related to fulfillment, please refer to the Fulfillment Resource. This includes details such as fulfillment status, tracking numbers, and courier information.
If your order has not yet been fulfilled, there is no need to create a fulfillment. The table below outlines the essential fields required to create a fulfillment. Depending on your specific use case, additional fields may be necessary to meet the requirements. Detailed descriptions of scenario-specific required fields will be provided in subsequent sections of this documentation.
Field | Description | Sample |
---|---|---|
id | A unique identifier for the shipment in your system. | 321324145553321 |
order_id | The order ID generated when creating the order with Order endpoints | dc85ac8d298a4ed7bb5263d6e6c4f4e4 |
delivery_method | The method by which the order will be delivered. | shipping |
status | Fulfillment status | pending |
line_items | Order items included in this fulfillment object | - |
line_items.*.id | Order item ID under your platform. The ID has to be exist in the order's line items | 9716591689898 |
line_items.*.quantity | Order item quantity for this fulfillment. | 2 |
ship_from_location | Ship from location object | - |
ship_from_location.location_id | The ID of the location, which can be retrieved in here | da29876699374218bc6d18c9de8c91e8 |
ship_to_location | Ship to location object | - |
ship_to_location.address | The detailed address of the ship to location | Please refer to the following sample JSON |
trackings | tracking number array | - |
trackings.*.tracking_number | Tracking number. | 32332131122 |
trackings.*.ship_date | Ship date of the package | 2024-05-05 |
Recommended Optional Fields
Field | Description | Sample |
---|---|---|
trackings.*.slug | Carrier slug. | usps |
ship_to_location.address.postal_code | The postal code of the recipient’s address. | 065001 |
Sample request body for creating a fulfillment
preparing...
2. Use Cases Specific Request Samples
Depending on your specific usage requirements, you may need to include additional auxiliary data alongside the common fields described in the previous section.
Ensure that both the order and fulfillment resources are created properly
In this section, sample request bodies will be provided only if there are additional auxiliary fields required beyond those outlined in Section (1) - Common Required Fields. If no additional fields are necessary for the particular resource in that scenario, the sample request body of the resource will not be included. However, it is essential to adhere to the guidelines in Section (1) and create the corresponding resource to properly utilize the feature.
For comprehensive information on specific scenarios categories, please refer to each individual page.