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 createUsageRecordcreateUsageRecordcreateUsageRecord(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 updateUsageCappedAmountupdateUsageCappedAmountupdateUsageCappedAmount(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
AppSubscription
- createdAt
The date and time when the subscription was created.
string - currentPeriodEnd
The date and time when the current period ends.
string - id
The ID of the app subscription.
string - lineItems
ActiveSubscriptionLineItem[] - name
The name of the purchased plan.
string - returnUrl
The return URL for this subscription.
string - status
| 'ACTIVE' | 'CANCELLED' | 'PENDING' | 'DECLINED' | 'EXPIRED' | 'FROZEN' | 'ACCEPTED' - test
Whether this is a test subscription.
boolean - trialDays
The number of trial days for this subscription.
number
ActiveSubscriptionLineItem
- id
string - plan
AppPlan
AppPlan
- pricingDetails
RecurringAppPlan | UsageAppPlan
RecurringAppPlan
- discount
AppPlanDiscount - interval
BillingInterval.Every30Days | BillingInterval.Annual - price
Money
AppPlanDiscount
- durationLimitInIntervals
number - priceAfterDiscount
Money - remainingDurationInIntervals
number - value
AppPlanDiscountAmount
Money
- amount
number - currencyCode
string
AppPlanDiscountAmount
BillingConfigSubscriptionPlanDiscountAmount | BillingConfigSubscriptionPlanDiscountPercentageBillingConfigSubscriptionPlanDiscountAmount
- amount
The amount to discount. Cannot be set if `percentage` is set.
number - percentage
The percentage to discount. Cannot be set if `amount` is set.
never
BillingConfigSubscriptionPlanDiscountPercentage
- amount
The amount to discount. Cannot be set if `percentage` is set.
never - percentage
The percentage to discount. Cannot be set if `amount` is set.
number
BillingInterval
- OneTime
ONE_TIME - Every30Days
EVERY_30_DAYS - Annual
ANNUAL - Usage
USAGE
UsageAppPlan
- balanceUsed
Money - cappedAmount
Money - terms
string
Options
- layout
Whether to use the shop's theme layout around the Liquid content.
boolean
CheckBillingOptions
- plans
The plans to check for. Must be one of the values defined in the `billing` config option.
(keyof Config["billing"])[]
BillingCheckResponseObject
- appSubscriptions
The active subscriptions the shop has.
AppSubscription[] - hasActivePayment
Whether the user has an active payment method.
boolean - oneTimePurchases
The one-time purchases the shop has.
OneTimePurchase[]
OneTimePurchase
- id
The ID of the one-time purchase.
string - name
The name of the purchased plan.
string - status
| 'ACTIVE' | 'CANCELLED' | 'PENDING' | 'DECLINED' | 'EXPIRED' | 'FROZEN' | 'ACCEPTED' - test
Whether this is a test purchase.
boolean
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
UsageRecord
- description
The description of the usage record.
string - id
The ID of the usage record.
string - idempotencyKey
The idempotency key for this request.
string - plan
The subscription line item associated with the usage record.
ActiveSubscriptionLineItem - price
The price and currency of the usage record.
{ amount: number; currencyCode: string; } - subscriptionLineItem
The subscription line item associated with the usage record.
AppSubscriptionLineItem
AppSubscriptionLineItem
- id
The ID of the subscription line item.
string - plan
The plan associated with the subscription line item.
AppPlan
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
- 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