We have two applications where we’ve implemented the Billing API. In one application, everything is working fine, but in the second application, we’re getting an “application error” while subscribing. However, when we refresh the page, it starts working properly.
We’ve verified that the package versions, Shopify CLI version, and code set are the same in both applications.
Here’s our code snippet:
const returnUrl = ‘https://${session.shop}/admin/apps/${appHandle}/app/subscriptions’;
//Available plans: { ESSENTIAL_PLAN: ‘Essential Plan’, ADVANCED_PLAN: ‘Advanced Plan’ }
//isTest: true,
//returnUrl: https://test-discounts.myshopify.com/admin/apps/test-discount/app/subscriptions
await billing.require({
plans: [ESSENTIAL_PLAN, ADVANCED_PLAN],
isTest,
returnUrl,
onFailure: async () =>
billing.request({
plan: plan === “essential” ? ESSENTIAL_PLAN : plan === “advanced” ? ADVANCED_PLAN : “”,
returnUrl,
isTest,
}),
});
