Skip to main content

Create Order with two Parcels

The scenario

Mr John Doe has just bought 2 products from your eshop, he chose cash on delivery and home delivery to Sesame street 11b, MyCoolCity, Michigan US. He filled in billing details of his company. The order contains two product and shipping costs. Unfortunately, the first product is out of stock and will be delivered later. Let's create an order for him and then add two Parcels to it. Each will contain a different products and tracking number.

Authorization omitted

For the sake of simplicity, we will omit token authorization step.

1. Create order

Make use of the Create new Order endpoint to initiate the creation of a new Order.

curl -L -X POST 'https://api.foxdeli.com/tracking/api/v1/order' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: <ACCESS_TOKEN_VALUE>' \
--data-raw '{
"eshopId": "12345678-1234-1234-1234-1234567890ab",
"marketId": "12345678-1234-1234-1234-1234567890ab",
"platform": "shopify",
"externalCreated": "2012-12-31T23:59:59Z",
"orderNumber": "A123456789",
"externalIdentifier": "ORD123456789",
"price": {
"amount": 99.96,
"currency": "CZK"
},
"cashOnDelivery": {
"amount": 99.96,
"currency": "CZK"
},
"additionalCosts": [
{
"type": "SHIPPING",
"price": {
"amount": 99.96,
"currency": "CZK"
},
"name": "Home delivery"
}
],
"payment": {
"paid": false,
"method": "CASH_ON_DELIVERY",
"service": "PAYPAL",
"link": "https://pay.me"
},
"customer": {
"name": "John Doe",
"email": "iboughtsomething@customer.com",
"phone": "+420 123 456 789"
},
"destination": {
"type": "HOUSE_ADDRESS",
"address": {
"line1": "Sesame street",
"line2": "11b",
"city": "MyCoolCity",
"postalCode": "48228",
"countryCode": "US",
"state": "Michigan",
"region": "Michigan",
"longitude": 50.0933864,
"latitude": 14.4542789
},
"parcelShop": {
"carrier": "GLS",
"countryCode": "US",
"parcelShopId": "A1234"
}
},
"products": [
{
"type": "PRODUCT",
"sku": "A1234",
"name": "Awesome product",
"description": "So awesome you must have it!",
"url": "https://mycoolshop.com/product/A1234",
"image": "https://mycoolshop.com/img/product/A1234.png",
"price": {
"amount": 123.00,
"currency": "CZK"
},
"vat": 26.0,
"quantity": 1
},
{
"type": "PRODUCT",
"sku": "A5678",
"name": "Even better product",
"description": "Much better than previous!",
"url": "https://mycoolshop.com/product/A5678",
"image": "https://mycoolshop.com/img/product/A5678.png",
"price": {
"amount": 456.00,
"currency": "CZK"
},
"vat": 128.0,
"quantity": 1
}
],
"billingDetails": {
"name": "John Doe",
"companyName": "Does company Ltd",
"billingAddress": {
"line1": "Sesame street",
"line2": "11b",
"city": "MyCoolCity",
"postalCode": "48228",
"countryCode": "US",
"state": "Michigan",
"region": "Michigan",
"longitude": 50.0933864,
"latitude": 14.4542789
},
"crn": "12345678",
"vatId": "CZ12345678",
"email": "johndoe@mail.com",
"phone": "+420 123 456 789"
},
"language": "cs"
}'

Now the order has been created in Foxdeli system having two products.

2. Create parcel for order containing first product

Make use of Create Parcel endpoint to create a Parcel for previously created Order using ID from previous response.

curl -L -X POST 'https://api.foxdeli.com/tracking/api/v1/order/<ORDER_ID_FROM_PREVIOUS_RESPONSE>/parcel' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: <ACCESS_TOKEN_VALUE>' \
--data-raw '{
"products": [
"A1234"
],
"tracking": [
{
"carrier": "GLS",
"number": "1234567890"
}
]
}'

This will create a Parcel for Order carried by GLS. Now you can check it in Foxdeli app.

3. Create parcel for order containing second product

Make use of Create Parcel endpoint to create a Parcel for previously created Order using ID from previous response.

curl -L -X POST 'https://api.foxdeli.com/tracking/api/v1/order/<ORDER_ID_FROM_PREVIOUS_RESPONSE>/parcel' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: <ACCESS_TOKEN_VALUE>' \
--data-raw '{
"products": [
"A5678"
],
"tracking": [
{
"carrier": "PACKETA",
"number": "Z12345654321"
}
]
}'
Different carriers

In this example, we used two different carriers for the two parcels. First arriving via GLS, second via Packeta.