Skip to content

Stripe Partial Refunds: The Discount and Sales Tax Problem

A Stripe partial refund is only an amount. Work out one item's share of the discount and sales tax, reverse the tax correctly, or refund the line item.
Refunds15 min readBy Flint Pay, Product & API Team

A buyer in Seattle orders a pair of trail shoes and two pairs of merino socks, takes $10 off with a spring sale, and pays sales tax. A week later one pair of socks comes back. On Stripe, the call that returns their money takes a payment and a number:

TypeScript
await stripe.refunds.create({
  payment_intent: "pi_...",
  amount: 1865,
});

Getting to 1865 is the hard part, and Stripe leaves it to you. Before the call you work out what that pair of socks actually cost the buyer after the discount and with tax. After it, you reverse the right tax, record which item came back, and make sure nobody refunds the same pair twice.

This post works through all of it on one order: the arithmetic, what each Stripe tax integration does with a partial refund, and what Flint does when a refund names the item instead of the amount.

In short:

  • A Stripe refund carries an amount and no line items, so the item's price, its share of the discount, and its tax are yours to calculate.
  • The right refund for one unit is its price, minus its share of the discount, plus its share of the tax: $18.65 here, not $18.00.
  • How Stripe reverses the tax depends on your integration. A flat amount reversal can record most of a returned item's tax against items the buyer kept.
  • On Flint, a refund names the line item and the quantity. Flint returns the right amount, reverses that line's own tax by jurisdiction, and counts what's left to refund.

A Stripe partial refund is an amount, not an item#

Create a refund takes a charge or a payment_intent, an optional amount, and a few more parameters: reason, metadata, instructions_email, origin, and two Connect flags, refund_application_fee and reverse_transfer. None of them names a line item or a quantity. You can refund a charge in as many parts as you like, as long as the total doesn't exceed what was charged, and Stripe checks nothing else.

Downstream systems feel that first. Stripe's own NetSuite connector, documenting partial refunds:

If the invoice contains multiple items, the connector can't determine which line items to refund. Because Stripe doesn't associate a refund with specific line items, the connector represents the refund with a non-inventory sale item called a Stripe Partial Refund Item.

Stripe, Stripe refunds in NetSuite

Finance sees that $18.65 went back. Nothing on the refund says it was one pair of socks.

How to calculate a partial refund with a discount and tax#

The sticker price is the wrong number. Once a cart discount and sales tax have touched a line, one unit cost the buyer its unit price, minus its share of the discount, plus its share of the tax. That's the amount to refund.

Here is the order. The $10.00 discount is spread across both lines in proportion to their price, and Seattle's tax (Washington's 6.5 percent plus Seattle's 3.85 percent) applies to what's left after the discount:

LineSubtotalDiscountTaxableTaxPaid
Trail Runner 2, 1 × $128.00$128.00−$7.80$120.20$12.44$132.64
Merino socks, 2 × $18.00$36.00−$2.20$33.80$3.50$37.30
Order$164.00−$10.00$154.00$15.94$169.94

If the buyer paid through Stripe Checkout, the per-line amounts are on the session's line items. Your socks line reads something like this:

TypeScript
const { data: lineItems } = await stripe.checkout.sessions.listLineItems(
  sessionId,
  { limit: 100 },
);
// { description: "Merino socks", quantity: 2,
//   amount_subtotal: 3600, amount_discount: 220,
//   amount_tax: 350, amount_total: 3730 }

One pair is half the line: $18.00, less $1.10 of discount, plus $1.75 of tax, for $18.65. The tempting shortcuts are all wrong:

RefundCalculated asResult
$18.00The sticker priceThe buyer is $0.65 short
$16.90Price less discount, no taxThe buyer is $1.75 short
$19.86Price plus tax, ignoring the discountYou refund $1.21 the buyer never paid
$18.65Price, less its discount share, plus its tax shareCorrect

A PaymentIntent you created yourself has no session and no line items. The discount split and the tax per line are wherever your code saved them before the payment, and if it didn't save them, you're recomputing them from today's rules for a sale made under last month's.

When the cents don't divide#

Two pairs split evenly. Three units sharing a $0.20 discount don't: each owes 6.67 cents, which you can't refund. The fix is to price each partial refund against what's still left on the line and give the last unit exactly the remainder, so the units always add up to the line total however many refunds it takes:

TypeScript
type Line = { quantity: number; amount_subtotal: number; amount_discount: number; amount_tax: number };
type Done = { units: number; subtotal: number; discount: number; tax: number };

