How to implement BillingApi subscription in NodeJs React?

Shopify Partner
1 0 0

Hello. My application is currently being reviewed and I'm stuck at one stage.

I was asked to add a BillingApi implementation so that during application installation the user is prompted to subscribe.

I'm using the Shopify template on NodeJs React and noticed that their setup for the Billing Api simply doesn't work. Therefore, I created middleware with verification and redirect to the subscription page

The problem is that I have the isTest flag, which is disabled on the production server, but somehow Shopify support turned on the test mod during testing, and although they “pay for the subscription,” my middleware does not see this and redirects back to the payment page

export const validateSubscription = async (req, res, next) => {
  const plans = Object.keys(billingConfig)
  const session = res.locals.shopify.session
  const hasPayment = await shopify.api.billing.check({
    plans: plans,
    isTest: process.env.NODE_ENV !== 'production',

  if (hasPayment) {
  } else {
      redirectUri: await shopify.api.billing.request({
        session: res.locals.shopify.session,
        plan: plans[0],
        isTest: process.env.NODE_ENV !== 'production',
      shop: shopify.api.utils.sanitizeShop(,

Replies 0 (0)