Skip to content

How to run a buy one, get one offer on Stripe

Stripe has no buy-one-get-one setting. A Stripe coupon takes a percentage or a fixed amount off the subtotal, or off up to 100 listed products, and a Checkout Session takes one coupon or promotion code. Buy X get Y, category sales, spend tiers, and once-per-customer limits all become code on your server: it counts the cart, picks the free item, and hands Stripe a coupon worth that amount.
Verified against official documentationReviewed Send a correction (opens in a new tab)

The short answer on Flint

On Flint, "buy 2 tees, get 1 free" is one promotion. Its application_method is buy_x_get_y: rules for the items that count, how many to buy, which items can be the reward, and what the reward is worth, from 1% off to free. Flint finds the free unit on every order, recounts when the cart changes, and caps uses per customer at the moment payment starts. Category sales, spend tiers, first-order offers, schedules, and stacking rules are fields on the same promotion, and the discount lands on the line it belongs to, so tax and refunds follow it. Flint runs payments on your own Stripe account, or on one Flint sets up for you. The Flint requests are below.

Each offer on Stripe and on Flint

OfferStripe coupons and promotion codesFlint promotions
Buy one, get one freeYour code counts units and creates a one-off couponbuy_x_get_y with get_percent_off 100
Buy two, get one half offYour code, as abovebuy_x_get_y with get_percent_off 50
Buy a bag of coffee, get a mug freeYour code, as aboveDifferent qualifying and reward rules
20% off a categoryapplies_to with up to 100 product IDsA line_item.categories rule
Spend $50 save $5, spend $100 save $15One code per tier; your code picks the bestAutomatic tiers in one exclusivity group
Once per customerYour own redemption tablemax_uses_per_customer

What a Stripe coupon can express

Stripe discounts come in two layers:

  • A coupon is the discount: a percent_off or an amount_off, optionally limited by applies_to.products to up to 100 product IDs, with a total max_redemptions and a redeem_by date.
  • A promotion code is a customer-facing code for a coupon. It can be bound to one customer, limited to first-time customers, given a minimum order amount, an expiry, and its own max_redemptions.

Together they say "this much off these products", and a Checkout Session accepts up to one of them. Anything that depends on quantities, categories, or how often a customer has used the offer is worked out by your server before the session exists.

Stripe Billing also has custom coupons, which run a TypeScript discount script in place of percent_off or amount_off, and quantity-based discounts are one of Stripe's examples. Stripe documents them for subscriptions, invoices, and quotes. The script's discount is spread evenly across the invoice's items, live mode needs Stripe to approve the script, and a script that fails gives a zero discount.

Buy one, get one on Stripe: price it, then send a coupon

Your server counts the qualifying units, picks the free ones, and creates a one-off coupon worth exactly that, scoped to the products in the offer. Picking the cheapest unit is the usual rule, because it keeps the offer from giving away your most expensive item:

JavaScript
// Buy 2 tees, get the cheapest third free. Your server prices the offer.
const TEE_PRODUCTS = [process.env.FIELD_TEE_PRODUCT, process.env.POCKET_TEE_PRODUCT];

// One entry per unit, cheapest first
const teeUnits = cart.lines
  .filter((line) => TEE_PRODUCTS.includes(line.productId))
  .flatMap((line) => Array(line.quantity).fill(line.unitAmount))
  .sort((a, b) => a - b);

const freeUnits = teeUnits.slice(0, Math.floor(teeUnits.length / 3));
const freeAmount = freeUnits.reduce((sum, amount) => sum + amount, 0);

let discounts;
if (freeAmount > 0) {
  const coupon = await stripe.coupons.create({
    name: "Buy 2 tees, get 1 free",
    amount_off: freeAmount,
    currency: "usd",
    duration: "once",
    max_redemptions: 1,
    applies_to: { products: TEE_PRODUCTS },
    metadata: { cart_id: cart.id, free_units: freeUnits.join(",") },
  });
  discounts = [{ coupon: coupon.id }];
}

const session = await stripe.checkout.sessions.create({
  mode: "payment",
  line_items: cart.lines.map((line) => ({ price: line.priceId, quantity: line.quantity })),
  discounts, // the session's one discount
  success_url: "https://example.com/thanks?session_id={CHECKOUT_SESSION_ID}",
});

Stripe shows buyers the coupon's name for the discount. max_redemptions: 1 stops the coupon from being reused, and the metadata records which units were free, because nothing else will.

