# Stripe-authored scripts

Configure prebuilt scripts to customize billing behavior from the Dashboard.

Users should start with a Stripe-authored script before trying to  [author their own script](https://docs.stripe.com/billing/scripts/author-your-own.md).

This feature is in public preview.

Stripe provides prebuilt scripts for commonly requested billing customizations. You select a script, adjust its parameters, and activate it from the Dashboard. You don’t have to write any code.

Scripts apply at the account level and take effect for all recurring billing logic on the account. Changes take effect on the next billing operation that runs through the configured behavior.

To configure and activate any script, see [Configure a script in the Dashboard](https://docs.stripe.com/billing/scripts/configure.md).

> You’re responsible for making sure your configuration is correct. Stripe doesn’t take responsibility for any issues that arise as a result of your configuration.
> 
> In preview, if customization fails for any reason or causes harm, Stripe reserves the right to default to standard functionality and/or pause subscription processing. To understand the default behavior, see the descriptions of each [available script](https://docs.stripe.com/billing/scripts/stripe-authored.md#use-cases) (for example, [prorate by custom interval](https://docs.stripe.com/billing/scripts/stripe-authored/proration.md#prorate-by-custom-interval) or [maximum credit per invoice](https://docs.stripe.com/billing/scripts/stripe-authored/customer-balance.md#maximum-credit-per-invoice)).

## Use cases 

| Use case | Billing behavior | Script | Description |
| --- | --- | --- | --- |
| Set a minimum charge threshold. | Customer balance | [Minimum amount before collection](https://docs.stripe.com/billing/scripts/stripe-authored/customer-balance.md#minimum-amount-before-collection) | Use this script to avoid collecting on small invoices by deferring them to the customer balance until the total owed reaches a threshold you define. Use it when you want to accumulate charges across billing cycles before collecting, or avoid charging customers for small amounts. |
| Set a maximum of credit to apply to a single invoice. | Customer balance | [Maximum credit per invoice](https://docs.stripe.com/billing/scripts/stripe-authored/customer-balance.md#maximum-credit-per-invoice) | Use this script when you want to spread credits across multiple billing cycles instead of applying them all at once, or when business rules require limiting credit usage per invoice. |
| Put metered usage items and licensed items on separate invoices. | Invoice item creation and routing | [Separate invoice for metered items](https://docs.stripe.com/billing/scripts/stripe-authored/invoice-item-creation-and-routing.md#separate-invoice-for-metered-items) | Use this script when your finance team needs to reconcile usage charges separately from recurring seat or license fees, or when your customers expect different invoices for them. |
| Calculate prorations by hours, days, weeks, or months. | Proration | [Prorate by custom interval](https://docs.stripe.com/billing/scripts/stripe-authored/proration.md#prorate-by-custom-interval) | Use this script whenever your business needs proration calculated in units larger than a second, whether to match regional billing conventions, align with contractual terms, or reduce customer confusion caused by fractional amounts. |
| Refund or charge the full amount for some items in a subscription. | Proration | [Credit and debit full product price](https://docs.stripe.com/billing/scripts/stripe-authored/proration.md#credit-and-debit-full-product-price) | Use this script when certain products on a subscription aren’t prorated. For example, a flat support fee or a platform access charge that’s always billed in full regardless of when the subscription changes. |
| Apply a percentage discount with a maximum amount. | Discount calculation | [Percent off up to maximum](https://docs.stripe.com/billing/scripts/stripe-authored/discount-calculation.md#percent-off-up-to-maximum) | Use this script to offer a percentage discount while limiting the maximum discount exposure on an invoice. |
| Give additional units of selected products for free. | Discount calculation | [BOGO and quantity promos](https://docs.stripe.com/billing/scripts/stripe-authored/discount-calculation.md#bogo-and-quantity-promos) | Use this script for quantity-based promotions on products selected by metadata. |
| Apply a fixed discount to selected prices. | Discount calculation | [Price-targeted amount off](https://docs.stripe.com/billing/scripts/stripe-authored/discount-calculation.md#price-targeted-amount-off) | Use this script to take a fixed amount off prices selected by metadata without discounting unrelated invoice items. |
| Apply a percentage discount to selected prices. | Discount calculation | [Price-targeted percent off](https://docs.stripe.com/billing/scripts/stripe-authored/discount-calculation.md#price-targeted-percent-off) | Use this script to apply a percentage promotion to prices selected by metadata without discounting unrelated invoice items. |

To see the source code for these scripts, browse the [Billing Extensions](https://github.com/stripe/billing-extensions) or [Coupon Extensions](https://github.com/stripe/coupon-extensions) repositories.

To write your own script, see [Author your own scripts](https://docs.stripe.com/billing/scripts/author-your-own.md).

## Before you begin

Before you start working with scripts, be aware of their current limitations and their behavior.

### Limitations

Scripts currently have the following limitations:

- You can only run one script for each billing behavior or extension point at a time.
- Scripts only run for subscriptions with [flexible billing mode enabled](https://docs.stripe.com/billing/subscriptions/billing-mode.md) (available for API versions [2025-06-30.basil](https://docs.stripe.com/changelog/basil/2025-06-30/billing-mode.md) and later) and pricing plan and license fee subscriptions.
- Scripts don’t currently support invoices that require e-mandates for India recurring payments (invoices with INR for their currency).
- Scripts don’t affect standalone invoices that aren’t associated with a subscription.
- For Checkout Sessions, the logic only runs if [mode](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-mode) is set to `subscription` and [billing_mode](https://docs.stripe.com/api/checkout/sessions/create.md#create_checkout_session-subscription_data-billing_mode) is set to `flexible`.
- Scripts can’t be shared to [connected accounts](https://docs.stripe.com/connect/saas/tasks/create.md) through [Stripe Connect](https://docs.stripe.com/connect.md).

### Fallback behavior

If Stripe-authored scripts fail to run for any reason, Stripe reserves the right to default to standard functionality or pause subscription processing.

### Versioning

When you first activate a Stripe-authored script on an extension point, you’re automatically placed on the latest available version. As Stripe releases new versions, you can upgrade at your own pace. You can also revert to a previous version if needed.

Switching between script versions takes effect immediately on all future billing operations for that extension point. Invoices and billing events that were already processed under a previous version aren’t retroactively affected. Frequently switching back and forth between versions can introduce inconsistencies in billing behavior across cycles, so we recommend testing new versions thoroughly in a sandbox before going live and minimizing version changes mid-cycle.

## See also

- [Customize billing with scripts](https://docs.stripe.com/billing/scripts.md)
- [Author your own scripts](https://docs.stripe.com/billing/scripts/author-your-own.md)
- [Configure a script in the Dashboard](https://docs.stripe.com/billing/scripts/configure.md)
