Use this API to manage shipments (including partial shipments) on a given order.
Read this section to learn how to attach a shipment to a given order.
Shipments must include one and only one tracking number. For example, if you have an order with 2 items using 2 different tracking numbers, you make 2 API requests.
curl -X POST \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/{order-id}/shipments
POST /{order-id}/shipments HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->post(
'/{order-id}/shipments',
array (),
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/{order-id}/shipments",
"POST",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Attribute & Type | Description |
---|---|
Type: string |
Optional Unique external shipment ID representing a shipment as identified by the seller. Allowed characters are |
Type: |
Required |
Type: |
Required |
Type: |
Optional |
Type: string |
Required Unique key per request. |
Type: string |
Optional ID representing the order in your (seller) order management system.
Added only if this ID was not updated during ACK
call. If this ID differs from the existing |
items
objectAttribute & Type | Description |
---|---|
Type: string |
Required if ID representing the product in the seller's catalog. You must provide |
Type: string |
Required if A Meta-generated ID representing the line item on the order. This value is readable as the |
Type: number |
Required Number/quantity of items that are part of this shipment. |
tracking_info
objectAttribute & Type | Type |
---|---|
Type: |
Required Carrier used for this package. |
Type: string |
Required Carrier tracking number. |
Type: string |
Optional Human readable description of the shipping method. |
fulfillment
objectAttribute & Type | Description |
---|---|
Type: |
Optional if Address of your fulfillment location from which the order is shipped for origin-based tax calculation. |
Type: string |
Optional if ID of the fulfillment location from which the order is shipped, previously set up in the Taxtab in your Commerce Manager. You can query the |
Type: boolean ( |
Optional Assign this field |
fulfillment_address
objectAttribute & Type | Description |
---|---|
Type: string |
Required Street address of the fulfillment location. |
Type: string |
Optional Second line of the address; typically the number of the apartment, suite, or unit. |
Type: string |
Required City of the fulfillment location. |
Type: string |
Required Two-letter state abbreviation. Example: |
Type: string |
Required Country of the fulfillment location. |
Type: string |
Required Postal code of the fulfillment location. |
Type: string |
Optional Province of the fulfillment location. |
carrier_code
enumBelow is a list of common carrier codes:
dhl
dhl_ecommerce_us
eagle
fedex
ontrac
tnt
ups
usps
The full list of supported carrier codes is available here .
{ "external_shipment_id": "external_shipment_1", "items": [ { "retailer_id": "FB_product_1238", "quantity": 1 }, { "retailer_id": "FB_product_5624", "quantity": 2 } ], "tracking_info": { "tracking_number": "ship 1", "carrier": "FEDEX", "shipping_method_name": "2 Day Fedex" }, "fulfillment": { "fulfillment_location_id": "2153613121365" }, "idempotency_key": "cb091e84-e75a-3a34-45d3-5153bec88b65" }
If successful:
{ "success": true }
Otherwise, a relevant error message is returned.
Fetch all shipments for a given order.
curl -X GET -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/{order-id}/shipments
GET /{order-id}/shipments HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
// Returns a `Facebook\FacebookResponse` object
$response = $fb->get(
'/{order-id}/shipments',
'{access-token}'
);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
"/{order-id}/shipments",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
Attribute & Type | Description |
---|---|
Type: |
shipment
objectAttribute & Type | Description | Default |
---|---|---|
Type: string |
Unique ID representing shipment. |
Yes |
Type: string |
Unique external shipment ID representing a shipment as identified by the seller. Allowed characters are |
No |
Type: |
Yes |
|
Type: |
Yes |
data
objectAttribute & Type | Description |
---|---|
Type: |
shipped_item
objectAttribute & Type | Description |
---|---|
Type: string |
Unique ID representing the item as identified by Facebook. |
Type: string |
ID representing the product in the seller's catalog. |
Type: string |
ID representing the product in the Facebook catalog. |
Type: number |
Number of items ordered. |
Type: |
tax
objectAttribute & Type | Description |
---|---|
Type: |
currency_amount
objectAttribute & Type | Description |
---|---|
Type: string |
Amount in decimal format. Example: |
Type: string |
Three digit ISO-4217-3 code
for the purchase. Example: |
{ "data": [ { "id": "491193461614879", "items": { "data": [ { "id": "486602442073981", "product_id": "2452389501475182", "retailer_id": "FB_shirt_1234", "quantity": 1, "tax": { "final_tax": { "amount": "0.04", "currency": "USD" } } } ] }, "tracking_info": { "tracking_number": "ship 1", "carrier": "fedex" } } ], "paging": { "cursors": { "before": "--sanitized_key--", "after": "--sanitized_key--" } } }