skip to Main Content

I am creating a custom app(s) that should run for multiple merchants.

I want to run a central server for all my custom apps.

Shopify has 2 app types:

  • Custom App: Limited to installation on one merchant store
  • Public App: Unlimited merchant installs but needs to be reviewed by Shopify to protect trust and security.

The are several reasons we do not make this app public:

  • To avoid implementing the Shopify Billing API.
  • To avoid waiting for the app listing review.
  • The is no need for this App to be public on the Appstore

I understand that I need to create a single Shopify Custom App for each merchant, but how do I handle it on the server-side?

Is there any way to make the createShopifyAuth middleware to establish auth dynamically?

server/server.js

const { SHOPIFY_API_SECRET, SHOPIFY_API_KEY, SCOPES } = process.env;
server.use(
// TODO: Retrive shopID
// TODO: Fetch API_KEY, and API_SECRET from the db by given shopID
    createShopifyAuth({
      apiKey: SHOPIFY_API_KEY, // TODO: Use the API_KEY for given store
      secret: SHOPIFY_API_SECRET, // TODO: Use the API_SECRET for given store
      scopes: [SCOPES],

      async afterAuth(ctx) {
        //Auth token and shop available in session
        //Redirect to shop upon auth
        const { shop, accessToken } = ctx.session;
        await handlers.registerWebhooks(
          shop,
          accessToken,
          "ORDERS_PAID",
          "/webhooks/orders/paid",
          ApiVersion.October19
        );
        await handlers.registerWebhooks(
          shop,
          accessToken,
          "ORDERS_FULFILLED",
          "/webhooks/orders/fulfilled",
          ApiVersion.October19
        );
        ctx.cookies.set("shopOrigin", shop, {
          httpOnly: false,
          secure: true,
          sameSite: "none",
        });
        server.context.client = await handlers.createClient(shop, accessToken);

        await handlers.getOneTimeUrl(ctx);
        ctx.redirect("/");
      },
    })

2

Answers


  1. If you want to create a custom app for multiply stores you need to create multiply custom apps and target each store separately.

    If you want to use the same custom app for multiply stores that must be a public App and not a custom one.

    There is no way around this, it’s not code related but Shopify limitation. So there is no way to "trick" it to work here it’s just not possible.

    Please note that you are free to not list your public app in their app store. (there a lot of apps that are not listed in their store)

    I can’t confirm this but I believe that you are not require to implement the billing api if the app is free. (since I code mainly custom apps)

    Login or Signup to reply.
  2. According to Shopify, a Shopify custom Application can be installed just in one Shop.

    If you want your application to be used in multiple stores then it must be a public application you must go through the review process.

    Regarding Billing API, if your application is free you don’t need to go through the Billing API, you are also not allowed to charge your customers outside Shopify in this case.

    Regarding review times, if everything is working as expected then you should be approved within few weeks

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search