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!