Create Fulfillment API problem

handeadiguzel
Tourist
4 0 1
When we make the following request to fulfill a sales order, we get an 200 response and a body with empty fulfillments. And the order is not fulfilled. 
 
Request: 
POST /admin/api/2019-04/orders/{id}/fulfillments.json HTTP/1.1
Host: tr.{store}.com
Content-Type: application/json
Accept: application/json
X-Shopify-Access-Token: {token}
User-Agent: PostmanRuntime/7.20.1
Cache-Control: no-cache
Accept-Encoding: gzip, deflate
Connection: keep-alive
cache-control: no-cache
{
"fulfillment": {
"created_at": "11/21/2019 1:56:10 PM +03:00",
"notify_customer": "true",
"tracking_company": "UPS",
"tracking_number": "1Z93R7576800002741"
}
}
 
Response: 
200 OK
{
    "fulfillments": []
}
0 Likes
zubairmohsin
Shopify Partner
58 1 10

Apps are required to specify alocation_idwhen creating fulfillments.

"location_id" is missing from your payload. try adding a location_id and share results.

handeadiguzel
Tourist
4 0 1

If Shopify is expecting a location_id this means it's a client error and shopify should return a 4xx response with a meaningful description of the problem. 

handeadiguzel
Tourist
4 0 1

Unfortunately adding location_id did not fix the issue, still getting 200 OK and the order is not fulfilled:

{
	"fulfillment": {
		"created_at": "11/21/2019 1:56:10 PM +03:00",
		"notify_customer": "true",
		"tracking_company": "UPS",
		"tracking_number": "1Z93R7576800002741",
		"location_id": "49641811"
	}
}

 

0 Likes
zubairmohsin
Shopify Partner
58 1 10

Okay, there is one more problem I see with payload. "created_at" attribute. Its not required to include it and also the format does not comply with Shopify format which is ISO 8601 format.

0 Likes
handeadiguzel
Tourist
4 0 1

Tried without createdAt and still having the same problem:

Could it be related to registering fulfillment services ? 

{
	"fulfillment": {
		"notify_customer": "true",
		"tracking_company": "UPS",
		"tracking_number": "1Z93R7576800002741",
		"location_id": "49641811",
		"line_items": [
	      {
	        "id": "4286956339309"
	      },
		  {
	        "id": "4286956372077"
	      },
	      	      {
	        "id": "4286956404845"
	      },
	      	      {
	        "id": "4286956437613"
	      }
      ]
	}
}

Could it be related to registering fulfillment services ? 

 

0 Likes
zubairmohsin
Shopify Partner
58 1 10

Yes. It could be. Read these two bullet points in documentation maybe it will lead you in some way.

https://help.shopify.com/en/api/reference/shipping-and-fulfillment/fulfillment#create-2019-10

P.S. All IDs should be in integer form, without double quotes.

Let's wait for input from Shopify support.

0 Likes
TMIA
Tourist
5 0 15

Was this ever resolved? I'm having the same problem. My integration has read/write permission for orders, transactions, and fulfillments.


irook
New Member
3 0 0

I'm also having this same problem.

0 Likes
evaldas_92
Excursionist
27 0 9

Came here from Google with the same problem.

If I try to create a fulfillment for a gift card and a physical item in one go, I get 422:

{
  "fulfillment": {
    "location_id": 61366730948,
    "tracking_number": null,
    "line_items": [
      {
        "id": 10278823952580,
        "quantity": 1,
        "gift_card": true,
        "fulfillment_service": "gift_card"
      },
      {
        "id": 10278823985348,
        "quantity": 1,
        "gift_card": false,
        "fulfillment_service": "manual"
      }          
    ]
  }
}

 

However, if I try to send them one at a time - it works fine.

 

0 Likes