When creating a plan using the Manual billing Admin API for my app do I hardcode isTest:false or create an env?
When hard coding isTest:false I dont know how to test the charge on shopify dev, how are the shopify admins able to test this when I submit my app for approval?
When I use the environment variable: NODE_ENV = production on localhost and run “shopify app dev” the isTest gets overridden to true even tho I set NODE_ENV = production. But for some reason on the online Shopify dev shop (not localhost) it stays as the process.env.NODE_ENV === “development” result which is isTest:false because I set NODE_ENV = production. * - Why is this happening?
if (intent === "subscribe" && (plan === PLAN_BASIC || plan === PLAN_PRO)) {
try {
const shopHandle = session.shop.replace(".myshopify.com", "");
await billing.request({
plan,
isTest: process.env.NODE_ENV === "development",
returnUrl: `https://admin.shopify.com/store/${shopHandle}/apps/${process.env.SHOPIFY_API_KEY}/app/pricing`,
});
// The above call redirects, so code below won't run
} catch (error: any) {
console.error("[Billing] request failed:", error?.message);
console.error("[Billing] billingErrors:", JSON.stringify(error?.billingErrors ?? error?.errors ?? null, null, 2));
throw error;
}
}