# 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="https://932524191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mks_UuU2atghAuA9bQz%2Fuploads%2FdtOb8bUTPiK1QZWfBkm2%2FScreenshot%202023-04-04%20at%2010.51.28%20AM.png?alt=media&#x26;token=18c049ce-3153-42df-8a57-10dbb2abfa19" 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](https://docs.middle.app/middle-docs/app-development/credential-storage) 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.
