Issue while redirecting to Billing approval page in remix embedded application.

Shopify Partner
3 0 1


So basically I am working on an application and I have implemented the billing api successfully. It was working fine earlier but recently I started to get an issue.

As soon as the user lands on my application just after the installation, it automatically gets redirected to billing page if he has no current active subscriptions. But during that redirection, I encounter an error (please refer to image below)



But after a second or two, it gets redirected to billing page without me refreshing the page.

This would not be an issue if the user uses the application with their desktop or laptop but if he tries to access the application from the mobile app. He will encounter below error.



Any help is truly appreciated as it is stopping me to move further with my deployment process.


For the reference I have added the code below as well.


import { authenticate, MONTHLY_PLAN } from "../shopify.server";

export const loader = async ({ request }: any) => {
  const { billing, session } = await authenticate.admin(request);
  let { shop } = session;
  let myShop = shop.replace("", "");

  await billing.require({
    plans: [MONTHLY_PLAN],
    onFailure: async () =>
        plan: MONTHLY_PLAN,
        isTest: true,
        returnUrl: `${myShop}/apps/${process.env.APP_NAME}/`,

  return null;


Inside app._index.tsx

//Run the active subscription qiery to  get current status of user's subscription
export async function loader({ request }: any) {
  const { session, admin, redirect } =
    await authenticate.admin(request);
  let { shop } = session;

  try {
    const result = await admin.graphql(
      query Shop {
        app {
          installation {
            activeSubscriptions {
      { variables: {} },

    const resultJson = await result.json();
    const activeSubscriptions =;

    //If there are no current active susbcription, the user will automatically will be redirected to billing page
    if (activeSubscriptions.activeSubscriptions.length < 1) {
      return redirect("/app/buyPro");
    return { activeSubscriptions, shop };
  } catch (error: any) {
    throw error;


Replies 2 (2)

Shopify Partner
1 0 0

You can try using billing.require in app index too. onFailure can redirect. Remove graphql call in this case. Probably wouldn't help but give it a chance.

Shopify Partner
3 0 1

@ulas1  As expected, I am still facing the same issue.

Attached are the screenshots on desktop and mobile.


image (1).png