Naturaily logo with transparent background

How to Create Shopify Orders with API

Creating an order using Shopify API with status set to ‘paid’ might be somewhat a tough and tricky task. Surprisingly, this is not a practical or a trivial issue. In fact, an ability to catch a payment outside of Shopify, using a custom payment gateway, can be really convenient.

Shopify tutorial banner with a laptop on a desk, text reads "How to Create Paid Orders" on an orange background.

Creating an order using Shopify API with status set to 'paid' might be somewhat a tough and tricky task. Surprisingly, this is not a practical or a trivial issue. In fact, an ability to catch a payment outside of Shopify, using a custom payment gateway, can be really convenient.

How to efficiently deal with this problem?

Before we start, I assume that your application has already added 'shopify_api' gem to your Gemfile and you have full project configuration set up. There is a lot of materials on how to prepare your project to query Shopify API using 'shopify_api' gem.

But, let’s get back to our 'Orders' issue….

In a basic payment flow, we would like to set an order to 'Paid' after payment was successfully processed. Unfortunately, changing this status via API will not be easy. However, a great solution to this problem is to create a 'Draft Order' first and, after a user has paid, we can transform it into our needed state.

app/services/shopify_draft_order_creator.rb

tsx

This will result in new 'Draft Order' in your shopify admin panel. Ok, but now we would like to convert this into paid an 'Order.' This is really simple:

app/jobs/complete_draft_order_job.rb

tsx

And that’s it! We have successfully created a new paid order using Shopify API. As you can see in the example, this code can be implemented into the job to have an ability to perform it in the background. Additionally, this piece of code also shows how to add tags, which will appear in future orders. So basically draft_order.complete might be enough for you to close the 'Draft Order.'

Let’s take a look at an example payments controller just to realize how a full payment action would look like with this implementation.

app/controllers/payments_controller.rb

tsx

This example shows how this logic might be used in real action.

Choosing this solution has one additional advantage.

Every failure leaves a trace in the Shopify admin panel. It can be investigated by the shop administrator. He might not have any access to the application's errors or logs but he can check the abandoned Draft Orders.

Additionally, we do not pollute our 'Orders' section with failed transactions, etc. Every failure ends up in Drafts what leaves our Order panel nice and clean.

But…

This solution might not fit every shop user needs. Remember, if you plan to use draft orders on your own and complete them manually then this might interfere with your current flow and will not work well for you. This solution is intended to be used in automated and predictable vendors which will use Shopify mostly as an admin panel.

Nevertheless, I hope you will find this small workaround interesting and also helpful.

Let's Build a Great Shopify Project Together

We'll shape your e-commerce the way you win it!

More posts in this category

  • Illustration of a person with a laptop and a robot in front of a large screen displaying "AI" on a green background with tech icons.

    October 03, 2025 • 8 min read

    Are You Ready for ChatGPT Instant Checkout? A Shopify Merchant’s Playbook for What to Fix First

    ChatGPT's new Instant Checkout feature is changing how people shop online. More consumers now turn to AI tools when making purchase decisions, discovering products through chatbot interactions rather than conventional search or ads. Shopify wants to ensure its million-plus merchants can sell wherever these AI conversations take place.

    READ MORE
  • Illustration of migrating from BigCommerce to Shopify, featuring a shopping cart and a laptop with graphs on a green background.

    September 02, 2025 • 12 min read

    BigCommerce to Shopify Migration – Explained Step-by-Step

    So, you're thinking about making the jump from BigCommerce to Shopify? You're definitely not alone in this decision. Every day, businesses around the world are making this exact same move, and honestly, for good reason.

    READ MORE
  • Illustration of a person interacting with digital checklists on a monitor, surrounded by icons of gears, graphs, and a Shopify bag on a green background.

    July 21, 2025 • 19 min read

    How Much Does a Shopify Website Really Cost?

    Thinking about starting a Shopify store but wondering about the real costs involved? You're not alone. Let's break down everything you need to know about Shopify pricing – from the obvious monthly fees to the hidden costs that can catch new merchants off guard.

    READ MORE