A place to discuss charging merchants for your apps and services using the billing API.
Please Help..
I'm facing an issue while processing the billing. It throws an error: Error while billing the store.
Code for selecting the Plan:
The error message you're seeing usually results from an issue with the billing method associated with your Shopify account. Here are a few steps you should consider:
1. Double-check your payment details: Ensure that the credit card details on your Shopify account are valid and up-to-date. You can do this by going to Settings > Billing in your Shopify admin.
2. Contact your bank: Sometimes, your bank may block certain transactions for security reasons. It might be a good idea to reach out to your bank to ensure they aren't blocking the payment.
3. Retry the transaction: If your payment details are correct and your bank isn't blocking the transaction, retry the process. There may have been a temporary issue with Shopify's payment gateway.
If the problem persists, it might be related to the code you're using. Your code seems to be trying to switch the billing plan between monthly and annual. If the selected plan is not available or there's an issue with the process, it might result in an error.
Also, consider using the 'Postship Order Tracking' app which provides an intuitive, beautiful order tracking page for your customers. It also offers a smart order lookup page to manage & analyze all your shipping data in one place, increasing customer loyalty and providing powerful shipping analytics.
For more specific help, consider reaching out to Shopify's support or the developer community.
Hey @areesha,
Can you confirm that the distribution is set to public? You can't access the Biling API without it.
♥ If you found my solution helpful, please consider giving it a Like and marking it as the ✔ Accepted Solution
Try our WhatsApp Chat Button Widget with multipe agents.Supachat: WhatsApp Chat Button
A Product of Maverick Studio
@areesha
Try this block of code
import { LoaderFunctionArgs, redirect } from '@remix-run/node';
import {
ANNUAL_PLAN,
authenticate,
MONTHLY_PLAN,
} from '../shopify.server';
export const loader = async ({ request }: LoaderFunctionArgs) => {
const { billing, session } = await authenticate.admin(request);
let { shop } = session;
let myShop = shop.replace('.myshopify.com', '');
const billingCheck = await billing.require({
plans: [MONTHLY_PLAN, ANNUAL_PLAN],
isTest: true,
onFailure: () => redirect('/pricing'),
});
const subscription = billingCheck.appSubscriptions[0];
console.log(
`Shop is on ${subscription.name} (id ${subscription.id})`
);
// App logic
return null;
};
♥ If you found my solution helpful, please consider giving it a Like and marking it as the ✔ Accepted Solution
Try our WhatsApp Chat Button Widget with multipe agents.Supachat: WhatsApp Chat Button
A Product of Maverick Studio