Some teams show the free item as its own line instead, on a price with unit_amount 0, which Stripe allows:

cURL
curl https://api.stripe.com/v1/prices \
  -u "sk_test_...:" \
  -d currency=usd \
  -d unit_amount=0 \
  -d product=prod_...

The buyer sees the free tee by name, and the session's one discount stays free for a promotion code. Your server still decides when the free line belongs in the cart, and the paid lines carry their full price.

Tiered discounts on Stripe: one code per tier

A promotion code's minimum_amount holds one threshold. For "spend more, save more", create a coupon per tier and pick the best one for the cart on your server:

JavaScript
// Spend $50 save $5, $100 save $15, $200 save $40.
// One coupon per tier, created once; your server picks the best.
const TIERS = [
  { minimum: 20000, coupon: "SPEND200_SAVE40" },
  { minimum: 10000, coupon: "SPEND100_SAVE15" },
  { minimum: 5000, coupon: "SPEND50_SAVE5" },
];

const subtotal = cartSubtotal(cart); // from your database
const tier = TIERS.find((t) => subtotal >= t.minimum);
const next = [...TIERS].reverse().find((t) => subtotal < t.minimum);

const session = await stripe.checkout.sessions.create({
  mode: "payment",
  line_items: cartLineItems(cart),
  discounts: tier ? [{ coupon: tier.coupon }] : undefined,
  success_url: "https://example.com/thanks?session_id={CHECKOUT_SESSION_ID}",
});

// "Add $X more to save more" is yours to compute and show
const gap = next ? next.minimum - subtotal : 0;

The tier coupon uses the session's one discount, so a buyer's promotion code can't join it. Stripe's tiered prices, where the unit price drops at quantity breaks, are documented as a pricing model for subscriptions.

Once per customer on Stripe: your own redemption table

A promotion code can belong to one customer or be limited to first-time customers. To let every customer use an offer once, count uses yourself and hold one while the buyer pays:

JavaScript
// Once per customer: Stripe doesn't count uses per customer, so you do
const used = await db.offerUses.count({
  customerId,
  offer: "tees-3-for-2",
  status: ["reserved", "redeemed"],
});
if (used > 0) discounts = undefined;

const session = await stripe.checkout.sessions.create({
  /* ...as above */
  expires_at: Math.floor(Date.now() / 1000) + 30 * 60, // the 30 minute minimum
});

// Hold the use until the session is paid or expires
await db.offerUses.insert({
  customerId,
  offer: "tees-3-for-2",
  sessionId: session.id,
  status: "reserved",
});

Mark the use redeemed when the payment succeeds and delete it when the session expires unpaid.

Where hand-built offers go wrong

  1. The BOGO coupon blocks every other code#

    A buyer with three tees in the cart also has a 10% newsletter code, and only one of the two discounts fits on the session.

    A Checkout Session accepts up to one coupon or promotion code. Your BOGO coupon is that one, so a buyer's code can only replace it.

    Confirm it

    Create a session with discounts[0][coupon] set, then try to add a promotion code to the same session.

    Fix

    Merge both offers into one computed coupon on your server, or decide which wins and tell the buyer. The merge has its own traps with redemption counts and refunds.

  2. The coupon doesn't recount the cart#

    The buyer removes a tee after you priced the offer, and the order still takes a whole tee off.

    Your BOGO coupon is a fixed amount_off worked out from the cart when you created it. Stripe applies that amount to the listed products; it doesn't know the offer needed three units.

    Confirm it

    Price a cart of three tees, then change the cart and reuse the coupon or session. The discount stays the same.

    Fix

    Create the coupon and the session together from the cart as it is at checkout, with no quantity editing on the payment page. When the cart changes, expire the old session and create both again.

  3. Refunds don't know which item was free#

    A buyer returns one of the two paid tees and keeps the free one. Stripe shows one payment amount, and support has to work out what to send back.

    A Stripe refund is an amount against a Charge or PaymentIntent, with no line item parameter. Which unit was free, and what the coupon took off each line, exists only in your records.

    Confirm it

    Open the payment in the Dashboard and try to find which unit the coupon covered.

    Fix

    Store the free unit's product and amount in the coupon or PaymentIntent metadata when you create the session, decide your policy for returns that break the offer, and compute each refund amount from your records.

  4. Once-per-customer offers get used twice#

    Your rule says one BOGO per customer, and one customer has two paid orders with it.

    Stripe promotion codes limit total redemptions, one named customer, or first-time customers. Nothing counts uses per customer, so the check is a query in your database before you create the session, and two sessions created close together both pass it.

    Confirm it

    Create two sessions for the same customer before paying either, then pay both.

    Fix

    Reserve the use in your database when you create the session, release it when the session expires unpaid, and set a short expires_at (30 minutes is the minimum) so reservations don't linger.

