# Shopify

Currently, Middle only supports authentication with Shopify via a [custom app](https://help.shopify.com/en/manual/apps/custom-apps).

{% hint style="info" icon="circle-info" %}
Middle cannot support a connection to Shopify via an OAuth flow using [a public app](https://shopify.dev/apps/store/requirements)
{% endhint %}

## Connecting with a custom app

Custom apps live at the Shopify store level and are created and configured by a Shopify store admin. You will need to create a custom app for each of the stores you need to connect.

{% stepper %}
{% step %}

### Create custom app

The below instructions explain how a Shopify admin can create a custom app:

1. Click **Apps** in the left-hand navigation bar in your store or search for “Apps” in the search bar
2. Click **Develop apps** to the left of “Shopify App Store” or click **Developer apps for your store** under “Build custom apps for your unique needs”
3. If you haven’t already, you’ll need to click **Allow custom app development**
4. Once you’ve reviewed and agreed to Shopify’s disclaimer you should be able to click to **Create an app**
5. This will bring up a pop-up to begin creating your custom app.
6. Name the app
7. Set the developer as yourself
8. Congratulations! You have created an app. Now, you’ll need to click to **Configure the Admin API Scopes**. Your app’s admin API scopes determine what data your app will be allowed to access or what actions your app will be able to perform in Shopify. Essentially, you’re setting up what will be allowed to go through the doorway your app represents. Scopes are important for data security. There is no reason to enable more scopes than are necessary.
9. You will need to enable the following scopes to grab data from Shopify:
   * read\_products
   * read\_orders
   * read\_customers
   * read\_locations
   * Read\_shopify\_payments\_payouts
10. You can ignore the other settings on this page, like webhook subscriptions, etc. Go ahead and click **Save**.
11. Next, you’ll need to get your app’s credentials (the lock and key on your door). To do this, go to **API credentials** in the menu at the top of the page.
12. You’ll then need to download the app to your store. Go ahead and click to do this.
13. You should then see three credentials: “Admin API access token,” “API key and secret,” and your access token these are needed in Middle.

<figure><img src="/files/dpd8c6KPJAzCquqrnxSJ" alt=""><figcaption><p>Custom app credentials in Shopify</p></figcaption></figure>
{% endstep %}

{% step %}

### Enter credentials in Middle as an API key

Enter these credentials as an [API key](/middle-docs/app-development/credential-storage.md) in the Shopify app in your Middle instance. The format should resemble the following:

```json
{
"client_id":  "XXXXXXXX",
"client_secret": "XXXXXXXX",
"personal_store_token": "XXXXXXXX"
}
```

{% endstep %}
{% endstepper %}

Repeat the above steps for any other stores.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.middle.app/middle-docs/guides/app-reference/shopify.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
