Skip to content

Instantly share code, notes, and snippets.

@ericz
Created September 5, 2014 06:30
Show Gist options
  • Save ericz/387a7d124513fb8008b9 to your computer and use it in GitHub Desktop.
Save ericz/387a7d124513fb8008b9 to your computer and use it in GitHub Desktop.
Webhook examples
// Shipment notification.
// 'meta.item' refers to the index in the 'items` array of the order
//
// Multiple shipments may occur for one order 'item' if fulfillment logistics requires it to.
// One shipment may cover multiple order 'items' (in which case multiple webhook requests would be sent with same tracking info but different item indices)
//
// The given 'event' can also be retrieved by looking at the 'events' property of the order itself.
{
"orderId": "54051cb9e4653e7e5b3fbb87",
"event": {
"name": "shipped",
"description": "Shipped item",
"createdAt": "2014-09-04T21:08:25.401Z",
"meta": {
"item": 0,
"tracking": "XXX",
"service": "US-FC"
}
}
}
// Item cancellation
{
"orderId": "54051cb9e4653e7e5b3fbb87",
"event": {
"name": "item-cancelled",
"description": "Item cancelled",
"createdAt": "2014-09-04T21:08:37.920Z",
"meta": {
"item": 2,
"reason": "Design not ready for print"
}
}
}
// Order cancellation
{
"orderId": "54051cb9e4653e7e5b3fbb87",
"event": {
"name": "order-cancelled",
"description": "Order cancelled",
"createdAt": "2014-09-04T21:08:37.920Z",
"meta": {
"reason": "Design not ready for print"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment