Hi there!
I have been trying to create a fulfillment via API for several days but it returns error.
{“errors”:{“fulfillment”:“Required parameter missing or invalid”}}
Here I attach the code. ( I am using Signifly/Laravel package )
'fulfillment' => array(
'message' => 'The order has been send',
'notify_customer' => true,
'location_id' => 61480337591,
'tracking_info' => array(
'number' => 5858371,
'url' => 'dhl.com',
'company' => 'DHL - Parcel'
),
'line_items_by_fulfillment_order' => array(
array(
'fulfillment_order_id' => 6655267897673,
"fulfillment_order_line_items" => array(
"id" => "14645454864713",
"quantity" => 1
)
)
)
)
);
$url = 'https://xxx.myshopify.com/admin/api/2023-07/orders/5618380079433/fulfillments.json';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$res = curl_exec($ch);
curl_close($ch);
echo $res;
The location_id, fulfillment_order_id, line_item_id are all correct since I got them via API before executing above code.
Since I couldn’t proceed fulfillment_request API, tracking_info values are random ones at the moment.
I’ve tried with real tracking information that had been created by merchant but it returned same error.
Tipsa
July 5, 2023, 7:15am
3
I have the same problem with the same error, if someone could help us I would greatly appreciate it
Liam
July 5, 2023, 9:10am
4
Hi Ironpro,
Was this same code working previously or is this a new implementation that you’re building?
Hi Liam.
This is the first time for me to implement.
We are building our own order management system using Shopify API.
Fulfillment implementation is just last step.
Liam
July 11, 2023, 7:32am
6
It’s possible this could be happening because the “tracking_info” number is an integer, while Shopify expects a string. Could you switch to a string and see if the error is being returned?
Hi Liam!
Thank you for your help!
Yes, here I changed the number to string.
$data = array(
'fulfillment' => array(
"location_id" => $rfill['assigned_location']['location_id'],
"message"=>"The Jewllery Room fulfilled 1 item.",
"notify_customer"=> false,
"tracking_info"=> array(
"number" => "YMT29GRM",
"company" => "GLS"
),
"line_items_by_fulfillment_order"=> array(
"fulfillment_order_id" => $rfill['id'],
"filfillment_order_line_items" => array(
"id" => "14794802299209",
"quantity" => 1
)
)
)
);
so when I echo the json it shows as follows.
{
"fulfillment": {
"location_id": 61480337591,
"message": "The Jewllery Room fulfilled 1 item.",
"notify_customer": false,
"tracking_info": {
"number": "YMT29GRM",
"company": "GLS"
},
"line_items_by_fulfillment_order": {
"fulfillment_order_id": 6661985730889,
"filfillment_order_line_items": {
"id": "14794802299209",
"quantity": 1
}
}
}
}
And it returns error.
Response Code: 400
Response Body: {“errors”:{“line_items_by_fulfillment_order”:“expected Hash to be a Array”}}