Home > Shopify Tutorials > Shopify Order API: Test Shopify orders with REST Admin API

Shopify Order API: Test Shopify orders with the REST Admin API

Last updated: May 01, 2024
This article has been written and researched by our expert Avada through a precise methodology. Learn more about our methodology





Before you establish your store or once you have modified your checkout settings, it is crucial to place a test order from the storefront. By doing this, you can guarantee that everything performs properly according to your plan. You can also gain insight into your customers’ shopping experience.

Therefore, you should figure out Test Shopify orders with REST Admin API. We will provide a step-by-step guide to help you do that. Let’s get started right now!

Related posts:

About Shopify Order API

What is the order?

An order is a customer’s completed request to buy one or more items from a store. The creation of the order happens once a customer completes the checkout process-when they provide an email address or phone number, billing address, and payment information.

Via the API, orders can be created, but without any collection of payment information and any performance of the transaction. Also, you can have the option to mark the order without any payment status. Alternatively, you can enable retailers to produce orders manually by the use of the draft order resource.

What is API?

What is API

As mentioned above, orders can be created through the API. So what exactly is an API? Well, an API is a set of programming code that allows data transmission between one software product and another. It also includes this data exchange’s terms.

Application programming interfaces contain two parts. The first one is technical specification representing the data exchange options between solutions with the term presented in the form of a request for processing and data delivery protocols. The second one is the software interface, which is written to the term that portrays it.

The software that requires to access information (i.e., X hotel room rates for certain dates) or functionality (i.e., a route from point A to point B on a map based on a user’s location) from another software, calls its API while determining the requirements of how data or functionality should be rendered. The other software will give back the data/functionality requested by the former application.

Also, note that the interface by which these two applications communicate is what the API specifies. The Red Hat specialists note that APIs are occasionally regarded as contracts, where documentation is an agreement between the parties: “If party first sends a remote request structured a particular way, this is how the second party’s software will respond.”

For developers, the API documentation is a hand-operated that contains all the information needed so that they can know how to work with the API and get the most out of the services it offerers to them. The documentation will be dug in more in each upcoming section.

Each API includes and is performed by function calls that are language statements requesting software to implement specific actions and services. As described in the API documentation, function calls are phrases consisting of verbs and nouns, for instance: start or finish a session, get amenities for a single room type, and restore or retrieve objects from a server.

APIs can be very helpful in multiple aspects. In general, they can make software development much more simple and speedier. Developers can include more functionality such as recommender engine, accommodation booking, image recognition, and payment processing from other providers to current solutions. Not only that, they can have the option to develop new applications by making use of the services provided by the third-party.

From these outstanding features, source code will not be a big deal to specialists anymore. And they do not have to struggle to know the operations of other solutions. All they have to do is simply connect their software to another one. Put another way, APIs can be considered an abstraction layer between two systems, covering the complexity, and working details of the latter.

What is API testing?

API testing concentrates on the so-called business layer of the application. It means that the testing methods will be completely different from the standard GUI testing. Hence, rather than making use of keyboard strokes and mouse clicks as standard input, in API testing, it will be necessary to use some other testing patterns, use some testing tools, or your code to check these APIs by doing a test.

It is also important to validate the responses (output) from these APIs to confirm whether or not they are performing well. The awareness of the response that an API creates is crucial to grasp what to look for.

An API response will be a status message or Boolean value (for instance, success/error, or true/false, etc.) that will represent the API call’s status. It will also serve as a flag (true/false), and then the update of the Presentation layer or the Database layer will occur. Alternatively, an API response will also be a set of data that is to be passed on to the following API, the GUI, or the Database.

How to test Shopify orders with the REST Admin API?

Step 1: Creating a Shopify order

The first step is to create an order with an authorization transaction by sending a POST request to the Order resource. By doing this, you will be able to test orders. You can add the object of the transactions in the body of the request:

POST https://{shop}.myshopify.com/admin/api/2021-01/orders.json

  "order": {
    "email": " ",
    "financial_status": "pending",
    "line_items": [
        "title": "Big Brown Bear Boots",
        "price": 100,
        "grams": "1300",
        "quantity": 2,
        "tax_lines": [
            "price": 13.5,
            "rate": 0.06,
            "title": "State tax"
    "transactions": [
        "kind": "authorization",
        "status": "success",
        "amount": 200

Step 2: Getting a transaction ID

Once you have created the order, the returned Order object will contain an ID. After that, you can make use of the order ID to return the transaction and its ID. You can send a GET request to the Order Transaction resource to recover the transaction:

GET https://{shop}.myshopify.com/admin/api/2021-01/orders/{order_id}/transactions.json

Step 3: Capturing the transaction

ow that you have returned the transaction, you can generate a capture transaction to capture payment by making use of its ID. To do this, you can send a Transaction object in the body of a POST request to the Order Transaction resource with the authorization’s transaction ID as the parent_id and the test property set to true:

POST https://{shop}.myshopify.com/admin/api/2021-01/orders/{order_id}/transactions.json

  "transaction": {
    "currency": "USD",
    "amount": "200.00",
    "kind": "capture",
    "parent_id": 1458851250232,
    "test": "true"

Step 4: Confirming the test order

If you successfully follow the three simple steps, then you can proceed to the last step: Confirm the test order. To confirm that it is in test mode, you can retrieve the order. The response will contain the test property set to true if the order is a test order.

GET https://{shop}.myshopify.com/admin/api/2021-01/orders/{order_id}.json


To conclude, we have described to you the definition of the order, API, API testing, and How to test Shopify orders with the REST Admin API. We hope that by this step-by-step guide, you will be able to test your order effortlessly.

Also, if you need to check the performance of your checkout process and settings for order processing, inventory, shipping, and taxes; then you can place a test order by imitating a transaction on Shopify. For more details about this process, you can visit our post: How to Place Test Order on Shopify by Simulating Transaction.

If you have any questions, comments, or concerns, do not hesitate to leave a comment below or directly contact us. We are always ready to help you out in case you need anything. Furthermore, if you find our article useful, then you can share it with your social network’s community. We would appreciate it if you could do that.

Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.