Billing
Contains function used to bill merchants for your app with the Billing API.
This object is returned on authenticated Admin requests.
Managed App Pricing is now available. Define your app’s pricing plans directly in the Shopify Partner Dashboard, without needing to use the Billing API.
Managed App Pricing is now available. Define your app’s pricing plans directly in the Shopify Partner Dashboard, without needing to use the Billing API.
Anchor to billingbilling
Provides utilities that apps can use to request billing for the app using the Admin API.
- Anchor to cancelcancelcancel(options: CancelBillingOptions) => Promise<AppSubscription>(options: CancelBillingOptions) => Promise<AppSubscription>requiredrequired
Cancels an ongoing subscription, given its ID.
- Anchor to checkcheckcheck<Options extends CheckBillingOptions<Config>>(options?: Options) => Promise<BillingCheckResponseObject><Options extends CheckBillingOptions<Config>>(options?: Options) => Promise<BillingCheckResponseObject>requiredrequired
Checks if the shop has an active payment for any plan defined in the
billingconfig option.- Anchor to createUsageRecordcreate
Usage Recordcreate Usage Record (options: CreateUsageRecordOptions) => Promise<UsageRecord>(options: CreateUsageRecordOptions) => Promise<UsageRecord>requiredrequired Creates a usage record for an app subscription.
- Anchor to requestrequestrequest(options: RequestBillingOptions<Config>) => Promise<never>(options: RequestBillingOptions<Config>) => Promise<never>requiredrequired
Requests payment for the plan.
- Anchor to requirerequirerequire(options: RequireBillingOptions<Config>) => Promise<BillingCheckResponseObject>(options: RequireBillingOptions<Config>) => Promise<BillingCheckResponseObject>requiredrequired
Checks if the shop has an active payment for any plan defined in the
billingconfig option.- Anchor to updateUsageCappedAmountupdate
Usage Capped Amountupdate Usage Capped Amount (options: UpdateUsageCappedAmountOptions) => Promise<never>(options: UpdateUsageCappedAmountOptions) => Promise<never>requiredrequired Updates the capped amount for a usage billing plan.
CancelBillingOptions
- isTest
Whether to use the test mode. This prevents the credit card from being charged.
boolean - prorate
Whether to issue prorated credits for the unused portion of the app subscription. There will be a corresponding deduction (based on revenue share) to your Partner account. For example, if a $10.00 app subscription (with 0% revenue share) is cancelled and prorated half way through the billing cycle, then the merchant will be credited $5.00 and that amount will be deducted from your Partner account.
boolean - subscriptionId
The ID of the subscription to cancel.
string
Options
- layout
Whether to use the shop's theme layout around the Liquid content.
boolean
CheckBillingOptions
- isTest
Whether to include charges that were created on test mode. Test shops and demo shops cannot be charged.
boolean - plans
The plans to check for. Must be one of the values defined in the `billing` config option.
(keyof Config["billing"])[]
CreateUsageRecordOptions
- description
The description of the app usage record.
string - idempotencyKey
string - isTest
Whether to use the test mode. This prevents the credit card from being charged.
boolean - price
The price of the app usage record.
{ amount: number; currencyCode: string; } - subscriptionLineItemId
string
RequestBillingOptions
- isTest
Whether to use the test mode. This prevents the credit card from being charged. Test shops and demo shops cannot be charged.
boolean - plan
The plan to request. Must be one of the values defined in the `billing` config option.
keyof Config["billing"] - returnUrl
The URL to return to after the merchant approves the payment.
string
RequireBillingOptions
- isTest
Whether to include charges that were created on test mode. Test shops and demo shops cannot be charged.
boolean - onFailure
How to handle the request if the shop doesn't have an active payment for any plan.
(error: any) => Promise<Response> - plans
The plans to check for. Must be one of the values defined in the `billing` config option.
(keyof Config["billing"])[]
UpdateUsageCappedAmountOptions
- cappedAmount
The maximum charge for the usage billing plan.
{ amount: number; currencyCode: string; } - subscriptionLineItemId
The subscription line item ID to update.
string