When a buyer brings a code on top of an automatic offer, see stacking multiple coupons in Stripe Checkout for merging them into one coupon and what that breaks.

On Flint, each offer is a promotion

A Flint promotion holds the whole rule: what counts, what gets discounted, who qualifies, how often, and what it combines with. It applies to orders, so your own cart, hosted checkout, and payment links all price it the same way.

Buy 2, get 1 free

This promotion makes the cheapest of every three tees free, automatically:

cURL
curl -X POST https://api.withflintpay.com/v1/promotions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: promotion-tees-3-for-2" \
  -d '{
    "name": "Tees 3 for 2",
    "display_name": "Buy 2 tees, get 1 free",
    "redemption_type": "automatic",
    "discount_class": "line_item",
    "application_method": {
      "type": "buy_x_get_y",
      "qualifying_item_rules": {
        "all": [{"attribute": "line_item.categories", "operator": "eq", "values": ["tees"]}]
      },
      "buy_min_quantity": 2,
      "discounted_item_rules": {
        "all": [{"attribute": "line_item.categories", "operator": "eq", "values": ["tees"]}]
      },
      "get_quantity": 1,
      "get_percent_off": 100,
      "reward_selection": "cheapest"
    }
  }'

It applies to every order that qualifies, with no code. A cart with two Field tees at $28.00 and one Pocket tee at $22.00:

cURL
curl -X POST https://api.withflintpay.com/v1/orders \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: order-tees-001" \
  -d '{
    "line_items": [
      {"type": "variant", "variant_id": "var_1kmn0aExample", "quantity": 2},
      {"type": "variant", "variant_id": "var_1kmn0bExample", "quantity": 1}
    ]
  }'

The order comes back priced (abridged):

JSON
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "line_items": [
      {
        "order_line_item_id": "li_1kmn0aExample",
        "name": "Field tee",
        "quantity": 2,
        "subtotal_money": {"amount": 5600, "currency": "USD"},
        "discount_money": {"amount": 0, "currency": "USD"},
        "total_money": {"amount": 5600, "currency": "USD"}
      },
      {
        "order_line_item_id": "li_1kmn0bExample",
        "name": "Pocket tee",
        "quantity": 1,
        "subtotal_money": {"amount": 2200, "currency": "USD"},
        "discount_money": {"amount": 2200, "currency": "USD"},
        "total_money": {"amount": 0, "currency": "USD"}
      }
    ],
    "discounts": [
      {
        "order_discount_id": "ad_1kmn0aExample",
        "customer_facing_name": "Buy 2 tees, get 1 free",
        "source": "promotion",
        "discount_class": "line_item",
        "promotion_id": "promo_1kmn0aExample",
        "order_line_item_ids": ["li_1kmn0bExample"],
        "amount_money": {"amount": 2200, "currency": "USD"},
        "applied_money": {"amount": 2200, "currency": "USD"},
        "status": "pending"
      }
    ],
    "pricing_amounts": {
      "subtotal_money": {"amount": 7800, "currency": "USD"},
      "discount_money": {"amount": 2200, "currency": "USD"},
      "tax_money": {"amount": 0, "currency": "USD"},
      "total_money": {"amount": 5600, "currency": "USD"}
    }
  }
}
Two Field tees and a free Pocket tee
  • Subtotalpricing_amounts.subtotal_money
    $78.00
  • Buy 2 tees, get 1 freepricing_amounts.discount_money
    −$22.00
  • Totalpricing_amounts.total_money
    $56.00

How Flint picks the free unit:

  • Units, not lines. Flint counts every unit across the cart, so two tees on one line and one on another make a set of three.
  • reward_selection picks the reward: cheapest (the default), highest_price, or first_added.
  • A unit is bought or free, never both. With two tees in the cart the offer doesn't apply, and a code for it returns the buy_item_missing reason so you can say "add one more."
  • Every complete set counts. Six tees earn two free ones. max_applications_per_order caps it.
  • The cart can change. Adding or removing items reprices the order's discounts, so the offer appears, moves to another unit, or drops off as the cart changes.

