Enable Billing in Latest Shopify Nodejs embedded app template create with CLI.

Hey Community!
I am working on a Shopify embedded app, created using CLI and Nodejs latest template but I am facing a problem in enabling Recurring Billing. I am not able to enable the billing. I want to know how I can enable the billing in Nodejs latest Template. When I was using the old Template it works fine but due to a change in the template, I didn’t able to enable billing in it. I done the same that is written in shopify.js file which is in the template but it didn’t work.
This is the code for Enable billing in Shopify I use.

import { BillingInterval, LATEST_API_VERSION, BillingReplacementBehavior } from "@shopify/shopify-api";
import { shopifyApp } from "@shopify/shopify-app-express";
import { SQLiteSessionStorage } from "@shopify/shopify-app-session-storage-sqlite";
import { restResources } from "@shopify/shopify-api/rest/admin/2023-01";
const DB_PATH = `${process.cwd()}/database.sqlite`;

// The transactions with Shopify will always be marked as test transactions, unless NODE_ENV is production.
// See the ensureBilling helper to learn more about billing in this template.
const billingConfig = {
  "My Shopify Charge": {
    // This is an example configuration that would do a one-time charge for $5 (only USD is currently supported)
    amount: 5.0,
    currencyCode: "USD",
    interval: BillingInterval.Every30Days,
  },
};

const shopify = shopifyApp({
  api: {
    apiVersion: LATEST_API_VERSION,
    restResources,
    billing: billingConfig, //undefined or replace with billingConfig above to enable example billing
  },
  auth: {
    path: "/api/auth",
    callbackPath: "/api/auth/callback",
  },
  webhooks: {
    path: "/api/webhooks",
  },
  // This should be replaced with your preferred storage strategy
  sessionStorage: new SQLiteSessionStorage(DB_PATH),
});

export default shopify;

Please Guide me Thanks in advance!

@syedusama0786 I’m also having the same issue… Have you found something? If so please share it with me too. Thanks…

1 Like

Didn’t Got yet

1 Like

okay..

1 Like

@ranawaqarahmad Hey bro! Please check the following post. and please let me know if you got something. I think it will help you. I am also checking it.
https://community.shopify.com/c/shopify-apis-and-sdks/billing-plans-for-our-apps-node-template-in-shopify-cli-3-0/m-p/1967499#M88348

@ranawaqarahmad Hey!
I got the solution and I enable my billing on the new template…

Hi @syedusama0786 !

Could you explain the solution? Thanks !

yes sure what do you want to know?

Hi @syedusama0786 ,
I am new to shopify application development.
I am trying to follow the documentation for billing plan implementation. But there is nothing happening on my sandbox.
I tried to understand the shared link information by creating a /api/auth/callback route and to test the billing, but nothing.
There must be some detail that a novice can’t understand in the documentation.
I would like to know step by step how to activate billing plans.
Thanks for your help.

1 Like

I have found that : https://workshops.shopify.dev/workshops/usage-billing#4
containing a better explanation

1 Like

@rayvvond Bro I also use this link to enable billing you have to use the billing code as an middleware in index.js file.

hey @syedusama0786 @rayvvond @ranawaqarahmad i am also stuck in applying custom billing plans in shopify react/node application , can you please help me out with your solutions as links shared by you guys are expired now

Hi.. @Iamumar12 you can use the admin api to create app subscription https://shopify.dev/docs/api/admin-graphql/unstable/mutations/appsubscriptioncreate