Test charge for Dev Stores

Finally I was able to do this with following code:

export const loader = async ({ request }) => {
  const { admin, billing, session } = await authenticate.admin(request);
  const { shop } = session;
  const subscriptions = await getSubscriptionStatus(admin.graphql);
  const { activeSubscriptions } = subscriptions.data.app.installation;

  const shopPlanQuery = `
      query GetShopPlan {
        shop {
          plan {
            displayName
            partnerDevelopment
          }
        }
      }
    `;

    const response = await admin.graphql(shopPlanQuery);
    const data = await response.json();
    const plan = data.data.shop.plan;

    const isDevelopmentStore = plan.partnerDevelopment || 
      plan.displayName.toLowerCase().includes("development");

      if (isDevelopmentStore) {
      console.log("Development store detected. Using test billing.");
      await billing.require({
        plans: [MONTHLY_PLAN],
        isTest: true,
        onFailure: async () =>
          billing.request({
            plan: MONTHLY_PLAN,
            returnUrl: `https://${shop}/admin/apps/your-app-handle/app`,
            isTest: true,
          }),
      });
    } 

  if (activeSubscriptions.length < 1) {
    await billing.require({
      plans: [MONTHLY_PLAN],
      isTest: false,
      onFailure: async () =>
        billing.request({
          plan: MONTHLY_PLAN,
          returnUrl: `https://${shop}/admin/apps/your-app-handle/app`,
          isTest: false
        }),
    });
  }

  return json({ apiKey: process.env.SHOPIFY_API_KEY || "" });
};