Initial Configuration: To Establish the Store Connection with a Custom App
The following activity will walk you through the process of creating a custom Shopify app and connecting your Shopify store to your MYOB Acumatica instance with the credentials of the custom app.
Story
Suppose that the SweetLife Fruits & Jams company wants to sell jam in its online store, which is deployed on the Shopify platform. SweetLife is already using MYOB Acumatica and now needs to integrate its instance with a new Shopify store. As SweetLife's implementation consultant, you need to create and install a custom app in your Shopify store and establish the connection between MYOB Acumatica and the Shopify store using the app's credentials .
Process Overview
In this activity, you will create a custom app in the Shopify dev dashboard,and assign it the necessary access permissions. Then you will install the app and generate an access token for it. Finally, you will use the app's credentials to connect MYOB Acumatica to your Shopify store.
System Preparation
Before you start this activity, do the following:
- Make sure you have deployed an MYOB Acumatica instance and made it publicly accessible through the internet.
- Make sure you have set up a Shopify store, as described in Initial Configuration: To Set Up a Shopify Store.
- Sign in to MYOB Acumatica by using the gibbs username and the 123 password.
- Sign in to the Shopify store as the store owner.
- Sign up for free to https://postman.com/.
Step 1: Creating a Custom App
Before you can establish a connection between your instance of MYOB Acumatica and the online store, you need to create a custom app for the store as follows:
- In the lower left of the Shopify admin area, click Settings.
- In the left menu of the page that opens, click Apps.
- In the top right, click Develop apps.
- On the App development page, in the Build and
manage apps in your Dev Dashboard section, click
Build apps in Dev Dashboard.
The dev dashboard page opens in a new browser tab.
- On the Apps page of the dev dashboard, in the top right, click Create app.
- On the Create an app page that opens, in the Start from Dev Dashboard section, enter Acumatica ERP Custom in the App name box.
- Click Create next to the app name.
Shopify creates the custom app, opens the Acumatica ERP Custom app page, and prompts to create the app version on the Create version page.
Step 2: Configuring the App
After you have created the custom app, you need to configure it and assign API scopes to it. To do this, while you are still viewing the Create version page of the Acumatica ERP Custom app on the dev dashboard, do the following:
- In the Webhooks API version section, leave the default value, which is the current version of the Shopify API.
- In the Access section, click Select scopes.
- In the Select scopes dialog box that opens, select the check boxes for all the listed scopes.
- In the lower right, click Done to save your
changes.
The dialog box closes. You can now see all the scopes you have selected listed in the Access section.
- In the Redirect URLs, enter http://localhost. This is the URL you will be redirected to once the app is installed. You will need this to get an authorization code later.
- Optional: In the POS section, select the Embed app in Shopify POS check box if you plan to integrate custom functionality directly into the Shopify Point of Sale interface.
- In the lower right, click Release.
- In the Release this new version? dialog box that opens,
click Release.
On the Versions page that opens, you can see the active acumatica-erp-custom-2 version of the app you have just released.
- In the left menu, click Acumatica ERP Custom.
Step 3: Installing the App
After you have created and configured the custom app, you need to install it to your Shopify store. To do this, while you are still viewing the Acumatica ERP Custom app on the dev dashboard, do the following:
- In the left menu, click Acumatica ERP Custom.
- On the Overview page that opens, in the
Installs section, click Install
app.Tip:
If you create a custom app through the Shopify admin, as we’ve done here, you can install the app only in the same Shopify store.
Otherwise, you need to choose a distribution method on the same page before installing it. Public distribution makes the app publicly available, allowing you to distribute or sell it to multiple merchants through the Shopify App Store. Custom distribution allows you to distribute the app to one store or to multiple stores within the same Shopify Plus organization by using a distribution link.
- In the Shopify admin area that opens in a new browser tab, on the Install
app page, click Install in the lower
right.
The system installs the app and opens the app page, displaying the example domain that was selected by default in the app settings and that we did not change. You can also see the app listed under Apps in the left menu.
Step 4: Locating the Client ID and Secret
To locate the client ID and secret key for the custom app, do the following:
- Go back to the browser tab with the Acumatica ERP Custom app opened on the Shopify dev dashboard.
- In the left menu, click Settings.
On the Settings page that opens, in the Credentials section, notice the client ID and the secret key in the Client ID and Secret boxes, respectively. You can click the Copy to clipboard button next to them to copy them.
Step 5: Initiating Authorization
To obtain the access token for your custom app, you first need to initiate authentication and obtain the authorization code. Do the following:
- In the address bar of a new browser tab, enter the following URL:
https://<store
name>.myshopify.com/admin/oauth/authorize?client_id=<client
id>&redirect_uri=<redirect url>.
In this URL, you should replace the following values that correspond to your store and custom app:
- <store name>: The store name that you can copy from the URL address of your Shopify admin area or storefront. For a trial store, the <store name> is a randomly generated unique alphanumeric value.
- <client id>: The client ID of your custom app that you obtained in Step 4 of this activity.
- <redirect url>: The redirect URL that is specified for the active version of your custom app. In this activity, you have been asked to use http://localhost.
Your URL should look similar to the following one: https://e25dix-a1.myshopify.com/admin/oauth/authorize?client_id=ad15137b47062b8a00c522189b491a95&redirect_uri=http://localhost
- Navigate to the URL.
This initiates the authentication process and redirects you to the local host you specified as the redirect URL.
- Copy the authorization code from the URL of the page you have been redirected to. This URL should look similar to the following one, where the authorization code follows the code= text: http://localhost/?code=<authorization code>&hmac=<hash-based message authentication code>&host=<host code>&shop=<store name>.myshopify.com×tamp=<time stamp>
Step 6: Obtaining the Access Token
Having the client ID, secret, and the authorization code, you can obtain the access token. You will use Do the following:
- In a new browser tab, open the Postman API Client and create a request with the
following parameters, as shown in the screenshot below:
- Method: POST
- URL (right to the method): https://<store
name>.myshopify.com/admin/oauth/access_token
In the URL, replace the <store name> with the store name that you can copy from the URL address of your Shopify admin area or storefront.
- Add the following query
parameters
to your request, which are also shown in the screenshot below:
- client_id: The client ID of your custom app that you obtained in Step 4 of this activity.
- client_secret: The secret key of your custom app that you obtained in Step 4 of this activity.
- code: The authorization code that you obtained in Step 5 of this activity.
As soon as you add a query parameter, Postman adds it to the URL.
Figure 1. The Postman request 
- Click Send to send the request.
Postman processes your request and returns a response. Notice the access token that is going to be the second line of the response, starting with access_token.
Tip: The authorization code is short-lived and typically expires within several minutes. If you receive the 400 - Oauth error response, repeat the instructions of Step 5 to regenerate the authorization code, and send the request with the new code again.
Step 7: Establishing the Store Connection
To establish a connection with the Shopify store, in your instance of MYOB Acumatica, do the following:
- On the Shopify Stores (BC201010) form, create a new record.
- In the Summary area, enter SweetStore - SP in the Store Name box.
- On the General tab, use the information that you have
captured in the previous step to specify the settings as follows:
- In the Store Admin URL box, enter the path of
your Shopify store with admin/ added to the end.
The full URL usually looks like this: https://<store name>.myshopify.com/admin/.
- In the API Access Token box, enter the access token that was generated for the custom app that you have installed in your Shopify store.
- In the API Secret Key box, enter the API secret key that was generated for the custom app that you have installed in your Shopify.
- In the Store Admin URL box, enter the path of
your Shopify store with admin/ added to the end.
- On the form toolbar, click Save to save your changes.
- Click Test Connection on the form toolbar to verify that
you have specified the connection settings correctly.
If the connection is successfully established, the system fills in the Store Properties section with the store settings. You can proceed to specifying the required settings for entities, customers, inventory, orders, and payments.
