Shopify App Development 2026

Shopify Draft Order API 2026: Create Orders, Mark as Paid & Cancel from Your App

Fayyaz Ahmed

Shopify draft order API tutorial (2026): create orders from your own Shopify app with the GraphQL Admin API – a phone order as a draft order (a product, a custom item, a discount and shipping), Shopify's own totals with draftOrderCalculate, turning it into a real order, marking it as paid, and cancelling it with a refund and restock. Plus why your app only sees 60 days of orders. Shopify app development series, episode 15 – everything shown is real, nothing skipped.

What you'll learn

  • Scopes write_draft_orders + write_orders (and read_all_orders)
  • draftOrderCalculate + draftOrderCreate
  • draftOrderComplete (payment pending)
  • orderMarkAsPaid + orderUpdate
  • orderCancel: refund + restock
  • 5 real traps

💻 Free source code for this episode: github.com/fayyaz315/shopify-app-development-2026/tree/ep15

Chapters

Step by step (full walkthrough)

Preview + intro

In the next ten minutes, your app takes a phone order, lets Shopify do the maths, and turns it into a real order. Then it's paid, cancelled, refunded and restocked, and you'll see why your app only sees a handful of this store's orders. This is the Shopify draft order API at work.

A phone order, built in our app, is now a real order in the store. This is episode fifteen of the Shopify app development series. Last time, customers.

Today: orders. The full code is free on GitHub, and the link is in the description.

Draft first

An app doesn't create orders directly. It creates a draft order first, and the draft becomes the order. Then the order can be marked as paid, or cancelled with a refund.

When does an app create orders? Phone and chat orders, wholesale orders, replacements for a broken item, or orders imported from a marketplace. A draft order has its own status: open, invoice sent, or completed once it becomes an order.

Two new scopes: write draft orders, and write orders. As before, I restarted the dev server and opened the app once to grant them.

The Orders page

The new Orders page. A draft order form on top, open drafts below. And the latest orders.

Only a few, because an app sees just the last sixty days of orders. For older orders, an app needs one more scope, read all orders, and a public app has to ask Shopify for it. One query reads the latest orders, the open drafts, and the customers and products for the form.

Open drafts come from the same query, filtered with status:open.

A phone order

A phone order for Russell Winfield: the Classic Everyday Pants. Two of them. Plus gift wrapping, a custom item for $5.

10% off, and $8 shipping. The whole form becomes one draft order input: the product line, the custom line, the discount, and the shipping line. A custom line has a title and its own price instead of a variant.

Gift wrapping doesn't need shipping, so the custom line says requires shipping false. It's still taxable, unless you say otherwise. The discount is an applied discount: a title, a value, and a value type, percentage here.

And shipping is a shipping line: a title and a price.

Calculate

Calculate. Shopify works out the totals, without saving anything. The subtotal after the discount, the shipping, the tax, and the total.

The tax comes from the store's own tax settings. That's draftOrderCalculate. Same input as create, and it returns the calculated totals.

Every action returns userErrors, and the page shows Shopify's message in a red toast. Calculate and create share one helper. It reads the same form and only changes the intent, so both always send the same input.

In my tests: no line items at all gives add at least one product, and quantity zero must be at least one.

Draft to order

Create draft order. It's in the open drafts now, with Russell and the same total. Each draft also has an invoice page, where the customer can pay.

Our table links to it. Create order. A new order, at the top.

Payment pending, unfulfilled. Each payment status gets its own badge colour: green for paid, yellow for pending, blue for refunded. That's draftOrderComplete, with payment pending true.

Leave that out, and Shopify marks the order as paid right away.

Paid

The money arrived by bank transfer, say. Mark as paid. Paid.

orderMarkAsPaid. In my tests, marking it a second time gave: order cannot be marked as paid. The button only shows for pending orders, so nobody marks an order as paid twice from our page.

Coming up: cancelling, refunding and restocking, in one call.

Cancel

Now Russell changes his mind. Cancel. Cancelling, as a background job.

Cancelled, and refunded. Order cancel takes a reason, a refund method, restock, and whether to email the customer. It returns a job, not the order.

Restock true puts the two pants back. In my test, the stock went back to exactly where it started. Cancelled orders don't get a cancel button any more.

The page checks cancelled at first. And in Shopify's own Orders list, there it is, at the top.

Three traps

Now GraphiQL, and three traps. First, how many orders can our app see? A handful, and the oldest is from early November.

The store has older orders, but the app can't see them. That's the sixty day window. Trap two: a custom item with no price.

No error. Shopify made it a zero dollar line. Always send a price.

Trap three: completing a draft that's already an order. This order has been paid. That message shows up even when the order was paid by hand, or still pending.

And cancelling twice: cannot cancel an order that has already been canceled. Want to practise? Add a note and tags to an order with order update, and find it in the admin by tag.

Honest notes

A few honest notes before the recap. One: every take of this video made a real order, so this test store now has a few cancelled orders. Orders can't simply be deleted.

Two: we didn't email the customer. Notify customer was false, and the draft's invoice page is there if you want them to pay online. Three: changing items on an existing order is order editing, a different set of mutations.

And everything you saw was tested on my real development store, on API version 2026-10, before I pressed record.

Recap

So, the recap. Add the draft order and order scopes, and remember the sixty day window. Build a draft, and let draftOrderCalculate do the maths.

Complete it into an order, payment pending or paid. And cancel with a refund and restock, as a background job. That's the Shopify draft order API in 2026, inside a real app, on a real store.

The full code for this episode is free on GitHub. The link is in the description. Next episode: fulfillments.

Shipping orders and adding tracking numbers. See you there.

Quick fixes from this episode (60-second Shorts)

Shopify Create Order API: Draft Order to Real Order in One Call

Shopify create order API (2026-10): build a draft order (product, custom item, discount, shipping), let draftOrderCalculate add the tax, then draftOrderComplete with paymentPending: true – a real order, payment pending. Tested on a real store.

Shopify Cancel Order API: Refund and Restock in One Mutation

Shopify cancel order API (2026-10): orderCancel takes a reason, a refund method, restock and notifyCustomer – and returns a job, because cancelling runs in the background. The order turned refunded, and the 2 units went back into stock. Cancel twice: 'already been canceled'.

Shopify Draft Orders API: 3 Traps (60 Days, $0 Items, Paid Twice)

Shopify draft orders API (2026-10), three traps: your app sees only the last 60 days of orders unless it has read_all_orders; a custom item with no price becomes a $0 line, no error; and a completed draft can't be completed again ('This order has been paid').

The Shopify App Development 2026 series

All episodes are free, with the code on GitHub. Course page: Shopify App Development 2026.

🔔 New episodes every week on the YouTube channel. Need a custom Shopify app or API integration? Wixob Technologies builds them: info@wixob.com.

One response to “Shopify Draft Order API 2026: Create Orders, Mark as Paid & Cancel from Your App”