--- title: Combine time and usage-based subscriptions description: Learn how to create a subscription with a pricing model that combines a recurring subscription plan with usage charges. source_url: html: https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage md: https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage.md --- ExpandOn this page * [Requirements](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#requirements) * [Step 1: Create the subscription](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-1-create-the-subscription) * [Step 2: Create an app usage record](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-2-create-an-app-usage-record) * [Step 3: Monitor app usage limits](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-3-monitor-app-usage-limits) * [Step 4: Monitor subscription status changes](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-4-monitor-subscription-status-changes) * [Next steps](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#next-steps) # Combine time and usage-based subscriptions You can implement a pricing model for your app that combines a recurring, [time-based](https://shopify.dev/docs/apps/launch/billing/subscription-billing/create-time-based-subscriptions) subscription plan with [charges based on use](https://shopify.dev/docs/apps/launch/billing/subscription-billing/create-usage-based-subscriptions) with. Combined plans are supported for 30-day billing intervals. 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](https://shopify.dev/docs/api/admin-graphql#authentication) to the GraphQL Admin API. *** ## Step 1: Create the subscription Make a request to the [`appSubscriptionCreate`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/appsubscriptioncreate) mutation with the following information: * [`name`](https://shopify.dev/docs/api/admin-graphql/latest/mutations/appSubscriptionCreate#argument-name) * [`returnURL`](https://shopify.dev/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](https://shopify.dev/docs/apps/launch/billing#supported-currencies). The following mutation is an example: ## POST https\://{shop}.myshopify.com/api/{api\_version}/graphql.json ## JSON response ```json { "data": { "appSubscriptionCreate": { "userErrors": [], "confirmationUrl": "https://{shop}.myshopify.com/admin/charges/4028497976/confirm_recurring_application_charge?signature=BAh7BzoHaWRsKwc4AB7wOhJhdXRvX2FjdGl2YXRlVA%3D%3D--987b3537018fdd69c50f13d6cbd3fba468e0e9a6", "appSubscription": { "id": "gid://shopify/AppSubscription/4028497976", "lineItems": [ { "id": "gid://shopify/AppSubscriptionLineItem/4028497976?v=1&index=0", "plan": { "pricingDetails": { "__typename": "AppRecurringPricing" } } }, { "id": "gid://shopify/AppSubscriptionLineItem/4028497976?v=1&index=1", "plan": { "pricingDetails": { "__typename": "AppUsagePricing" } } } ] } } }, ... } ``` 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`](https://shopify.dev/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 is an example: ## POST https\://{shop}.myshopify.com/api/{api\_version}/graphql.json ## GraphQL mutation ```graphql mutation { appUsageRecordCreate( subscriptionLineItemId: "gid://shopify/AppSubscriptionLineItem/4019585080?v=1&index=0", description: "Super Mega Plan 1000 emails", price: { amount: 1.00, currencyCode: USD } ) { userErrors { field, message }, appUsageRecord { id } } } ``` ## JSON response ```json { "data": { "appUsageRecordCreate": { "userErrors": [], "appUsageRecord": { "id": "gid://shopify/AppUsageRecord/14518231" } } }, ... } ``` *** ## 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`](https://shopify.dev/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`](https://shopify.dev/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`](https://shopify.dev/docs/api/admin-graphql/latest/enums/webhooksubscriptiontopic#value-appsubscriptionsupdate) webhook topic. *** ## Next steps [![](https://shopify.dev/images/icons/48/star.png)![](https://shopify.dev/images/icons/48/star-dark.png)](https://shopify.dev/docs/apps/launch/billing/subscription-billing/offer-subscription-discounts) [Discounts](https://shopify.dev/docs/apps/launch/billing/subscription-billing/offer-subscription-discounts) [Learn about offering subscription discounts.](https://shopify.dev/docs/apps/launch/billing/subscription-billing/offer-subscription-discounts) [![](https://shopify.dev/images/icons/48/growth.png)![](https://shopify.dev/images/icons/48/growth-dark.png)](https://shopify.dev/docs/apps/launch/billing/subscription-billing/update-max-charge) [Capped amount](https://shopify.dev/docs/apps/launch/billing/subscription-billing/update-max-charge) [Learn how to update the maximum amount that merchants can be charged for a subscription.](https://shopify.dev/docs/apps/launch/billing/subscription-billing/update-max-charge) [![](https://shopify.dev/images/icons/48/changelog.png)![](https://shopify.dev/images/icons/48/changelog-dark.png)](https://shopify.dev/docs/apps/launch/billing/subscription-billing) [Prorated and deferred charges](https://shopify.dev/docs/apps/launch/billing/subscription-billing) [Learn how Shopify handles prorating and deferring app subscription charges.](https://shopify.dev/docs/apps/launch/billing/subscription-billing) *** * [Requirements](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#requirements) * [Step 1: Create the subscription](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-1-create-the-subscription) * [Step 2: Create an app usage record](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-2-create-an-app-usage-record) * [Step 3: Monitor app usage limits](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-3-monitor-app-usage-limits) * [Step 4: Monitor subscription status changes](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#step-4-monitor-subscription-status-changes) * [Next steps](https://shopify.dev/docs/apps/launch/billing/subscription-billing/combine-time-and-usage#next-steps)