Create a new Order

TPandita
Shopify Partner
4 0 0

The use case is: Order is created on behalf of the customer in our ERP and then exported to Shopify. Since the payments cannot be created outside of Shopify:

  • Is it recommended to create such orders using the draft order resource or can we use the Order resource to create orders for this case?
Replies 4 (4)

Ralph-HA
Shopify Partner
106 7 46

@TPandita You have a few options here that depends on your situation. 

  1. You can create the order as payment pending, which will allow you to enter the payment information using the Shopify admin.  The Shopify admin has a Collect Payment feature that you can use on an order.  If you've captured payment from the customer already, you can create the order and mark it paid.  You can also add transaction data to the order.
  2. You can also create a draft order and add payment on the draft order.  This is a better option if you may need to edit the order after you create it from your ERP system.  At this time orders that are created using the Shopify API can not be edited.  So this may be a good fail safe if you think you might need to edit the order.

Hope this helps!

Co-Founder / Developer at Highview Apps
Our Shopify Apps: EZ Exporter | EZ Inventory | EZ Importer | EZ Notify | EZ Fulfill
TPandita
Shopify Partner
4 0 0

@Ralph-HA Thank you so much for your reply.

I was just thinking of a scenario if we use the first approach: Say if the order was initially created without the payment in ERP. I created the order in Shopify for it. Now, say I create the payment for this order in ERP, would I be able to use the Order API to update the status of the order to Paid? 

Is there a different API that I need to check to update this? Asking this because, in the Create Order API documentation, there is information that the financial status can only be set at the time of order creation.

TPandita_0-1651166424598.png

Ralph-HA
Shopify Partner
106 7 46

@TPanditaThis is a typical workflow that we've seen from many merchants.  You do have the option to update the payment information in the Shopify admin for the order. 

 

If you want to use the API, you can use the `Update Order` endpoint to do this as well.  Based on the documentation you should be able to update the `financial_status` but I haven't verified this.  I would recommend you run a small test by creating an order using the Order API and then trying to update that orders financial_status using the `PUT` method on the Order API.  Ideally, you'd want to add the transaction data as well so the purchase amount gets associated with the `Customer`.  This will also ensure the customer data is updated with how much they've spent.

 

Here is the REST endpoint to update an order https://shopify.dev/api/admin-rest/2021-10/resources/order#put-orders-order-id

Co-Founder / Developer at Highview Apps
Our Shopify Apps: EZ Exporter | EZ Inventory | EZ Importer | EZ Notify | EZ Fulfill
TPandita
Shopify Partner
4 0 0

@Ralph-HA It does not allow me to update the financial status. Also, how to create payment transaction using API in Shopify. There needs to be an existing parent_ID, which I do not have (since I am creating payment outside Shopify), and without this the POST method does not create payment transaction.

 

TPandita_0-1654623746802.png