How can I place an order using API from an extension?

Topic summary

Placing orders from a Shopify extension using the Admin API. Two approaches were discussed: calling the Admin API directly from the extension or routing through the app (via app proxy) where the app with admin access makes the order.

A 404/500 error occurred when attempting fetch(“/admin/api/2023-10/orders.json”) without a proper POST body. The response clarified that Create Order is a POST endpoint and requires a correctly shaped JSON request body.

Key references provided: Shopify Admin REST Create Order and GraphQL Admin draftOrderCreate. A code example shows building an order object (line_items, transactions, taxes, currency) and sending it via fetch with method: “POST” and Content-Type: “application/json”.

Recommendation: Use the app proxy route; the extension sends data to your app, and your app (with admin access) calls the Admin API to create the order.

Outcome: Guidance given (POST with body, example payload, proxy-based flow). No explicit resolution or confirmation of success. Code snippet is central to understanding the fix.

Summarized with AI on December 30. AI used: gpt-5.

I want to make order from shopify extension. I used app proxy I got the data but now how can I place order or is it possible to call api directly on extension and make a order?

hi @vishal206 ,
You can use shopify admin api to create order on the store. You can hit the create order API directly from the extension or you can have a dedicated route in you’re app to create the order. The extension then should hit you’re app and you’re app with admin access should create the order on the store. To create a order you can refer to the shopifys API documentation

Create order - Shopify REST api docs
Create a draft order using GraphQL admin api - Shopify

would you please show an example code? I have tried to use

fetch("/admin/api/2023-10/orders.json")

but It shows 404 or 500 error

hi @vishal206

I see that your trying to use the Admin REST API to create an order. Create order is a post route and it needs a request body. The shape of the body is documented at the link I gave you before. I’m giving you a demo fetch request from the example from that link

const order = {};
order.line_items = [
  {
    "title": "Big Brown Bear Boots",
    "price": 74.99,
    "grams": "1300",
    "quantity": 3,
    "tax_lines": [
      {
        "price": 13.5,
        "rate": 0.06,
        "title": "State tax"
      }
    ]
  }
];
order.transactions = [
  {
    "kind": "sale",
    "status": "success",
    "amount": 238.47
  }
];
order.total_tax = 13.5;
order.currency = "EUR";

fetch("/admin/api/2023-10/orders.json", {
    method: "POST",
    body: JSON.stringify(order),
    headers: {
        "Content-type": "application/json"
    }
})

one last thing should I call order API directly from extension or I use app proxy to get data from extension they I call order API using fetch inside app proxy route

hi @vishal206 ,

Maybe calling the API from you’re app proxy is the better choice.