Skip to main content

Billing

Contains function used to bill merchants for your app.

This object is returned on authenticated Admin requests.

Provides utilities that apps can use to request billing for the app using the Admin API.

(options: <Config>) => Promise<>
required

Checks if the shop has an active payment for any plan defined in the billing config option.

(options: <Config>) => Promise<>
required

Checks if the shop has an active payment for any plan defined in the billing config option.

(options: <Config>) => Promise<never>
required

Requests payment for the plan.

(options: ) => Promise<>
required

Cancels an ongoing subscription, given its ID.

Examples
import { LoaderFunctionArgs } from "@remix-run/node";
import { authenticate, MONTHLY_PLAN } from "../shopify.server";

export const loader = async ({ request }: LoaderFunctionArgs) => {
const { billing } = await authenticate.admin(request);
await billing.require({
plans: [MONTHLY_PLAN],
isTest: true,
onFailure: async () => billing.request({ plan: MONTHLY_PLAN }),
});

// App logic
};
Was this page helpful?