Stripe Proration Scripts and QuickBooks

Stripe proration scripts round mid-cycle changes to whole days or bill tagged products in full. What each one changes on the invoice and in QuickBooks.

Acodei Content Team · 11/27/2026 · 16 min read

When a customer upgrades halfway through a billing period, Stripe credits the unused time on the old price and charges the remaining time on the new one. By default it measures that time down to the second. An upgrade at 6:00 am produces a different credit from one at 6:00 pm, and the invoice shows amounts like 19.75 USD that nobody quoted and nobody can check in their head.

Stripe's proration scripts change that from inside Stripe Billing. One rounds every proration to whole hours, days, weeks or months. Another bills chosen products at full price, in both directions, whenever a subscription changes. You can also write your own. Each one changes the credit and debit lines on the invoice, and those lines are what your revenue and receivables in QuickBooks are built from.

This guide covers the two scripts Stripe has written, what a custom proration script can and can't change, the limits Stripe puts on all of them, and what each one means for your QuickBooks file. Start a free trial.

What a proration script replaces

A Stripe proration is a pair of invoice items created when a subscription changes mid-period: a credit for the unused time on what the customer had, and a debit for the remaining time on what they have now. Stripe's prorations guide is direct about the default: "By default, Stripe calculates prorations down to the second."

The size of each line comes from a proration factor. Stripe defines it as "a multiplier to the item's full cost," normally the item's service period divided by the billing period. A change exactly halfway through a month gives a factor of 0.5. Debits get a positive factor, credits a negative one.

A proration script runs at the billing.prorations extension point and replaces that calculation. It does not decide whether prorations happen. Stripe says plainly that you "can't control when prorations are created" with a script, because that is still the job of the subscription's proration_behavior setting. Our guide to adding seats and proration_behavior covers that setting. A script only changes the amounts once Stripe has decided to prorate.

Proration scripts are one of four kinds of Stripe billing scripts. You find them in the Dashboard under Settings > Billing > Billing customizations, next to Proration.

Script 1: Prorate by custom interval

This script rounds prorations to a time unit you choose. You set two things.

Granularity: Hour, Day, Week or Month. Stripe's description is that proration "is calculated in whole" units of whatever you pick.

Rounding mode: what happens when a change falls between two boundaries.

Rounding modeWhat Stripe doesEffect on the customer
Round to the nearest intervalRounds to the nearest boundary. Exactly halfway rounds upClosest approximation to actual usage
Always round upRounds up to the next boundaryStays on the old price for the full unit
Always round downRounds down to the previous boundaryMoves to the new price for the full unit

The boundaries are not midnight in your time zone. Stripe says "Day boundaries align to the subscription's billing period start time, not midnight," and that boundaries are "time zone-agnostic." By default they sit at the exact time the subscription was created. They move if you set a start date, add a free trial (boundaries then align to the trial end) or reset the billing cycle.

The worked example, three ways

Stripe's own example: a customer on a 30 USD per month plan, with a billing period from April 1 at 12:00 am to May 1 (30 days), upgrades to a 60 USD per month plan on April 11 at 6:00 am. Granularity is Day.

The default, by the second, leaves 19.75 days remaining. Stripe shows a credit of 19.75 USD and a charge of 39.50 USD.

With Round to the nearest interval, 6:00 am is before the midpoint of April 11, so the change snaps back to April 11 at 12:00 am. That leaves 20 full days: a credit of 20.00 USD and a charge of 40.00 USD.

Applying Stripe's rules for the other two modes to the same change:

Days charged at the new priceCredit (old plan)Charge (new plan)Net on the invoice
Default (by the second)19.75-19.75 USD+39.50 USD19.75 USD
Day, round to nearest20-20.00 USD+40.00 USD20.00 USD
Day, always round up19-19.00 USD+38.00 USD19.00 USD
Day, always round down20-20.00 USD+40.00 USD20.00 USD

The swing on one upgrade is a dollar at most. The point is not the size. It is that the amounts become whole-day multiples of the daily rate, so anyone can recompute them from the price and the date, and the line periods on the invoice read as whole days.

