I updated my code to this :
export const loader = async ({ request }) => {
const { billing, session } = await authenticate.admin(request);
const { shop } = session;
const { oneTimePurchases } = await billing.check({
plans: [ONE_TIME_PURCHASE],
isTest: false,
});
if (oneTimePurchases.length === 0) {
await billing.require({
plans: [ONE_TIME_PURCHASE],
isTest: false,
onFailure: async () =>
billing.request({ plan: ONE_TIME_PURCHASE, isTest: false }),
returnUrl: https://${shop}/admin/apps/playground-52/app,
});
}
return json({ apiKey: process.env.SHOPIFY_API_KEY || “” });
};
still have the same issue. no idea why.