I am also running into this, have you managed to solve it?
Topic summary
A developer encounters a 401 Unauthorized error when attempting to redirect users to Shopify’s billing approval page using billing.request() in a Remix app. The issue surfaced when an app reviewer couldn’t access upgrade/downgrade functionality, despite it working on test stores.
Key Technical Details:
- Error occurs when
billing.require()is called withtest: false - Server logs show “401 Unauthorized” response during billing request
- Paradoxically, subscription webhooks indicate successful plan activation despite the failed redirect
Proposed Solution:
A community member identified the root cause: wrapping billing.require() in a try-catch block prevents redirect responses from being thrown properly. The fix involves rethrowing the error after logging:
catch (error) {
console.log('error billing', error);
throw error; // Critical: rethrow to allow redirects
}
Current Status:
The discussion remains open with one other developer reporting the same issue. The suggested workaround addresses redirect handling but doesn’t fully explain the 401 error or the webhook activation paradox.