Which granularity fits

  • Day suits most monthly plans. Customers see clean amounts, and support can explain any line from the date of the change.
  • Hour stays close to the default but drops the minutes and seconds from the arithmetic.
  • Week and Month fit contracts that quote in those units. Stripe pitches the script for matching "regional billing conventions" and aligning "with contractual terms." Be careful with Month on a monthly plan. By Stripe's boundary rules, the only month boundaries are the start and the end of the period, so every change rounds to one or the other. Test what that produces in a sandbox before you choose it.

Script 2: Credit and debit full product price

This one doesn't round anything. For products you tag with a metadata key and value, it skips proration entirely and credits or charges the full price. Stripe's suggested uses are "a flat support fee or a platform access charge that's always billed in full regardless of when the subscription changes." Products without the metadata are prorated as usual.

Setup is two parts. In Billing customizations, select Credit and debit full product price under Proration and enter a product metadata key and value. Then, in the Product catalog, add that exact key and value to every product it should cover. The script checks product metadata at the moment of the change, so a product you forget to tag is prorated by the default rule.

Stripe's example: a customer on a 40 USD per month plan upgrades to an 80 USD per month plan halfway through a 30-day period, and both products carry full_swap set to true.

Credit (old plan)Debit (new plan)Net
Default proration-20.00 USD+40.00 USD20.00 USD
Credit and debit full product price-40.00 USD+80.00 USD40.00 USD

Run the same change the other way, a downgrade from 80 USD to 40 USD halfway through, and the full-price version gives a credit of 80.00 USD against a debit of 40.00 USD. The customer is owed 40.00 USD instead of the 20.00 USD a default proration would give. Stripe notes that "Negative prorations aren't automatically refunded," so that credit reduces what the customer pays on a later invoice unless you refund it yourself.

This script makes the most sense when a product really is all-or-nothing within a period, and both sides of the change carry the tag. Tagging only one side gives you a full-price line against a prorated line, which is legal but hard to explain to a customer.

Writing your own proration script

If neither prebuilt script fits, you can write one in TypeScript, package it as a Stripe App and upload it with the Stripe CLI. Stripe's build guide uses a prorations extension as its worked example, so this is the best-documented starting point.

One warning comes first. On the prorations extension page, Stripe says the prorateItems method "is available only in private preview and is planned for deprecation." Build on it only if you can absorb a rewrite.

What the method gets and returns:

  • In: every item from the proration event, each with its type (credit or debit), the servicePeriod, Stripe's currentProrationFactor, the priceIntervalDuration in seconds, the price with its product and metadata, and for credits, the correspondingDebit it credits against.
  • Out: for every item, a prorationFactor and a lineItemPeriod, which is the period printed on the invoice line.

Stripe enforces a set of rules, and the last two matter most for anyone reconciling the result:

  1. Return an entry for every item key in the input.
  2. Debits must have a positive factor and credits a negative one.
  3. The factor can't exceed 1,000.
  4. The end date of the lineItemPeriod must equal the end of the service period.
  5. The factor must equal the line item period divided by priceIntervalDuration for debits, or by the corresponding debit's service period for credits.

Rule 5 ties the amount to the period printed on the line. A script can't bill 20 days while the invoice says 19. That is a useful guarantee for an auditor: the service dates on a proration line explain its amount.

Stripe also lists what a proration script can't touch. It is configured at the account level, so "You can't apply different scripts to individual customers or subscriptions." One-off invoice items without full service periods aren't included. And only items from proration events (upgrade, downgrade and cancel) can be changed.

The limits that apply to every proration script

These come from Stripe's Stripe-authored scripts and author your own scripts pages:

  • Flexible billing mode only. Scripts run for subscriptions in flexible billing mode (API version 2025-06-30.basil and later), plus pricing plan and license fee subscriptions. Classic-mode subscriptions keep prorating by the second.
  • One per behavior, account-wide. "You can only run one script for each billing behavior or extension point at a time." You can't run the custom interval script and the full-price script together.
  • Not standalone invoices. Scripts "don't affect standalone invoices that aren't associated with a subscription."
  • Checkout needs flexible mode set. For Checkout Sessions, these scripts only run if the mode is subscription and billing_mode is flexible.
  • Not for connected accounts or INR e-mandates. Scripts can't be shared to connected accounts through Stripe Connect, and invoices that need e-mandates for India off-session payments aren't supported.
  • Versions apply going forward. A version switch "takes effect immediately on all future billing operations," and invoices already processed "aren't retroactively affected."

