Glossary
Stripe Custom Coupon
A Stripe custom coupon is a coupon with type set to custom, whose discount is worked out by a discount calculation script instead of a fixed percent_off or amount_off, so it can cap a percentage, give free units, or discount only prices you tag with metadata.
Also called: custom coupon, type=custom coupon, discount calculation script, extension-backed coupon, Stripe discount calculation extension
14-day free trial · card required · cancel anytime
Definition
A standard Stripe coupon takes either a percentage or a fixed amount off. Stripe describes the custom type as “A coupon type that uses an extension to calculate the discount.” The extension is a script at the discount calculation extension point, commerce.discount_calculation. Stripe sends it the invoice’s gross amount, its line items with their prices, products and metadata, the billing reason and the customer, and the script returns one number: the amount to subtract.
You can pick one of four Stripe-authored scripts when you create the coupon, with no code, or write your own in TypeScript and upload it as a Stripe App. Either way, the script is chosen and configured on the coupon itself, not on the Billing customizations page that the other billing scripts use. In the API, that means type=custom, the extension’s ID (it starts with extnpro_) in custom.extension.id, and its settings in custom.configuration.
Unlike the other billing scripts, discount calculation also supports classic billing mode, so a custom coupon isn’t limited to subscriptions in flexible billing mode.
Key points
- +Created in the Dashboard by choosing Custom as the coupon type, or in the API with type=custom and an extension ID in custom.extension.id.
- +Stripe-authored scripts: Percent off up to maximum, BOGO and quantity promos, Price-targeted amount off, and Price-targeted percent off.
- +The script returns one non-negative discount amount, in the same currency as the gross amount and no larger than it.
- +Calculated discounts are spread evenly across the invoice’s items, not attached to the lines that earned them.
- +Only one custom coupon per subscription, and a custom coupon can’t be applied to a customer directly.
- +If a user-authored script fails, Stripe falls back to a zero discount and doesn’t retry.
- +Works in classic and flexible billing mode, unlike the other billing scripts.
The four Stripe-authored discount scripts
Stripe’s discount calculation page lists four scripts you can select when you create a custom coupon, each with Stripe’s own example.
Percent off up to maximum takes a percentage of the invoice total and caps it at an amount. Set to 20% up to 50 USD, a 200 USD invoice gets 40 USD off and a 400 USD invoice gets 50 USD off, not 80 USD. The maximum must be in the invoice currency. If the currencies don’t match, “Stripe applies no discount.”
BOGO and quantity promos gives free units after a purchase quantity, for products tagged with an exact, case-sensitive metadata key and value. Stripe combines quantities of the same product across invoice lines and discounts the cheapest eligible units first. With a buy quantity of 3, a free quantity of 2 and a 20 USD unit price, 3 units get nothing off, 4 units get 20 USD off, and 5 or more get 40 USD off. A purchase quantity of 0 makes it a plain targeted unit discount.
Price-targeted amount off takes a fixed amount off each line whose price carries the metadata. Each line’s discount is capped at its subtotal, and the total at the invoice total. Set to 10 USD, matching lines of 50 USD and 8 USD get 10 USD and 8 USD off, and a nonmatching 30 USD line gets nothing, for 18 USD in all.
Price-targeted percent off takes a percentage off each matching line and adds them up. At 25%, matching lines of 80 USD and 20 USD give 20 USD and 5 USD, for 25 USD, and a nonmatching 40 USD line gets nothing.
Limits Stripe puts on custom coupons
Stripe lists these limits for discount calculation scripts, on top of the general limits for scripts you write yourself. The script can’t change which items are on the invoice or the prices behind them. Multiple custom coupons can’t be applied to the same subscription, and a custom coupon can’t be applied to a customer directly. It can’t give an item-level discount either: “Calculated discounts are distributed evenly across all invoice items on the invoice.” The returned amount must be non-negative and in the same currency as the gross amount.
Custom coupons work on quotes through the quote’s discounts parameter. Stripe runs the script to price the quote, then “recalculates the discount for the resulting invoice or subscription” when the quote is accepted, so a script should return the same amount for the same inputs. They can also be retention offers in the customer portal’s cancellation flow, where the customer sees the coupon’s name and duration but not a predicted price. They can’t be used in portal subscription-update confirmations, or as retention offers on subscriptions with active prebilling.
When the script fails
The fallback for a discount script is different from the other billing scripts. A run fails on an invalid result, an exception or a timeout, and Stripe says it “doesn’t retry failed discount-calculation requests.” Then “If the script fails, Stripe falls back to a zero discount amount.” The invoice is billed at full price.
The Stripe-authored scripts are still in preview, and Stripe’s wording for them is broader: if customization fails or causes harm, Stripe “reserves the right to default to standard functionality and/or pause subscription processing.” Either way, Stripe emails the account when a billing script fails, and every run is listed in Workbench with its inputs and outputs. Stripe’s advice is to apply a new coupon to a subscription in a sandbox and check the resulting invoice before using it in live mode.
What a custom coupon means for QuickBooks
A custom coupon doesn’t add a new kind of entry to your books. It produces a discount on a Stripe invoice like any other coupon, and the invoice still has a gross amount, a discount and a net amount. How that discount lands in QuickBooks depends on whether you record sales at gross with a discount line, usually against a contra-revenue account, or at net.
The even spread is the part to plan for. Because Stripe distributes the calculated discount across all items on the invoice, a BOGO or price-targeted coupon that was earned by one product can show discount amounts on the other lines too. If you report sales by product in QuickBooks at net, the products that didn’t qualify will look discounted. Recording the discount as its own line at the invoice level keeps product revenue clean and puts the promotion’s cost in one place.
Watch the failure case at close. A failed run bills the customer in full, so the invoice in QuickBooks will show full revenue and full receivable. If you honor the promised discount afterwards with a credit note or a refund, that becomes its own transaction, not a correction to the original invoice.
Two older rules still apply. Proration lines are marked discountable=false, so a coupon never discounts a proration directly, though Stripe calculates the proration from the discounted price. And a percent off up to maximum coupon behaves like a percentage on small invoices and a fixed amount on large ones, so the discount rate in QuickBooks will vary from invoice to invoice.
Frequently asked questions
What is a custom coupon in Stripe?
It is a coupon with type set to custom, whose discount is calculated by a script at the discount calculation extension point instead of a fixed percentage or amount. Stripe offers four prebuilt scripts (percent off up to a maximum, BOGO and quantity promos, and price-targeted amount or percent off), and you can write your own.
Can a Stripe coupon take a percentage off with a maximum discount?
Yes, with a custom coupon using the Percent off up to maximum script. Stripe’s example is 20% off up to 50 USD: a 200 USD invoice gets 40 USD off and a 400 USD invoice gets 50 USD off. The maximum has to be in the invoice’s currency, or Stripe applies no discount.
Can I apply a Stripe custom coupon to a customer?
No. Stripe says custom coupons can’t be applied to a customer directly. Apply them to a subscription, where only one custom coupon is allowed, or use them on quotes and as retention offers in the customer portal’s cancellation flow.
What happens if a Stripe custom coupon script fails?
For a script you wrote, Stripe doesn’t retry the calculation and falls back to a zero discount, so the invoice is billed at full price. For the Stripe-authored scripts, which are in preview, Stripe reserves the right to use its standard behavior or pause subscription processing. Failures are emailed to the account and listed in Workbench.
Do custom coupons need flexible billing mode?
No. Discount calculation is the one billing script extension point that also supports classic billing mode. The other billing scripts, such as proration and customer balance scripts, run only on subscriptions in flexible billing mode.
What customers say about running Stripe through Acodei