// `done` is what earlier refunds already took from this line. You store it.
function refundForUnits(line: Line, done: Done, units: number) {
  const left = line.quantity - done.units;
  if (units < 1 || units > left) throw new Error("not enough units left on the line");
  const share = (total: number, taken: number) =>
    units === left ? total - taken : Math.floor(((total - taken) * units) / left);

  const subtotal = share(line.amount_subtotal, done.subtotal);
  const discount = share(line.amount_discount, done.discount);
  const tax = share(line.amount_tax, done.tax);
  return { subtotal, discount, tax, amount: subtotal - discount + tax };
}

The function is the easy part. The done record has to be written after every refund, read before the next one, and locked while a refund is in flight. If an invoice sits behind the payment, Stripe credit notes can name invoice lines instead; how to refund a line item in Stripe covers that path.

What a Stripe partial refund does to sales tax#

Sending $1.75 of tax back to the buyer doesn't take $1.75 off what you owe the state. That's a second record, and how it gets written depends on how you collect tax on Stripe:

How you collect taxWhat a partial refund does to the tax record
Checkout, Payment Links, or Invoicing with Stripe TaxRefunding the charge lowers the tax reported. For invoices, Stripe adjusts tax "in proportion to the refunded amount" across the invoice's lines.
Tax API, basic integration linked to a PaymentIntentStripe records a flat amount reversal: "Refund reversals use flat-amount distribution."
Tax API, custom integrationYou create every reversal yourself, naming the line item, the amount, and the tax.

A flat amount reversal spreads the refund across the whole sale. In Stripe's words, "the amount distributes across each line item and shipping cost proportionally, depending on the remaining amount left to refund on each."

Run the $18.65 sock refund through that rule. The shoes are $132.64 of the $169.94 order, so about $14.56 of the reversal is recorded against the shoes the buyer kept and about $4.09 against the socks. In Seattle every line has the same rate, so the total tax reversed still lands near $1.75; only the per-item rows in your tax export are wrong.

Ship the same order to Brooklyn and the total goes wrong too. New York exempts clothing and footwear sold for less than $110 an item, and New York City provides the exemption locally, so the $18 socks carry no tax while the $120.20 shoes are taxed at the city's 8.875 percent. The buyer gets back $16.90 for the socks, none of it tax. Spread proportionally, roughly $13.43 of that refund lands on the shoes, and about $1.10 of it is recorded as New York tax returned to the buyer. That is $1.10 you didn't refund and will underreport on your return.

For a reversal that names the item, Stripe points you to the custom integration. You record the sale as a tax transaction, store its ID and its line item IDs with your order, and after each refund send the item's numbers:

cURL
curl https://api.stripe.com/v1/tax/transactions/create_reversal \
  -u "sk_test_...:" \
  -d mode=partial \
  -d original_transaction=tax_... \
  -d reference=order_9127-refund_1 \
  -d "line_items[0][original_line_item]=tax_li_..." \
  -d "line_items[0][reference]=socks-1" \
  -d "line_items[0][amount]=-1690" \
  -d "line_items[0][amount_tax]=-175"

The arithmetic is yours again. Stripe's guide: "If you refund parts of line items, you must calculate the amounts refunded." Each reversal needs a unique reference, each sale allows up to 30 partial reversals, and Stripe warns against tax that drifts out of proportion:

If you refund a tax amount such that the total tax is no longer proportional to the subtotal, your tax reporting can be unreliable.

Stripe, Custom Stripe Tax API guide

What you store to refund by item on Stripe#

The refund can't hold the item, so your system does. A Stripe integration that refunds by line usually ends up with:

  • Per-line amounts saved at purchase: subtotal, discount, and tax for every line, frozen when the buyer paid.
  • A refund ledger per line: units and amounts already refunded, so the next refund prices against what's left.
  • A metadata convention on each refund, such as line_item_id and units_refunded, so support and finance can read what it was for.
  • A tax reversal per refund, if you run the custom Tax API, with a reference you generate.
  • A lock around the ledger. Stripe checks a refund against the charge's remaining balance and nothing else, so your ledger is the only thing stopping two support agents from refunding the same pair of socks.

That is returns logic for an order system, written around a payment API that stores amounts.

Refund the item, not the amount, on Flint#

Flint is a payments API built around orders. The order holds the line items, each line's share of every discount, and each line's tax, so a refund can name the item and the quantity and Flint works out the rest.

Create the order#

This is the same cart as a Flint order. The $10.00 discount goes in discounts, which takes promotion codes too. Tax uses external tax: your tax engine supplies each line's rates and Flint applies them, rounds each jurisdiction half up to the cent, and keeps one row per jurisdiction. (Flint's automatic tax doesn't take the clothing category, because clothing is taxed so differently from state to state.)

