Billing
Contains function used to bill merchants for your app.
This object is returned on authenticated Admin requests.
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: CheckBillingOptions<Config>) => Promise<BillingCheckResponseObject>(options: CheckBillingOptions<Config>) => Promise<BillingCheckResponseObject>requiredrequired
Checks if the shop has an active payment for any plan defined in the
billingconfig option.- 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.
CancelBillingOptions
- isTest
boolean - prorate
Whether to prorate the cancellation.
boolean - subscriptionId
The ID of the subscription to cancel.
string
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"])[]
RequestBillingOptions
- amount
Amount to charge for this plan.
number - currencyCode
Currency code for this plan.
string - interval
Interval for this plan. Must be set to `OneTime`.
BillingInterval.OneTime - isTest
Whether to use the test mode. This prevents the credit card from being charged. Test shops and demo shops cannot be charged.
boolean - lineItems
The line items for this plan.
({ interval?: BillingInterval.Every30Days | BillingInterval.Annual; discount?: { durationLimitInIntervals?: number; value?: { amount?: number; percentage?: never; } | { amount?: never; percentage?: number; }; }; amount?: number; currencyCode?: string; } | { interval?: BillingInterval.Usage; amount?: number; terms?: string; currencyCode?: string; })[] - plan
The plan to request. Must be one of the values defined in the `billing` config option.
keyof Config["billing"] - replacementBehavior
The replacement behavior to use for this plan.
BillingReplacementBehavior - returnUrl
The URL to return to after the merchant approves the payment.
string - trialDays
How many trial days to give before charging for this plan.
number
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"])[]