“If you're testing out all the different Stripe/QuickBooks integration apps right now, let me save you some time. This one is the best one by far.”
“Works well and is really helpful for massive transactions. The support is really fast and helpful. 100% recommended.”
Related reading
- Stripe coupons and discounts in QuickBooks
- Stripe billing scripts
- Stripe proration scripts and QuickBooks
- Stripe metadata
- Stripe billing mode
More glossary terms
- Undeposited Funds
- Stripe Balance Transaction
- Available vs Pending Balance
- Stripe Dispute
- Stripe Dispute Evidence
- Stripe Fee
- Stripe Balance Adjustment
- QuickBooks Credit Memo
- Stripe Tax
- QuickBooks Tax Code
- Stripe Reserve
- Stripe Tax Rate
- Stripe Fee Credit
- Stripe Credit Note
- QuickBooks Product/Service Item
- Stripe Payout
- QuickBooks Sales Receipt
- QuickBooks Bank Deposit
- QuickBooks Transfer
- Stripe Authorization Hold
- QuickBooks Refund Receipt
- QuickBooks Payment
- QuickBooks Expense
- QuickBooks Journal Entry
- Stripe Financial Account
- Holding Account
- Accounts Receivable
- Bank Feed
- Deferred Revenue
- Stripe PaymentIntent
- Stripe Checkout Session
- Stripe SetupIntent
- Stripe PaymentMethod
- Stripe Charge
- Stripe Refund
- QuickBooks Invoice
- QuickBooks Class Tracking
- QuickBooks Location Tracking
- QuickBooks Project
- QuickBooks Closing Date
- Stripe Invoice Line Item
- Stripe Proration
- Stripe Invoice Status
- Stripe Shipping Rate
- Stripe Transfer
- Stripe Mandate
- Stripe on_behalf_of
- Stripe Invoice Item
- QuickBooks Estimate
- Stripe Invoice Payment
- Stripe Invoice Payment Settings
- Stripe Billing Meter
- Stripe Invoice Template
- Stripe Price
- Stripe Subscription Schedule
- Stripe Subscription Item
- QuickBooks Recurring Transaction
- QuickBooks Sub-Customer
- QuickBooks Audit Log
- QuickBooks Bank Rule
- Stripe Subscription Status
- Stripe Mixed Interval Subscription
- Stripe Trial Settings
- QuickBooks Payment Terms
- Stripe Pending Update
- QuickBooks Tags
- QuickBooks Credit Card Credit
- QuickBooks Vendor Credit
- QuickBooks Bill
- QuickBooks Delayed Charge
- Stripe Billing Mode
- QuickBooks Billable Expense
- Stripe Customer Cash Balance
- QuickBooks Purchase Order
- QuickBooks Opening Balance
- QuickBooks Account Type
- QuickBooks Sales Tax Center
- Stripe Webhook
- Stripe Metadata
- Stripe Outbound Payment
- Stripe Received Credit
- Stripe Outbound Transfer
- Stripe Inbound Transfer
- Stripe Received Debit
- Stripe Payout Method
- Stripe Financial Account Transaction
- Stripe Financial Address
- Stripe Application Fee
- Stripe Connected Account
- Stripe Destination Charge
- Stripe Separate Charges and Transfers
- Stripe Direct Charge
- Stripe Payment Method Configuration
- Stripe Dynamic Payment Methods
- Stripe Payment Method Rules
- QuickBooks Bundle
- Stripe Account Capability
- Stripe Merchant of Record
- Stripe Data Pipeline
- Settlement Currency
- Hosted Invoice Page
- Stripe Customer
- Stripe Product
- QuickBooks Home Currency
- QuickBooks Exchange Gain or Loss
- QuickBooks Trial Balance
- QuickBooks General Ledger Report
- QuickBooks Retained Earnings
- QuickBooks Profit and Loss Report
- QuickBooks Balance Sheet Report
- QuickBooks Account Register
- QuickBooks Reclassify Transactions
- QuickBooks A/R Aging Report
- QuickBooks Sales Tax Liability Report
- QuickBooks Sales Tax Payable
- Stripe Tax Transaction
- Stripe Tax Location Report
- Stripe Tax Summarized Export
- Stripe Tax Itemized Export
- Stripe Product Tax Code
- QuickBooks Vendor
- Economic Nexus
- Reverse Charge
- Stripe Statement Descriptor
- Stripe Taxability Reason
- Stripe Tax Filing Currency
- Stripe Tax Cross-Border Goods Option
- Stripe Tax Threshold Monitoring
- QuickBooks Uncategorized Income
- QuickBooks Sales by Product/Service Report
- QuickBooks Sales by Customer Report
- QuickBooks Group Tax Rate
- Form 1099-NEC
- SEPA Direct Debit
- Bacs Direct Debit
- Canadian Pre-Authorized Debit (PAD)
- Australia BECS Direct Debit
- Stripe PayTo
- Stripe Test Clock
- QuickBooks Customer Display Name
- Backup Withholding
- QuickBooks Multicurrency
- Form 1042-S
- Form W-8BEN
- Form W-9
- Form 8233
- Form 1042
- Form 1099-K
- Form W-8BEN-E
- Stripe Tax Behavior
- Stripe Customer Tax ID
- Form 945
- ITIN (Individual Taxpayer Identification Number)
- Form 1099-MISC
- Stripe Customer Tax Exempt Status
- EFTPS (Electronic Federal Tax Payment System)
- Tax Representative (Fiscal Representative)
- Nil Return
- Sales Tax Exemption Certificate
- EU One Stop Shop (OSS)
- Place of Supply
- Simplified Tax Invoice
- Input VAT (Input Tax)
- Streamlined Sales Tax (SST)
- Fixed Establishment (VAT)
- VIES VAT Number Validation
- E-Invoicing Mandate
- Tax Point (Time of Supply)
- Sales Tax Holiday
- Digital Services Tax
- VAT Invoice (Full Tax Invoice)
- Output VAT (Output Tax)
- VAT Bad Debt Relief
- Sales Tax Sourcing
- Gross Receipts Tax
- VAT Cash Accounting Scheme
- Reduced VAT Rate
- VAT Flat Rate Scheme (UK)
- VAT Annual Accounting Scheme (UK)
- EU VAT SME Scheme
- Making Tax Digital for VAT
- VAT Payments on Account (UK)
- Stripe Tax Registration
- Non-Established Taxable Person (NETP)
- VAT Group Registration (UK)
- Zero-Rated vs Exempt Supply
- Electronically Supplied Services (ESS)
- Zero-Decimal Currency
- UK VAT Registration Threshold
- QuickBooks Deposit Detail Report
- Payment Settlement Entity (PSE)
- QuickBooks Reconcile
- QuickBooks Bad Debt Write-Off
- Stripe Radar
- Stripe Smart Retries
- Stripe Decline Code
- QuickBooks Voided Transaction
- Stripe Minimum Charge Amount
- Stripe 3D Secure
- Stripe Preview Invoice
- Stripe Quantity Transformation (transform_quantity)
- Stripe Customer-Chosen Price (custom_unit_amount)
- Stripe Adjustable Quantity (adjustable_quantity)
- Stripe Inline Price (price_data)
- Stripe Default Payment Method
- Stripe Multi-Currency Price
- QuickBooks Automatic Application
- QuickBooks Open Invoices Report
- QuickBooks Customer Balance Detail Report
- Stripe Customer Tax Location Status
- Stripe Customer Credit Balance
- QuickBooks Automatic Invoice Reminders
- QuickBooks Delayed Credit
- Wire Transfer Charge Codes (OUR, SHA, BEN)
- QuickBooks Inactive Customer
- Stripe Funding Instructions
- Stripe Multicapture
- Stripe Incremental Authorization
- Stripe Overcapture
- Stripe Thin Event
- Stripe Payment Attempt Record
- Stripe Balance Settings
- Stripe Billing Scripts
Ready to try Acodei?
Connect Stripe to QuickBooks Online in minutes and let the fees, refunds, and payouts land where your accountant expects them.
14-day free trial · card required · cancel anytime