When a proration script fails

The two kinds fail differently.

For a script you wrote, a run fails if it returns an invalid result, throws an exception or times out. Then "Stripe defaults to standard functionality for the operation that caused the failure." For proration, that means a by-the-second proration for that change.

For the Stripe-authored scripts, the wording is broader: "Stripe reserves the right to default to standard functionality or pause subscription processing."

You can see every run, with its inputs and outputs, in Workbench. By default Stripe also emails the account when a billing script fails, at most once per extension per UTC calendar day. If one change on a subscription prorated to odd fractions while the rest are whole days, a failed run is the first thing to check.

What proration scripts mean in QuickBooks

A script never writes to your books. It changes the amounts on Stripe's proration lines, and your QuickBooks invoices and revenue follow those lines.

Custom interval: cleaner numbers, slightly different revenue

The custom interval script moves a little revenue between customers and periods. In the example above, round to nearest bills 20.00 USD for a change the default would bill at 19.75 USD. Across thousands of changes, the rounding mostly cancels out under round to nearest. Under always round up or always round down it doesn't: one direction consistently favors you or the customer.

What you gain is reviewability. Proration lines become whole-day multiples of the daily rate, so a bookkeeper can check any line from the price and the date. With the default, the same check needs the exact second of the change.

What to watch: the day boundaries follow the subscription's own start time, not your calendar day. On a subscription created at 3:15 pm, every whole day on a proration line runs from 3:15 pm to 3:15 pm. When you check a line, count days from that time, and let your month-end cutoff in QuickBooks follow the dates Stripe prints on the invoice, not your own recomputation.

Full product price: bigger lines, and revenue that moves

The full-price script changes the size of both lines a lot. On Stripe's 40 USD to 80 USD upgrade, the default leaves 20 USD of revenue on the old plan for the month (40 billed, 20 credited) and 40 USD on the new one. With the script, the old plan nets to zero (40 billed, 40 credited) and the new plan carries the full 80 USD. The month's revenue from that customer rises from 60 USD to 80 USD, and it is all on the new product.

That shift shows up in two places in QuickBooks:

  1. Sales by product. If each Stripe product maps to its own QuickBooks product or service, the old product's sales for the period fall by its full price on every upgrade. A report that compares product lines month to month will show the old plan losing more than it really lost.
  2. Deferred revenue. If you recognize subscription revenue over the service period, a full-price debit is a full period of service starting on the day of the change. The credit reverses a full period of the old plan, including time already delivered. Agree the recognition treatment with your accountant before you turn this on for annual plans, where the amounts are large.

Downgrades produce net credits that are bigger than a default proration would give. Stripe doesn't refund them automatically, so they reduce the customer's next invoice. That is a customer liability until it is used, not lost revenue.

Discounts are applied before the proration, never to it

One rule holds under every script. Stripe "uses the subscription's discounted price, not the original price" when it calculates prorations, but the proration lines themselves are marked discountable=false. So a 20% off coupon lowers both the credit and the debit, and then the coupon is not applied a second time to those lines. If an invoice's discount looks too small on a month with an upgrade, this is usually why: the discount only touches the non-proration lines. Our guide to Stripe coupons and discounts in QuickBooks covers the discount side in full.

How Acodei's Invoice Sync handles proration lines

Invoice Sync works from the invoices Stripe finalizes, so proration lines reach QuickBooks on the invoice they belong to, whichever rule calculated them.

  • One QuickBooks invoice per finalized Stripe invoice. Invoice Sync is one-way. When a Stripe invoice is finalized, Acodei creates a QuickBooks Invoice with its line items, and tax lines, as your mapping settings allow. Rounded or full-price proration lines arrive with the invoice they are on.
  • Each line maps on its own. Each invoice line uses the product returned by Multiple Product Mapping if you have it enabled, or the default product if not. The old plan's credit and the new plan's debit are each mapped by their own product, which is what makes the sales-by-product effect above visible.
  • Payments are applied to the invoice. When a Stripe invoice is paid, Acodei creates the payment and applies it to that invoice. This needs QuickBooks' Automatic Application setting turned on.

