For example this is a workaround to get the information of the billing for the current user. The onFailure callback does nothing.
let billingInfo;
try {
billingInfo = await billing.require({
plans: [BASIC_TIER, PREMIUM_TIER, ULTIMATE_TIER],
isTest: false,
onFailure: async (error) => {
return new Response(null, { status: 204 }); // No Content response
},
});
} catch (error) {
// Handle any unexpected errors here
}
With billingInfo you can handle the logic.