On hosted checkout the offer shows as a named row in the totals, and it doesn't take a code slot: the buyer can still enter a promotion code, and your stacking rules decide whether both apply.

Half off, or buy one thing and get another

The qualifying and reward rules are separate, so the free item doesn't have to match what was bought. Buy a bag of coffee, get a mug half off, up to two mugs per order:

JSON
"application_method": {
  "type": "buy_x_get_y",
  "qualifying_item_rules": {
    "all": [{"attribute": "line_item.categories", "operator": "eq", "values": ["coffee"]}]
  },
  "buy_min_quantity": 1,
  "discounted_item_rules": {
    "all": [{"attribute": "line_item.categories", "operator": "eq", "values": ["mugs"]}]
  },
  "get_quantity": 1,
  "get_percent_off": 50,
  "max_applications_per_order": 2
}

Rules can match line_item.categories, line_item.product_id, line_item.variant_id, or line_item.bundle_id. get_percent_off takes 1 to 100.

A category sale with a code, a schedule, and a cap

JSON
{
  "name": "Hat week",
  "display_name": "20% off hats",
  "redemption_type": "code",
  "discount_class": "line_item",
  "application_method": {
    "type": "percent_off",
    "percent_off": 20,
    "discounted_item_rules": {
      "all": [{"attribute": "line_item.categories", "operator": "eq", "values": ["hats"]}]
    }
  },
  "schedule": {"starts_at": "2026-12-05T08:00:00Z", "ends_at": "2026-12-12T08:00:00Z"},
  "max_uses": 1000,
  "codes": [{"code": "HATS20"}]
}

New products added to hats qualify on their own, with no product list to update. The promotion turns itself on at starts_at and off at ends_at, and max_uses counts a use when the buyer starts paying, releasing it if the payment fails.

Tiered discounts: spend more, save more

Create one automatic promotion per tier, each with an order.subtotal threshold, and put them in the same exclusivity group. This is the $100 tier; the $50 and $200 tiers differ only in their amounts:

JSON
{
  "name": "Spend 100 save 15",
  "display_name": "$15 off orders of $100 or more",
  "redemption_type": "automatic",
  "discount_class": "order",
  "eligibility_rules": {
    "all": [
      {"attribute": "order.subtotal", "operator": "gte", "values": [{"amount": 10000, "currency": "USD"}]}
    ]
  },
  "application_method": {
    "type": "amount_off",
    "amount_off_money": {"amount": 1500, "currency": "USD"}
  },
  "exclusivity": {"group": "spend-tiers"}
}

Only one promotion from a group applies, and among equal priorities the larger discount wins, so a $120.00 cart gets $15 off and never also the $5. Ask Flint how far the cart is from the next tier:

cURL
curl -X POST https://api.withflintpay.com/v1/discount-previews \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"order_id": "ord_1kmn0cExample"}'
JSON
{
  "data": {
    "applied": [
      {
        "promotion_id": "promo_1kmn0bExample",
        "customer_facing_name": "$15 off orders of $100 or more",
        "discount_class": "order",
        "applied_money": {"amount": 1500, "currency": "USD"}
      }
    ],
    "available": [
      {
        "promotion_id": "promo_1kmn0cExample",
        "customer_facing_name": "$40 off orders of $200 or more",
        "promotion_decline_reason": "minimum_not_met",
        "threshold_money": {"amount": 20000, "currency": "USD"},
        "current_money": {"amount": 12000, "currency": "USD"},
        "gap_money": {"amount": 8000, "currency": "USD"}
      }
    ]
  }
}

gap_money is your "Add $80.00 more to save $40" message, with no tier math in your code. For prices that drop with quantity rather than spend, variants take quantity_price_breaks: $10.00 each, $8.00 each from 10 units, $7.00 each from 25.

Once per customer, first order only, and one customer's code

max_uses_per_customer counts every use by one customer, across all of a promotion's codes and its automatic applications. Flint reserves the use atomically when payment starts, so two checkouts opened together can't both pay with the offer, and a failed or expired payment gives the use back. Add a rule to make it a first-order offer:

JSON
"eligibility_rules": {
  "all": [{"attribute": "customer.paid_order_count", "operator": "eq", "values": [0]}]
},
"max_uses_per_customer": 1

A code can also be bound to one customer with customer_id, for win-back offers that can't be shared. Both need a known buyer: the order's customer, the customer you name on the checkout session, or a buyer who confirms their email in checkout.

