A usage-based subscription is a pricing model that charges merchants continuously based on app use during Shopify's 30-day billing cycle. Merchants must approve the pricing plan. After accepting the charges, the merchant is redirected to a URL that you provide. ## Requirements - Your app can make [authenticated requests](/docs/api/admin-graphql#authentication) to the GraphQL Admin API. ## Step 1: Create the subscription Make a request to the [`appSubscriptionCreate`](/docs/api/admin-graphql/latest/mutations/appsubscriptioncreate) mutation with the following information: - [`name`](/docs/api/admin-graphql/latest/mutations/appSubscriptionCreate#argument-name) - [`returnURL`](/docs/api/admin-graphql/latest/mutations/appSubscriptionCreate#argument-returnurl) - `terms` Merchants review the terms of the subscription when they accept the pricing plan. - `cappedAmount` The `cappedAmount` is the maximum that a merchant is billed for during the 30-day billing cycle. The `currencyCode` must be one of the [supported currencies](/docs/apps/launch/billing#supported-currencies). The following mutation is an example:

Shopify uses the payload's `AppSubscription.id` and the `AppSubscriptionLineItem.id` to generate data for app usage records. ## Step 2: Create an app usage record After you've created the usage pricing plan and the merchant has accepted the plan, you can create a usage record with the [`appUsageRecordCreate`](/docs/api/admin-graphql/latest/mutations/appUsageRecordCreate) mutation. The usage record needs to include the `AppSubscriptionLineItem.id` of the `AppSubscription` object that the `appSubscriptionCreate` mutation returns. The following mutation is an example:

## Step 3: Monitor app usage limits Merchants can use the Shopify admin to change their subscription's capped amount. The capped amount is the maximum amount of usage to bill for within the 30-day billing cycle. To receive a notification when merchants change the capped amount, subscribe to the GraphQL Admin API's [`APP_SUBSCRIPTIONS_UPDATE`](/docs/api/admin-graphql/latest/enums/WebhookSubscriptionTopic#value-appsubscriptionsupdate) webhook topic. To receive a notification when merchants reach or exceed 90% of their capped amount, subscribe to the GraphQL Admin API's [`APP_SUBSCRIPTIONS_APPROACHING_CAPPED_AMOUNT`](/docs/api/admin-graphql/latest/enums/WebhookSubscriptionTopic#value-appsubscriptionsapproachingcappedamount) webhook topic. ## Step 4: Monitor subscription status changes To receive a notification when a subscription status changes, such as when a charge is successful, subscribe to the GraphQL Admin API's [`APP_SUBSCRIPTIONS_UPDATE`](/docs/api/admin-graphql/latest/enums/webhooksubscriptiontopic#value-appsubscriptionsupdate) webhook topic. ## Next steps

Discounts

Learn about offering subscription discounts.

Capped amount

Learn how to update the maximum amount that merchants can be charged for a subscription.