Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Billing seems to have stopped working #477

Closed
hmpws opened this issue Oct 24, 2023 · 1 comment
Closed

Billing seems to have stopped working #477

hmpws opened this issue Oct 24, 2023 · 1 comment

Comments

@hmpws
Copy link

hmpws commented Oct 24, 2023

Issue summary

Using the new remix app template, billing.request returns a {"size": 0} error.

  • @shopify/shopify-app-* package and version:
    "@shopify/app": "^3.48",
    "@shopify/shopify-app-remix": "^2.0.0"
  • Node version: v18.12.1
  • Operating system: Windows 11

Expected behavior

Billing should redirect to payment page. The code was working correctly a couple of days ago.

Actual behavior

{"size": 0} error

Steps to reproduce the problem

Modified shopify.server.js with:

export const PREMIUM_PLAN = "Premium";
export const billingConfig = {
  [PREMIUM_PLAN]: {
    amount: 3.99,
    currencyCode: "USD",
    interval: BillingInterval.Every30Days,
    trialDays: 7,
  },
};

... add billing: billingConfig to shopifyApp

Requested billing with:

   const { billing } = await authenticate.admin(request);
    const billingCheck = await billing.require({
      plans: [PREMIUM_PLAN],
      isTest:
        process.env.APP_ENV === "development" ||
        process.env.NODE_ENV === "development"
          ? true
          : false,
      onFailure: async () =>
        billing.request({
          plan: PREMIUM_PLAN,
          isTest:
            process.env.APP_ENV === "development" ||
            process.env.NODE_ENV === "development"
              ? true
              : false,
        }),
    });

We can't release this app as it is without billing!

@hmpws
Copy link
Author

hmpws commented Oct 24, 2023

Just realised I put a try catch block around it and that caught the error instead of going to onFailure.

@hmpws hmpws closed this as completed Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant