0.3.0 • Published 1 year ago

strapi-plugin-shopify v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Strapi Plugin Shopify

Build a Shopify application with Strapi.

Table Of Content

Requirements

Strapi v4 is required.

Installation

npm install --save strapi-plugin-shopify

Middlewares configuration

Webhooks are authenticated with HMAC calculated on the raw body, strapi::body middleware should be configured to pass the unparsed body as following:

{
  name: 'strapi::body',
  config: {
    includeUnparsed: true,
  },
},

If you want to serve an embedded app directly from Strapi you will find that default CSP policies will not allow to do that, strapi::security middleware should be configured as following (this configuration should be used only if you have problem with the embedded app iframe):

{
  name: 'strapi::security',
  config: {
    contentSecurityPolicy: {
      useDefaults: true,
      directives: {
        'frame-ancestors': null,
      },
    },
    frameguard: false,
  },
},

Shopify Configuration

The Shopify application should be configured as follow:

  • App URL should be set as https://your-domain.com/api/shopify
  • Allowed redirection URL(s) should have both
    • https://your-domain.com/api/shopify/install/callback
    • https://your-domain.com/api/shopify/auth/callback

Screenshot illustrating how to configure the Shopify application

Environment Variables

This plugin needs the following environment variables to work:

VariableExampleDescription
HOST_NAMEshop3.appthe host name of your app without the protocol (http or https)
SHOPIFY_API_KEY553536bf79ee112525f63aaf25df59f8the API key generated by Shopify
SHOPIFY_API_SECRET687b73300b570bdbe53220d84a18e23dthe API secret generated by Shopify
SHOPIFY_SCOPESread_locales,read_productsthe API scopes used by the application
SHOPIFY_APP_EMBEDDEDtruewhether the app is an embedded app or not
SHOPIFY_REDIRECT_URLhttps://shop3.app/homethe url where the user is redirect after authentication

Endpoints

This are the endpoints exposed by this plugin:

MethodPathDescription
GET/api/shopifythe entry point of the application, it handles installation and authentication
POST/api/shopify/webhooksthe default webhooks endpoint called by Shopify
GET/api/shopify/installthe installation endpoint, should not be called directly, use /api/shopify instead
GET/api/shopify/install/callbackthe installation callback endpoint, should be called only by Shopify
GET/api/shopify/auththe authentication endpoint, should not be called directly, use /api/shopify instead
GET/api/shopify/auth/callbackthe authentication callback endpoint, should be called only by Shopify
POST/api/shopify/auth/logoutthe logout endpoint, should be called to delete the Shopify session
GET/api/shopify/shopthis endpoint should be called to get the authenticated shop data
GET/api/shopify/plansthis endpoint should be called to get available subscription plans
GET/api/shopify/subscriptionthis endpoint should be called to get the shop subscription
POST/api/shopify/subscriptionthis endpoint should be called to create a shop subscription
0.3.0

1 year ago

0.1.0

2 years ago

0.2.1

1 year ago

0.1.2

1 year ago

0.2.0

1 year ago

0.1.1

2 years ago

0.0.5

2 years ago

0.1.3

1 year ago

0.0.6

2 years ago

0.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.4

2 years ago

0.0.0

2 years ago