A checklist before you activate a proration script

  1. Check billing mode. List which subscriptions are in flexible billing mode. Only those, plus pricing plan and license fee subscriptions, change.
  2. Pick the rounding direction on purpose. Round to nearest is neutral over time. Round up and round down are not. Write down which one you chose and why.
  3. Tag both sides. For the full-price script, add the metadata to every product that should be billed in full, including the plans customers move between. Keys and values must match exactly.
  4. Run real changes in a sandbox. An upgrade, a downgrade and a cancellation, each at an odd time of day. Compare the lines to what you expect before going live.
  5. Agree the revenue treatment. For full-price billing on annual plans, decide with your accountant how the full credit and the full debit are recognized.
  6. Note the date. Put the activation date in your close notes. Months before and after will not compare like for like, and no earlier invoice changes.
  7. Watch the failure email. Make sure someone receives Stripe's billing script failure notice. A failure means one change prorated by the default rule.

Frequently asked questions

Can Stripe prorate by whole days instead of seconds?

Yes. Stripe's Prorate by custom interval script rounds prorations to whole hours, days, weeks or months. You choose the granularity and a rounding mode (nearest, always up or always down) under Settings > Billing > Billing customizations. It only applies to subscriptions in flexible billing mode, and day boundaries follow the subscription's start time, not midnight.

What does "Always round up" mean in Stripe's custom interval script?

The change snaps to the next boundary, so the customer stays on the old price for the full unit. With Day granularity, an upgrade at 6:00 am is treated as happening at the start of the next billing day. Always round down does the opposite: the customer moves to the new price for the full unit.

Can I stop Stripe from prorating one product on a subscription?

Yes, with the Credit and debit full product price script. Tag the product with a metadata key and value, set the same pair in the script, and Stripe credits and charges that product's full price on a mid-period change instead of prorating it. Other products on the subscription are still prorated.

Does a proration script change when prorations happen?

No. Stripe says you can't control when prorations are created with a script. That is still set by the subscription's proration_behavior parameter: create_prorations, always_invoice or none. A script only changes the amounts once Stripe has decided to prorate.

What happens if a Stripe proration script fails?

For a script you wrote, Stripe uses its default by-the-second proration for that operation. For Stripe-authored scripts, Stripe reserves the right to use the default or pause subscription processing. Failures are listed in Workbench, and Stripe emails the account when a billing script fails.

How do custom proration amounts show up in QuickBooks?

As ordinary credit and debit lines on the Stripe invoice. With Acodei's Invoice Sync, the finalized Stripe invoice becomes a QuickBooks Invoice with its lines as your mapping settings allow, each line mapped to a product through Multiple Product Mapping or the default product. The script changes the amounts, not how they are recorded.

The short version

Stripe's proration scripts change how much a mid-period subscription change credits and charges, not whether it prorates. Prorate by custom interval rounds to whole hours, days, weeks or months, with the boundaries set by the subscription's start time. Credit and debit full product price bills tagged products in full in both directions. A custom script can set its own factors, but the method is in private preview and planned for deprecation. All of them need flexible billing mode, run account-wide and only affect future invoices. In QuickBooks, the custom interval script gives you cleaner, checkable lines for almost the same revenue, and the full-price script moves real revenue between products and periods. See also our guides to Stripe item handling scripts, adding seats and proration behavior, and the Stripe preview invoice glossary entry. Start a free trial to see how Acodei brings your Stripe invoices into QuickBooks.

Share

Automate your Stripe to QuickBooks sync

Save hours every month. Acodei automatically syncs your Stripe transactions, invoices, and payouts to QuickBooks Online.

14-day free trial · card required · cancel anytime

How Acodei handles this in your stack

Stripe QuickBooks Integration

See how Acodei syncs Stripe payments, fees, refunds, invoices, and payouts into QuickBooks Online automatically.

Or go straight to a capability

Get more operational finance guides like this one

We will only send high-value product and finance content.