cURL
curl -X POST https://api.withflintpay.com/v1/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Idempotency-Key: order-cart-9127" \
  -d '{
    "external_reference_id": "cart_9127",
    "line_items": [
      {
        "type": "custom",
        "name": "Trail Runner 2",
        "quantity": 1,
        "unit_price_money": {"amount": 12800, "currency": "USD"},
        "fulfillment": {"requirement": "none"},
        "tax": {
          "taxable": true,
          "line_item_tax_category": "clothing",
          "calculation": {
            "price_mode": "additive",
            "components": [
              {"jurisdiction": {"code": "US-WA", "country": "US", "state": "WA", "level": "state", "name": "Washington"},
               "tax_type": "sales_tax", "calculation_type": "percentage", "percent": 6.5},
              {"jurisdiction": {"code": "US-WA-SEATTLE", "country": "US", "state": "WA", "level": "city", "name": "Seattle"},
               "tax_type": "sales_tax", "calculation_type": "percentage", "percent": 3.85}
            ]
          }
        }
      },
      {
        "type": "custom",
        "name": "Merino socks",
        "quantity": 2,
        "unit_price_money": {"amount": 1800, "currency": "USD"},
        "fulfillment": {"requirement": "none"},
        "tax": {
          "taxable": true,
          "line_item_tax_category": "clothing",
          "calculation": {
            "price_mode": "additive",
            "components": [
              {"jurisdiction": {"code": "US-WA", "country": "US", "state": "WA", "level": "state", "name": "Washington"},
               "tax_type": "sales_tax", "calculation_type": "percentage", "percent": 6.5},
              {"jurisdiction": {"code": "US-WA-SEATTLE", "country": "US", "state": "WA", "level": "city", "name": "Seattle"},
               "tax_type": "sales_tax", "calculation_type": "percentage", "percent": 3.85}
            ]
          }
        }
      }
    ],
    "discounts": [
      {"manual": {"name": "Spring sale", "amount_money": {"amount": 1000, "currency": "USD"}}}
    ],
    "tax": {
      "enabled": true,
      "calculation": {"mode": "external", "price_mode": "additive"}
    }
  }'

The order comes to $169.94, the same figures as the table above. Flint split the discount by price ($7.80 to the shoes, $2.20 to the socks), taxed what was left, and stored the result on each line. Abridged, the socks line and its two tax rows:

Response
{
  "line_items": [
    {
      "order_line_item_id": "li_1kmn0bExample",
      "name": "Merino socks",
      "quantity": 2,
      "subtotal_money": {"amount": 3600, "currency": "USD"},
      "discount_money": {"amount": 220, "currency": "USD"},
      "tax_money": {"amount": 350, "currency": "USD"},
      "total_money": {"amount": 3730, "currency": "USD"}
    }
  ],
  "tax": {
    "tax_breakdowns": [
      {
        "tax_breakdown_id": "txb_1kmn0cExample",
        "order_line_item_id": "li_1kmn0bExample",
        "jurisdiction": {"code": "US-WA", "level": "state", "name": "Washington"},
        "percent": 6.5,
        "taxable_money": {"amount": 3380, "currency": "USD"},
        "tax_money": {"amount": 220, "currency": "USD"}
      },
      {
        "tax_breakdown_id": "txb_1kmn0dExample",
        "order_line_item_id": "li_1kmn0bExample",
        "jurisdiction": {"code": "US-WA-SEATTLE", "level": "city", "name": "Seattle"},
        "percent": 3.85,
        "taxable_money": {"amount": 3380, "currency": "USD"},
        "tax_money": {"amount": 130, "currency": "USD"}
      }
    ]
  }
}

None of these numbers came from your code. It reads them off the order, and so does every refund that follows.

Refund one pair#

The buyer pays, then sends one pair back. The refund sets refund_type to targets, names the line and the quantity, and sends no amount:

cURL
curl -X POST https://api.withflintpay.com/v1/refunds \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Idempotency-Key: refund-cart-9127-socks-1" \
  -d '{
    "refund_type": "targets",
    "order_id": "ord_1kmn0aExample",
    "reason": "customer_changed_mind",
    "line_items": [
      {"order_line_item_id": "li_1kmn0bExample", "quantity": 1}
    ]
  }'

Flint answers 201 with the refund. It priced the pair at $18.65 and shows the working in line_item_allocations, down to the tax each jurisdiction gives back:

Response
{
  "data": {
    "refund_id": "ref_1kmn0aExample",
    "order_id": "ord_1kmn0aExample",
    "status": "succeeded",
    "reason": "customer_changed_mind",
    "amount_money": {"amount": 1865, "currency": "USD"},
    "line_item_allocations": [
      {
        "order_line_item_id": "li_1kmn0bExample",
        "quantity": 1,
        "refunded_money": {"amount": 1865, "currency": "USD"},
        "tax_refund_mode": "automatic",
        "automatic_refund": {
          "subtotal_money": {"amount": 1800, "currency": "USD"},
          "discount_money": {"amount": 110, "currency": "USD"},
          "tax_money": {"amount": 175, "currency": "USD"},
          "total_money": {"amount": 1865, "currency": "USD"}
        },
        "tax_breakdown_refunds": [
          {"tax_breakdown_id": "txb_1kmn0cExample", "tax_money": {"amount": 110, "currency": "USD"}},
          {"tax_breakdown_id": "txb_1kmn0dExample", "tax_money": {"amount": 65, "currency": "USD"}}
        ]
      }
    ]
  }
}

The $1.75 of tax comes back from the socks' own rows, $1.10 from Washington and $0.65 from Seattle, and none of it touches the shoes. In the Brooklyn version of this order, where the socks carried no tax, the same request refunds $16.90 and reverses no tax at all. The tax_summarized_v1 report then lists collected, refunded, and payable tax by jurisdiction without a second API call.

The 201 means Flint recorded the refund. Read status: a refund on an order usually reaches the card network during the request and comes back succeeded, but it can be pending, or failed with a failure_reason. A refund.succeeded or refund.failed webhook reports the outcome, order.partially_refunded follows when the refund changes the order's refund_status, and the Refunds guide covers the lifecycle.

The order keeps count#

After the refund, the socks line records it:

JSON
{
  "order_line_item_id": "li_1kmn0bExample",
  "name": "Merino socks",
  "quantity": 2,
  "refunded_quantity": 1,
  "refunded_money": {"amount": 1865, "currency": "USD"}
}

The order's refund_status becomes partially_refunded and settlement_amounts.refunded_money reads 1865. That count is the guardrail your Stripe ledger had to be:

  • Too many units fail with 409 LIMIT_EXCEEDED before any money moves, and a line with nothing left fails with 409 ACTION_NOT_ALLOWED and reason already_applied.
  • Two people at once: if a support agent refunds in the Dashboard while your code refunds through the API, the second one gets a 409 instead of a duplicate refund.
  • Retries: every refund requires an Idempotency-Key, and Flint keeps it for as long as the refund exists, so a retried request returns the first refund instead of making a second.
  • Odd cents: when a line's discount or tax doesn't divide evenly, Flint rounds each partial refund against what's left and gives the final unit exactly the remainder, so the line always adds up.

Leave out quantity and Flint refunds whatever is left on the line. Send amount_money on the line instead, say $4.00 for a price adjustment, and Flint takes tax back in proportion.

When a jurisdiction refunds less tax#

Some refunds shouldn't return all of a line's tax. Set tax_refund_mode to explicit on the line, send the tax to refund and the rows it comes from, and record why and who approved it with tax_adjustment_reason and tax_adjustment_audit. It needs a separate API key scope, commerce.refunds.tax_overrides.write, so a support tool can refund items without being able to change tax. Sales tax has the request.

If you'd rather Flint calculate the rates, automatic tax works from the buyer's address and reverses tax the same way on a line item refund. Its reversals are listed in the tax_transactions_itemized_v1 report, each linked to the calculation it reverses.

Refund to store credit instead of the card#

Stripe sends a refund back to the original payment method and nowhere else. On Flint, the same line item refund can go onto a new gift card instead. Add destinations:

JSON
{
  "refund_type": "targets",
  "order_id": "ord_1kmn0aExample",
  "line_items": [{"order_line_item_id": "li_1kmn0bExample", "quantity": 1}],
  "destinations": {"payment_intent": "new_gift_card"}
}

The line, the discount share, and the tax reversal are identical: the order still records one pair refunded for $18.65. What changes is the money. Flint makes no processor refund, so the $18.65 stays in your balance as gift card liability, and the buyer can spend it as soon as you send them the code instead of waiting 5 to 10 business days for a card credit. The code comes back in the response's gift_card_codes (a retry with the same key returns it for 24 hours), and the card is attached to the order's customer when the order has one. Store credit works for USD card, Apple Pay, Google Pay, and Link payments on an order with no open chargeback. Refund to store credit lists the rest, and gift cards covers how buyers redeem them.

Restocking fees and returns that come back in a box#

