Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
Billing
    Overview
    About the Billing APIs
    Subscriptions
    Invoicing
    Usage-based billing
      Choose a usage-based billing setup
      Record usage for billing
      Offer billing credits
      Monitor usage
        Alerts
        Thresholds
      Usage-based pricing models
    Connect and Billing
    Tax and Billing
    Quotes
    Revenue recovery
    Automations
    Scripts
    Revenue recognition
    Customer management
    Entitlements
    Test your integration
Tax
Reporting
Data
Startup incorporation
HomeFinance automationBillingUsage-based billingMonitor usage

Set up usage-based alertsPublic preview

Set up an alert for when a customer exceeds a usage threshold.

Copy page

Set up alerts to get notified when customers exceed meter usage thresholds, or to trigger an invoice when customers reach a specific billing threshold. You can create alerts that apply to either specific customers or all customers.

Before you begin

You must create a meter before you create an alert.

Create usage alerts

You can configure alerts using the Stripe Dashboard or API.

For example, you can create a one-time alert for customers that triggers when they reach 100 API calls. When a customer reaches 100 API calls, you receive a webhook notifying you that the customer has exceeded the threshold.

Stripe provides a usage alert type called One-time per-customer usage alert. This alert triggers when a customer exceeds the specified usage level for the first time, and only triggers one time per customer, regardless of future usage.

  1. On the Billing Alerts page, click Create alert.

  2. On the New alert page, do the following:

    • For Name, enter the name for your alert. This isn’t visible to customers.
    • Under Alert type, select the meter that you want to set up alerts for.
    • For Unit threshold, set the usage amount to reach for an alert to trigger.
    • (Optional) Under Application, select Specific customer and the customer name, if you want the alert to apply only to that customer. Otherwise, leave the default of Any customer to configure the alert for all customers.
    • Click Create alert.

Listen for webhooks

After you configure an alert and start sending usage for that meter, you can listen for webhooks. These events trigger when there’s a status change in Stripe, such as creating a new subscription or invoice.

In your application, set up an HTTP handler to accept a POST request containing the webhook event, and verify the signature of the event.

server.rb
Ruby
# Set your secret key. Remember to switch to your live secret key in production. # See your keys here: https://dashboard.stripe.com/apikeys Stripe.api_key =
'sk_test_BQokikJOvBiI2HlWgH4olfQ2'
post '/webhook' do # You can use webhooks to receive information about asynchronous payment events. # For more information, see https://stripe.com/docs/webhooks. webhook_secret = ENV['STRIPE_WEBHOOK_SECRET'] payload = request.body.read if !webhook_secret.empty?

During development, use the Stripe CLI to monitor webhooks and forward them to your application. Run the following in a new terminal while your development app is running:

Command Line
stripe listen --forward-to localhost:4242/webhook

For production, set up a webhook endpoint URL in the Dashboard, or use Webhook Endpoints.

Limitations

Consider the following limitations for usage alerts:

  • Alerts are only evaluated on usage data reported after alert creation.
  • You can create a maximum of 25 alerts for each combination of a specific meter and customer. However, you can create an alert for a specific meter for each of your customers.
  • Alerts currently don’t work with test clocks.
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc
Related Guides
Usage-based billing overview
How to record usage
Products Used
Billing