Solved

Shopify Admin REST API : Completes a draft order and transit it to an order.

dhrumil4u360
Tourist
5 0 4

Have anybody done this before ? It should be simple and straight forward but I just can't seem to figure it out. 

I am referring API documentation here.

https://shopify.dev/docs/admin-api/rest/reference/orders/draftorder?api%5Bversion%5D=2021-04#complet...

But it looks like documentation is not correct due to following observation.

- This call either creates something or updates something. So it should be either PUT or POST call by nature. I see GET call which makes no sense!
- There is not proper request schema provided neither example matches the scenario of this action.
- API endpoint is simply a copy of draft order GET call. So, it looks like someone copied it and forgot to documentation 🙂

So, have anybody done this before ? Any idea about correct end-point for this?

Thanks,
Dhrumil

Accepted Solution (1)

Luke_K
Shopify Staff
402 66 98

This is an accepted solution.

Hey @dhrumil4u360 

Thanks for raising this! We had the documentation errors raised to us prior and are working through fixing the documentation, apologies for the inconvenience.

Here's the calls that can be used to complete a Draft order via the REST API - hope this helps!

Complete and mark as paid
PUT /admin/api/{api_version}/draft_orders/{draft_order_id}/complete.json

Complete and mark as pending
PUT /admin/api/{api_version}/draft_orders/{draft_order_id}/complete.json?payment_pending=tru

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Replies 5 (5)

Luke_K
Shopify Staff
402 66 98

This is an accepted solution.

Hey @dhrumil4u360 

Thanks for raising this! We had the documentation errors raised to us prior and are working through fixing the documentation, apologies for the inconvenience.

Here's the calls that can be used to complete a Draft order via the REST API - hope this helps!

Complete and mark as paid
PUT /admin/api/{api_version}/draft_orders/{draft_order_id}/complete.json

Complete and mark as pending
PUT /admin/api/{api_version}/draft_orders/{draft_order_id}/complete.json?payment_pending=tru

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
dhrumil4u360
Tourist
5 0 4

Thank you!

I am glad that documentation getting better and better day by day!

Also, thanks for putting up quick example about that API call here. It really helps to move forward while I understand that documentation update should go by process and may time bit time to go live.

Thanks,
Dhrumil

dhrumil4u360
Tourist
5 0 4

@Luke_K It looks like documentation is now updated. Thank you for that. However, this endpoint is not working. I am simply adding draft order ID in URL and just making HTTP PUT call. I get only response :

 

{"errors": "Not Found"}

 


I am tryin on 2021-07 API version which is latest. I can see the draft order with same ID in my shopify account as a double check measure that order must exist.

Can you please do the needful?

Thanks,
Dhrumil

Luke_K
Shopify Staff
402 66 98

Hey @dhrumil4u360 

Apologies for the delay, I have been out of office - if you're still receiving this issue would you mind sharing the full call you are making here and the request_id from it? I can take a look. Thanks!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
dhrumil4u360
Tourist
5 0 4

@Luke_K Thank you for your response. I figured it out. I was unsure about what to send as payload in the PUT request. But apparently there is no payload here.

Thank you again for your time.