To keep part of the refund, add a restocking_fee adjustment to the line in refund_adjustments, with a reason code. The buyer gets the line's refund less the fee, and the fee can be refunded later if you change your mind.

POST /v1/refunds only moves money. When the socks are physically coming back, create a Return instead. It applies your return window and restocking policy, can hold the refund until the box is received or inspected, puts the stock back where you say it went, and then creates an ordinary refund on the same order, drawn from the same refundable balance.

Stripe and Flint, side by side#

Say what came backStripeAn amount, plus your own metadata conventionFlintline_items with an order_line_item_id and a quantity
Work out the amountStripeYour code, from amounts you saved at purchaseFlintFlint, from the discount and tax it stored on the line
Reverse the taxStripeProportional or flat amount, or a separate reversal call with your numbersFlintSame call, from that line's own jurisdiction rows
Stop a double refundStripeYour ledger and your lockFlintrefunded_quantity on the line and a 409 past it
Refund to store creditStripeOriginal payment method onlyFlintdestinations: {"payment_intent": "new_gift_card"}
Refund invoiced linesStripeA credit note that names the invoice linesFlintA credit note that names the invoice lines, with a refund

Credit notes are where Stripe does name items, and they're a reasonable path when an invoice is behind every payment. For Checkout and PaymentIntent payments, the item, its discount, and its tax live in your code.

FAQ#

Can you do a partial refund in Stripe?#

Yes. Pass an amount in the smallest currency unit when you create the refund, and you can refund the same charge several times until the full amount has gone back. Stripe doesn't record which item each partial refund was for.

How do I refund one line item in Stripe?#

Calculate the item's amount yourself: its price, minus its share of the discount, plus its share of the tax, minus anything already refunded on that line. Then refund that amount and record the line in metadata. For a payment behind an invoice, a credit note can name the invoice line. On Flint, you send the order_line_item_id and a quantity, and Flint calculates the amount.

How do I calculate a partial refund when the order had a discount?#

Split the discount across the lines in proportion to their price, the way most checkouts apply an order discount, then divide each line's discount and tax by its quantity. One unit refunds its price, less its discount share, plus its tax share. Store the split when the buyer pays, so a refund months later uses the discount that actually applied.

Does a Stripe partial refund reverse sales tax?#

Partly, and it depends on the integration. With Stripe Tax on Checkout, Payment Links, or Invoicing, refunding the charge lowers the tax reported, and for invoices Stripe makes that adjustment in proportion to the refunded amount. The basic PaymentIntent integration records a flat amount reversal across every line. Only the custom Tax API reverses tax by line, and you send the amounts.

Do I get the processing fee back on a partial refund?#

Not on Stripe or on Flint. Stripe documents that its processing fees from the original transaction aren't returned. Flint doesn't return the original fee either, and charges nothing to refund. A refund to Flint store credit makes no processor refund at all, so the cash stays in your balance.

Can I refund a customer to store credit instead of their card?#

On Flint, yes: set destinations.payment_intent to new_gift_card and the refund is issued on a new gift card while the order records it like any other refund. Stripe refunds go back to the original payment method only.

Try it on a sandbox order#

Sign up, or run flint signup in your terminal, then create the order above with a test key, pay it with the 4242 4242 4242 4242 card, and refund one pair of socks. Testing walks through paying a sandbox order. If you run on Stripe today, Migrating from Stripe maps each Stripe object to its Flint equivalent so you can move one payment flow at a time, and Flint vs Stripe compares the rest.

Sources#

Everything attributed to Stripe above comes from its documentation, checked on 2026-10-24. Order amounts in the Stripe sections are worked from Stripe's documented rules on the example cart, not from a live Stripe account.

  • Create a refund: the parameters a refund accepts.
  • Refund and cancel payments: multiple partial refunds per charge, refunds only to the original payment method, and original processing fees not returned.
  • Stripe refunds in NetSuite: refunds aren't associated with line items, and the Stripe Partial Refund Item.
  • Retrieve a Checkout Session's line items: amount_subtotal, amount_discount, amount_tax, and amount_total per line.
  • Tax reporting: refunding a charge from an invoice or a Checkout Session lowers the tax reported.
  • Refunds and credit notes: invoice refunds adjust tax in proportion to the refunded amount, and credit notes for line-item refunds.
  • Basic Stripe Tax API: flat amount reversals for refunds on a linked PaymentIntent.
  • Custom Stripe Tax API: line item reversals, flat amount distribution, the 30 partial reversal limit, and the reporting warning.
  • Publication 718-C, New York State Department of Taxation and Finance: the exemption for clothing and footwear under $110 an item, and the localities, including New York City, that provide it.