Shopify API - How To Close An Order Using Postman

Shopify API 2023 – How To Close An Order Using Postman

Closing an order or archiving an order means removing an order from the list of open orders. 

Usually, people confuse order closing and order fulfilling as the same thing, but closing an order is different from fulfilling an order.

– When all the steps from placing an order to the moment the customer receives the product are done, It is called fulfilling an order. 

– Order closing is moving orders from open orders to archived orders. If there is no more work to do or the order is shipping, the admin can archive the order by marking it to keep track of open orders clearly and precisely. 

When closing an order, the order is not deleted; it will be archived. If the admin knows how to close the order, it is advantageous to manage the data clearly and not be confused by the types of canceled, unfulfilled, or open orders. 

For many reasons above, Beehexa will show you how to close an order using Postman in Shopify.

Step 1: Generate API credentials from the Shopify admin

     

      • Go to Apps – Manage private apps

    Generate API credentials from the Shopify admin

       

        • Click Create a new private app

        • In the App details section, enter a name for your app, and an emergency developer email.

        • In the Admin API section, select the areas of your store that you want the app to access

      Generate API credentials from the Shopify admin

         

          • Click Save

        The Admin API section displays the app’s API key and password when you save the app’s details. 

        Shopify Connector and Profile arrow Microsoft Dynamics 365 Business Central
        Shopify Microsoft-dynamics-365-business-central Integration
        Shopify Connector and Profile arrow Dynamics 365 Finance & Operations
        Shopify Dynamics-365-finance-operations Integration
        Shopify Connector and Profile arrow Shopee
        Shopify Shopee Integration
        Shopify Connector and Profile arrow Amazon
        Shopify Amazon Integration

        Step 2: Close An Order Using Postman

           

            • Log in to your Postman and create a new workspace

            • Create a new POST with this URL:

          https://{username}:{password}@{shop}.myshopify.com/admin/api/{api-version}/{resource}.json

             

              1. {username} – The API key that you generated.

              1. {password} – The API password that you generated.

              1. {shop} – The name of your development store.

              1. {api-version} – The supported API version that you want to use.

              1. {resource} – A resource endpoint from the REST Admin API.

            Or you can copy this example in the Shopify Admin, remember to change {resource} to {orders/order_id/close}:

            https://33a72f01e02987636e1c1a9a4e95c840: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@hexasync.myshopify.com/admin/api/2021-10/orders/4266111139903/close.json

            order_id=4266111139903

            You can read Shopify API – Create An Order Using Postman blog to get the order_id, or you can follow this process to get the order_id:

               

                1. In the admin dashboard, choose orders, then click all orders.

                1. Choose the order you want to close.

                1. Copy the order_id in the URL 

              Example URL

                 

                  • Paste the URL above.

                post

                Then click Send

                Response:

                The API will return the data like this.

                {
                    "order": {
                        "id": 4266111139903,
                        "admin_graphql_api_id": "gid://shopify/Order/4266111139903",
                        "app_id": 580111,
                        "browser_ip": "117.2.168.124",
                        "buyer_accepts_marketing": false,
                        "cancel_reason": null,
                        "cancelled_at": null,
                        "cart_token": null,
                        "checkout_id": 25849986809919,
                        "checkout_token": "7c32f9cb235ce641195576850b78ae31",
                        "client_details": {
                            "accept_language": "vi-VN,vi;q=0.9,fr-FR;q=0.8,fr;q=0.7,en-US;q=0.6,en;q=0.5",
                            "browser_height": 754,
                            "browser_ip": "117.2.168.124",
                            "browser_width": 1519,
                            "session_hash": null,
                            "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
                        },
                        "closed_at": "2022-01-20T17:33:31+09:00",
                        "confirmed": true,
                        "contact_email": "hoai.lam@beehexa.com",
                        "created_at": "2022-01-19T10:47:00+09:00",
                        "currency": "AUD",
                        "current_subtotal_price": "30000.00",
                        "current_subtotal_price_set": {
                            "shop_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            }
                        },
                        "current_total_discounts": "0.00",
                        "current_total_discounts_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            }
                        },
                        "current_total_duties_set": null,
                        "current_total_price": "30000.00",
                        "current_total_price_set": {
                            "shop_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            }
                        },
                        "current_total_tax": "0.00",
                        "current_total_tax_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            }
                        },
                        "customer_locale": "en",
                        "device_id": null,
                        "discount_codes": [],
                        "email": "hoai.lam@beehexa.com",
                        "estimated_taxes": false,
                        "financial_status": "pending",
                        "fulfillment_status": null,
                        "gateway": "Cash on Delivery (COD)",
                        "landing_site": "/wallets/checkouts.json",
                        "landing_site_ref": null,
                        "location_id": null,
                        "name": "#1176",
                        "note": null,
                        "note_attributes": [],
                        "number": 176,
                        "order_number": 1176,
                        "order_status_url": "https://hexasync.myshopify.com/25322618943/orders/ae4377e9ac9a63fb3302cbe95137eeae/authenticate?key=244ad286e3131b53bf81c2fa1382e155",
                        "original_total_duties_set": null,
                        "payment_gateway_names": [
                            "Cash on Delivery (COD)"
                        ],
                        "phone": null,
                        "presentment_currency": "AUD",
                        "processed_at": "2022-01-19T10:46:59+09:00",
                        "processing_method": "manual",
                        "reference": null,
                        "referring_site": "https://hexasync.myshopify.com/products/injection-molding-machine",
                        "source_identifier": null,
                        "source_name": "web",
                        "source_url": null,
                        "subtotal_price": "30000.00",
                        "subtotal_price_set": {
                            "shop_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            }
                        },
                        "tags": "",
                        "tax_lines": [],
                        "taxes_included": false,
                        "test": false,
                        "token": "ae4377e9ac9a63fb3302cbe95137eeae",
                        "total_discounts": "0.00",
                        "total_discounts_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            }
                        },
                        "total_line_items_price": "30000.00",
                        "total_line_items_price_set": {
                            "shop_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            }
                        },
                        "total_outstanding": "30000.00",
                        "total_price": "30000.00",
                        "total_price_set": {
                            "shop_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "30000.00",
                                "currency_code": "AUD"
                            }
                        },
                        "total_price_usd": "21632.46",
                        "total_shipping_price_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            }
                        },
                        "total_tax": "0.00",
                        "total_tax_set": {
                            "shop_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            },
                            "presentment_money": {
                                "amount": "0.00",
                                "currency_code": "AUD"
                            }
                        },
                        "total_tip_received": "0.00",
                        "total_weight": 0,
                        "updated_at": "2022-01-20T17:33:31+09:00",
                        "user_id": null,
                        "billing_address": {
                            "first_name": "Yushin",
                            "address1": "1925 Washington Street",
                            "phone": "(361) 386-5113",
                            "city": "Hollywood",
                            "zip": "33020",
                            "province": "Florida",
                            "country": "United States",
                            "last_name": "Lam",
                            "address2": "",
                            "company": "Beehexa",
                            "latitude": 26.004309,
                            "longitude": -80.14562769999999,
                            "name": "Yushin Lam",
                            "country_code": "US",
                            "province_code": "FL"
                        },
                        "customer": {
                            "id": 5484387270719,
                            "email": "hoai.lam@beehexa.com",
                            "accepts_marketing": false,
                            "created_at": "2021-11-08T18:13:34+09:00",
                            "updated_at": "2022-01-19T10:47:01+09:00",
                            "first_name": "Hoai",
                            "last_name": "Lam",
                            "orders_count": 3,
                            "state": "enabled",
                            "total_spent": "30238.00",
                            "last_order_id": 4266111139903,
                            "note": null,
                            "verified_email": false,
                            "multipass_identifier": null,
                            "tax_exempt": false,
                            "phone": null,
                            "tags": "",
                            "last_order_name": "#1176",
                            "currency": "AUD",
                            "accepts_marketing_updated_at": "2021-11-08T18:13:35+09:00",
                            "marketing_opt_in_level": null,
                            "tax_exemptions": [],
                            "sms_marketing_consent": null,
                            "admin_graphql_api_id": "gid://shopify/Customer/5484387270719",
                            "default_address": {
                                "id": 6833735827519,
                                "customer_id": 5484387270719,
                                "first_name": "Yushin",
                                "last_name": "Lam",
                                "company": "Beehexa",
                                "address1": "1925 Washington Street",
                                "address2": "",
                                "city": "Hollywood",
                                "province": "Florida",
                                "country": "United States",
                                "zip": "33020",
                                "phone": "(361) 386-5113",
                                "name": "Yushin Lam",
                                "province_code": "FL",
                                "country_code": "US",
                                "country_name": "United States",
                                "default": true
                            }
                        },
                        "discount_applications": [],
                        "fulfillments": [],
                        "line_items": [
                            {
                                "id": 10897294196799,
                                "admin_graphql_api_id": "gid://shopify/LineItem/10897294196799",
                                "fulfillable_quantity": 1,
                                "fulfillment_service": "manual",
                                "fulfillment_status": null,
                                "gift_card": false,
                                "grams": 0,
                                "name": "Injection molding machine - serial numbered",
                                "origin_location": {
                                    "id": 3140898455615,
                                    "country_code": "VN",
                                    "province_code": "",
                                    "name": "Hexasync Demo Storefront",
                                    "address1": "428 Dien Bien Phu Ward 11 District 10",
                                    "address2": "",
                                    "city": "Ho Chi Minh City",
                                    "zip": "700000"
                                },
                                "price": "30000.00",
                                "price_set": {
                                    "shop_money": {
                                        "amount": "30000.00",
                                        "currency_code": "AUD"
                                    },
                                    "presentment_money": {
                                        "amount": "30000.00",
                                        "currency_code": "AUD"
                                    }
                                },
                                "product_exists": true,
                                "product_id": 4356027088959,
                                "properties": [],
                                "quantity": 1,
                                "requires_shipping": true,
                                "sku": "AAMACHINE1",
                                "taxable": true,
                                "title": "Injection molding machine - serial numbered",
                                "total_discount": "0.00",
                                "total_discount_set": {
                                    "shop_money": {
                                        "amount": "0.00",
                                        "currency_code": "AUD"
                                    },
                                    "presentment_money": {
                                        "amount": "0.00",
                                        "currency_code": "AUD"
                                    }
                                },
                                "variant_id": 31179450613823,
                                "variant_inventory_management": "shopify",
                                "variant_title": "",
                                "vendor": "hexasync",
                                "tax_lines": [],
                                "duties": [],
                                "discount_allocations": []
                            }
                        ],
                        "payment_terms": null,
                        "refunds": [],
                        "shipping_address": {
                            "first_name": "Yushin",
                            "address1": "1925 Washington Street",
                            "phone": "(361) 386-5113",
                            "city": "Hollywood",
                            "zip": "33020",
                            "province": "Florida",
                            "country": "United States",
                            "last_name": "Lam",
                            "address2": "",
                            "company": "Beehexa",
                            "latitude": 26.004309,
                            "longitude": -80.14562769999999,
                            "name": "Yushin Lam",
                            "country_code": "US",
                            "province_code": "FL"
                        },
                        "shipping_lines": [
                            {
                                "id": 3617687535679,
                                "carrier_identifier": null,
                                "code": "Standard",
                                "delivery_category": null,
                                "discounted_price": "0.00",
                                "discounted_price_set": {
                                    "shop_money": {
                                        "amount": "0.00",
                                        "currency_code": "AUD"
                                    },
                                    "presentment_money": {
                                        "amount": "0.00",
                                        "currency_code": "AUD"
                                    }
                                },
                                "phone": null,
                                "price": "0.00",
                                "price_set": {
                                    "shop_money": {
                                        "amount": "0.00",
                                        "currency_code": "AUD"
                                    },
                                    "presentment_money": {
                                        "amount": "0.00",
                                        "currency_code": "AUD"
                                    }
                                },
                                "requested_fulfillment_service_id": null,
                                "source": "shopify",
                                "title": "Standard",
                                "tax_lines": [],
                                "discount_allocations": []
                            }
                        ]
                    }
                }

                response

                Step 3: Verify the result

                In the admin, choose orders, and click closed.

                closed

                As you can see, the order was moved to the closed area successfully.

                Above are all steps to close an order using Postman with Shopify API. If you have any questions, please comment below or refer to our Devdocs

                If you still do not understand the tutorial’s content, you can watch the video below for a more overview.

                https://youtu.be/xmslD9C9CFA
                Shopify API – How to close an Order Using Postman 

                Hopefully, you can do it!