Private previewThis page documents a private preview. Contact your Metronome representative to confirm access before using these provisional fields and endpoints. The API can change during the preview.
How payment-gated subscriptions work
Payment-gated subscriptions introduce astatus field that reflects subscription payment outcomes and helps your application manage entitlements. Metronome handles invoicing, payment-status tracking, and linked credit releases. Metronome also releases webhooks to enable you to grant or revoke access to your product.
- Metronome initiates payment. On the scheduled invoice date, Metronome creates and finalizes the subscription invoice, sends it to Stripe Invoicing, and triggers an immediate payment attempt.
- Metronome updates the subscription state. If payment succeeds, Metronome sets the subscription status to
ACTIVE, updates the paid quantity of the subscription, sends asubscription.payment_gate_statuswebhook, and releases linked recurring credits according to their access policy. If payment fails, Metronome withholds credit release and sends a corresponding webhook. - Your application updates entitlements. Use Metronome webhooks and status reads to grant access for the paid quantity or block or suspend access after payment failure. Metronome updates the subscription’s billing state; it doesn’t directly enable or disable users in your application. Listen to Stripe webhooks for detailed payment failure reasons.
Before you begin
- Set up your subscription pricing.
- Configure your Stripe integration. Payment-gated subscriptions currently support only Stripe Invoicing. Ensure that each Stripe customer has a default payment method and a valid stored customer address. Without these, payment attempts fail.
- Set up your webhook listeners. Listen for Metronome subscription status webhooks to manage entitlements. Also listen to Stripe webhooks for detailed PaymentIntent actions, such as 3DS authentication, and payment failure details.
Configure payment gating
For a hybrid pricing model that combines a subscription with recurring credits, configure two parts:- Subscription payment gate: Set
payment_gate_configon the subscription. Metronome automatically tracks payment status on the subscription invoice and updates the subscription status so your application can manage access and quantity changes. You can configure a subscription payment gate with or without recurring credits. - Recurring credit access policy: Set
subscription_config.access_policyon the linked recurring credit. Metronome manages credit releases based on subscription payment status and the policy you choose: require payment for each billing period, only the initial billing period, or neither. The linked subscription must have a payment gate configured.
Create a payment-gated subscription
Create a payment-gated subscription in the Metronome app or through the API, either when creating a new contract or when adding a subscription to an existing contract. Ensure that both the customer and the contract in Metronome have a valid Stripe billing provider configuration or subscription creation will fail. Consider an AI company that offers a $10 monthly subscription with 100 AI credits included. The company bills the subscription at the start of each month and grants that month’s credits only after payment succeeds. The following API call creates a contract for a new customer with a payment-gated subscription and linked recurring credits.cURL
getSubscriptionStatus API to inspect pending updates in open_invoices. Don’t grant access based on invoice creation or an in-progress payment. See Manage entitlements for more detail.
Choose when to release recurring credits
As shown in the API call above, attach a recurring credit or commit throughsubscription_config.subscription_id. When you create the subscription and credit in the same request, use the subscription’s temporary_id.
Set subscription_config.access_policy to control whether payment gates the credit release. This field is required when the recurring credit or commit is linked to a payment-gated subscription.
First-of-month processingA recurring credit gated on billing-period payment can take several hours to release when many subscriptions renew on the first day of the month. Gate only on initial billing period if you want to customers to have access to credits immediately when the new billing period begins.
Change subscription quantity
Suppose the AI company above adds a team plan where each seat costs $10 per month and includes 100 AI credits. A customer with one paid seat requests a second seat halfway through the month. Use the edit contract API to increase the subscription quantity by one, as shown below. See Manage seats for more information about quantity changes and linked credit behavior. Metronome creates an invoice for the additional seat and triggers payment in Stripe. With the example’s proration settings, the charge is prorated for the remaining billing period. While payment is pending,paid_quantity remains 1; don’t grant access to the additional seat yet.
cURL
One pending quantity change at a timeOnly one quantity change can be pending for a subscription at a time. While it is pending, no further changes are allowed except removing the pending change or ending the subscription. If a pending quantity change is not paid within one hour, Metronome automatically rolls back the quantity change and voids the corresponding invoices.
Manage entitlements
Use subscription status and paid quantity to determine product access, and use webhooks to keep your application’s entitlements up to date.Subscription statuses
Handle subscription webhooks
Use Metronome webhooks to understand when payment is updated and manage product access. Metronome sendssubscription.payment_gate_status whenever the paid quantity, subscription status, or external invoice is updated, except for the transition to ENDED. This includes successful renewals and quantity changes even when the subscription remains ACTIVE. Enable lifecycle events separately to handle subscription endings.
Treat Metronome as the source of truth for entitlement state and Stripe as the source of truth for payment actions.
- Listen for
subscription.payment_gate_statusand enabled lifecycle events. - Read the updated
statusandpaid_quantityto determine the customer’s entitlement. - Grant or update access for the paid quantity when the subscription is
ACTIVE. - Block or suspend access after an unsuccessful initial or renewal payment, according to your product policy. Remove access when the subscription ends.
- Make webhook handlers idempotent and use webhook delivery retries to recover from failed processing.
changes to understand why an event arrived, but use the updated status and paid_quantity to set entitlements. Note that a successful renewal can update the invoice fields without changing the subscription’s status or paid quantity.
Read subscription state through the API
Use thegetSubscriptionStatus API to programmatically view subscription state, reconcile entitlements, or check whether a payment is still pending. Pending or in-flight payments don’t update subscription status; inspect open_invoices for payable invoices and pending quantity changes. Don’t grant access based on an entry in open_invoices.
The response includes the following fields:
statusrepresents the subscription’s current payment-backed lifecycle state.paid_quantityis the quantity your application can entitle. During a pending quantity increase, it remains at the last successfully paid quantity.latest_cycle_invoicedescribes the latest subscription-cycle invoice with a conclusive payment outcome, whether successful or unsuccessful. It doesn’t represent a mid-period quantity-change invoice.open_invoiceslists payable subscription-cycle and quantity-change invoices that haven’t reached a terminal state. Use this field for diagnostics, not to grant access.
cURL
OPEN.
Handle payment failures
Listen to Stripe invoice and PaymentIntent webhooks to handle detailed payment failures and customer actions such as 3DS authentication. For example,invoice.payment_action_required indicates that the customer must complete an authentication action. Use Metronome subscription webhooks to manage product access and Stripe webhooks to guide the customer through resolving the payment issue.
Recover initial and renewal payments
Initial and renewal invoices have a 13-day payment window to accommodate payment methods such as ACH and give you time to handle payment recovery. This window isn’t an entitlement grace period: a failed payment still updates subscription status so your application can block or suspend access. Unlike failed quantity-change invoices, initial and renewal invoices remain payable during this window. For example, if a renewal payment fails:- Metronome sends a
subscription.payment_gate_statuswebhook with statusUNPAID. Your application suspends access according to your product policy. - Stripe sends a payment-failure notification. Your application prompts the customer to update their payment method or complete a required authentication action.
- The customer resolves the issue and the invoice is paid within the payment window.
- Metronome updates the subscription to
ACTIVE, sends a webhook, and releases credits as applicable. Your application restores access forpaid_quantity.
INCOMPLETE instead of UNPAID.
Invoice expiration
If payment doesn’t succeed within 13 days, Metronome automatically voids the Stripe invoice, which also voids the corresponding Metronome invoice. All open invoices expire at the end of their billing period, even if the 13-day window hasn’t elapsed. The effective deadline is the earlier of the 13-day payment deadline and the billing-period end. Your Stripe payment recovery settings, including Smart Retries, continue to apply automatically while the invoice remains open. Use Stripe webhooks to handle payment recovery actions. Failed quantity-change invoices don’t use this recovery window: retry those by requesting the seat increase again.Private preview limits
The following configuration limits apply during the private preview:- Quantity-based subscriptions only. Seat-based subscriptions that track individual seat IDs aren’t supported yet.
- Payment gated subscriptions must be billed in-advance (
collection_schedule: "advance") and quantity updates billed immediately (proration.invoice_behavior: "bill_immediately"). - Stripe Tax and Stripe Invoicing are the only supported downstream tax and invoicing systems.
- Invoice placement must be set on the scheduled invoice and cannot be combined with usage invoices.