Tax and refunds follow the free item

The discount sits on the line items that hold the reward units, listed in order_line_item_ids and shown in each line's discount_money. Tax is calculated on each line after its discount, so the free Pocket tee carries no tax. Refunds use the same lines: returning one Field tee refunds $28.00 and its tax, with no math on your side:

cURL
curl -X POST https://api.withflintpay.com/v1/refunds \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Idempotency-Key: refund-ord-tees-field-tee" \
  -d '{
    "refund_type": "targets",
    "order_id": "ord_1kmn0aExample",
    "reason": "requested_by_customer",
    "line_items": [{"order_line_item_id": "li_1kmn0aExample", "quantity": 1}]
  }'

When paid and free units share a line, a quantity refund returns each unit's share of what the buyer paid for that line. If your policy takes the free item's value back when a buyer returns a paid one, send a smaller amount_money for the line instead of quantity. See Refunds.

Stripe and Flint promotions, side by side

Stripe coupons and promotion codesFlint promotions
Discount typespercent_off, amount_offpercent_off, amount_off, buy_x_get_y
Buy X get YYour code prices a one-off couponA promotion, repriced on every cart change
Which unit is freeYour codereward_selection
TargetingUp to 100 product IDsCategories, products, variants, bundles, and charges such as shipping
Spend thresholdsOne minimum per promotion codeRules on subtotals, combined with any other rule
TiersOne code per tier, picked by your codeAn exclusivity group, with the gap to the next tier
Automatic offersYour code adds a coupon to the sessionredemption_type: "automatic"
Discounts per checkoutOne coupon or promotion code2 by default, up to 10, by your stacking rules
Uses per customerYour own tablemax_uses_per_customer, reserved when payment starts
First order onlyfirst_time_transactionA customer.paid_order_count rule
Scheduleredeem_by and expires_atschedule.starts_at and ends_at
Refund a discounted itemAn amount you computeName the line; the discount and tax come back with it

Questions, answered

Does Stripe support buy one, get one free?

Not as a coupon setting. A Stripe coupon takes a percentage or a fixed amount off the subtotal, or off up to 100 listed products, with no quantity condition and no free-item rule. Your server counts the qualifying units, works out which one is free, and passes a one-off amount_off coupon to the Checkout Session.

Can a Stripe promotion code give a free item?

Only indirectly. A promotion code points at a coupon, and the coupon is a percentage or an amount. To give a free item for a code, collect the code in your own cart, check the cart on your server, and create a coupon worth the free item, or add the item as a line on a $0 price, before you create the session.

How do I limit a Stripe coupon to one use per customer?

Stripe promotion codes can be bound to one customer, limited to first-time customers, or capped at a total number of redemptions. A per-customer count has to live in your own database, checked and reserved before you create the session. On Flint, max_uses_per_customer does this and reserves the use atomically when payment starts.

Can Stripe Checkout apply a category discount?

Only by product ID. A coupon's applies_to.products takes up to 100 product IDs, so a category sale means keeping that list in sync with your catalog. Flint promotions target items with a line_item.categories rule, so new products in the category qualify on their own.

How do I set up tiered discounts like spend $100, save $15?

On Stripe, create one coupon or promotion code per tier and have your server pick the best one for the cart, since a Checkout Session takes one discount. On Flint, create one automatic promotion per tier with an order.subtotal rule and put them in the same exclusivity group. Flint applies the largest tier the order qualifies for, and the discount preview tells you how far the cart is from the next one.

What are Stripe custom coupons?

A Stripe Billing feature that runs a TypeScript discount script, from Stripe or one you write, in place of percent_off or amount_off. Stripe documents them for subscriptions, invoices, and quotes. The calculated discount is spread evenly across the invoice's items, live mode needs Stripe to approve your script, and a failing script falls back to a zero discount.

Which item does Flint make free in a buy X get Y offer?

The cheapest matching unit by default. Set reward_selection to highest_price or first_added to change it. Flint counts units across lines, never counts one unit as both bought and free, and applies the offer once per complete set unless max_applications_per_order caps it.

How are BOGO discounts taxed and refunded on Flint?

The discount sits on the line items that hold the free units, listed in the discount's order_line_item_ids. Tax is calculated on each line after its discount, so a free unit carries no tax. A refund by quantity returns the unit's share of what the buyer paid for its line, discount and tax included, and a refund can name a smaller amount_money when your policy takes the free item's value back.

Sources

Accessed December 2, 2026.