Skip to content

Promotions

A promotion is a reusable discount rule: 20% off hats, $10 off orders of $50 or more, buy two tees and get one free. Buyers redeem it with a code, or Flint applies it automatically to every order that qualifies. One promotion can have many codes, each with its own usage limit and expiry.

Creating and changing promotions needs the commerce.promotions.write scope. Applying them to orders needs commerce.orders.write. Test keys work the same way with no real money, so you can run every request below against your sandbox.

How promotions apply to an order#

Flint prices discounts on the order. When a promotion applies, it becomes an entry in the order's discounts with status: "pending". Pending discounts are recalculated every time the order changes: a discount that no longer qualifies is removed, and an automatic promotion that now qualifies is added. When the order is paid in full, its discounts are redeemed and no longer change.

Order discount statusStartFinal
  • pending moves to redeemed on order paid
  • pending moves to canceled on order closed
  • pending on removed: leaves discounts

Each promotion combines four decisions:

DecisionFieldExample
What the discount isapplication_methodpercent_off, amount_off, or buy_x_get_y
What it discountsdiscount_classThe whole order, matching line items, or charges such as shipping
When it applieseligibility_rulesSpend at least $50, or a customer in your wholesale segment
What it can combine withcombines_with, exclusivityNever stack with another order discount

redemption_type decides how a buyer gets it: code when the buyer enters a code, automatic when Flint applies it to every qualifying order.

Create a promotion code#

This promotion takes $10 off the order when the buyer enters SPRING10. The code can be redeemed 500 times. Amounts are integers in the currency's minor unit, so 1000 is $10.00.

cURL
curl -X POST https://api.withflintpay.com/v1/promotions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: promotion-spring-sale-001" \
  -d '{
    "name": "Spring sale 2026",
    "display_name": "$10 off your order",
    "redemption_type": "code",
    "discount_class": "order",
    "application_method": {
      "type": "amount_off",
      "amount_off_money": {"amount": 1000, "currency": "USD"}
    },
    "codes": [
      {"code": "SPRING10", "max_uses": 500}
    ]
  }'

The response is 201 with the promotion and the codes it created:

Response
{
  "data": {
    "promotion_id": "promo_1kmn0aExample",
    "name": "Spring sale 2026",
    "display_name": "$10 off your order",
    "status": "active",
    "available": true,
    "redemption_type": "code",
    "application_method": {
      "type": "amount_off",
      "allocation": "across",
      "amount_off_money": {"amount": 1000, "currency": "USD"}
    },
    "discount_class": "order",
    "combines_with": {"order": true, "line_item": true, "service_charge": true},
    "uses_count": 0,
    "codes_summary": {"total_count": 1, "active_count": 1, "newest_active_code": "SPRING10"},
    "codes": [
      {
        "promotion_code_id": "pcode_1kmn0aExample",
        "promotion_id": "promo_1kmn0aExample",
        "code": "SPRING10",
        "status": "active",
        "available": true,
        "max_uses": 500,
        "uses_count": 0,
        "created_at": "2026-10-14T22:13:29Z",
        "updated_at": "2026-10-14T22:13:29Z"
      }
    ],
    "created_at": "2026-10-14T22:13:29Z",
    "updated_at": "2026-10-14T22:13:29Z"
  }
}
  • codes holds the codes this request created, in request order, with the promotion_code_id you use to manage each one. Only the create response includes it. One request creates at most 100 codes; add more with POST /v1/promotion-codes, with promotion_id in the body.
  • name is your internal label. display_name is what buyers see at checkout and on the order, where it appears as customer_facing_name. It defaults to name.
  • Codes are unique within a sandbox or live mode, ignoring case and accents, so a buyer can type spring10 or Spring10. Flint keeps the spelling you created. Leading and trailing spaces are rejected, not trimmed.
  • Fields you leave out take defaults: combines_with allows every class, and there is no exclusivity group. Control how offers stack covers both.

Apply a code to an order#

To try the code, create an order. This one totals $40.00:

cURL
curl -X POST https://api.withflintpay.com/v1/orders \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-promotions-guide-001" \
  -d '{
    "line_items": [
      {
        "type": "custom",
        "name": "Canvas tote",
        "quantity": 1,
        "unit_price_money": {"amount": 3000, "currency": "USD"},
        "fulfillment": {"requirement": "none"}
      },
      {
        "type": "custom",
        "name": "Enamel pin",
        "quantity": 2,
        "unit_price_money": {"amount": 500, "currency": "USD"},
        "fulfillment": {"requirement": "none"}
      }
    ]
  }'

Then apply the code the buyer entered. Send it as typed; Flint matches it without regard to case.

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/discounts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: apply-spring10-001" \
  -d '{
    "promotion": {"promotion_code": "spring10"}
  }'

The response is 200 with the repriced order, abridged here:

Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "open",
    "discounts": [
      {
        "order_discount_id": "ad_1kmn0aExample",
        "customer_facing_name": "$10 off your order",
        "source": "promotion",
        "discount_class": "order",
        "promotion_id": "promo_1kmn0aExample",
        "promotion_code": "SPRING10",
        "amount_money": {"amount": 1000, "currency": "USD"},
        "applied_money": {"amount": 1000, "currency": "USD"},
        "status": "pending"
      }
    ],
    "deferred_promotions": [],
    "pricing_amounts": {
      "subtotal_money": {"amount": 4000, "currency": "USD"},
      "discount_money": {"amount": 1000, "currency": "USD"},
      "total_money": {"amount": 3000, "currency": "USD"}
    }
  }
}

applied_money is what the discount takes off this order. Show customer_facing_name and applied_money in your cart, and keep order_discount_id if the buyer can remove the code.

You can also apply codes when you create the order by sending the same object in its discounts array: "discounts": [{"promotion": {"promotion_code": "spring10"}}]. Manual discounts in discounts apply first, in the order you send them. Flint then ranks the promotion codes together with the order's automatic promotions. A code that loses, including one past max_promotions_per_order, comes back as a promotion_declined warning in meta.warnings on the 201 response instead of failing the request.

Hosted checkout shows a code field and applies codes itself. You only call this endpoint when you collect the code in your own UI.

Apply a promotion when you create a checkout session#

Send discounts when you create a quick_pay or subscription_plan session to apply an offer before the buyer opens checkout:

JSON
{
  "type": "subscription_plan",
  "subscription_plan_id": "plan_1kmn0aExample",
  "customer_id": "cus_1kmn0aExample",
  "discounts": [{"promotion": {"promotion_id": "promo_1kmn0aExample"}}],
  "promotion_config": {"codes_enabled": false}
}

Each of the 1 to 10 entries takes either promotion_id or promotion_code. Use an ID for an offer your server selected. It needs no code and records promotion_code: null; the buyer can't remove it. Use a code when the buyer supplied one; the buyer can remove that discount. Account promotion settings apply to both, so a code-type promotion applied by ID still requires account codes to be enabled.

Set session promotion_config.codes_enabled: false with a pre-applied offer when you don't want buyers adding codes. This controls buyer actions and doesn't block your discounts entries. Automatic promotions still follow account settings and the normal stacking rules.

Flint creates the order with its lines, subscription terms, customer, and tax inputs, then ranks all requested promotions as already on that order. A ranking loss returns 201 with a promotion_declined warning in meta.warnings. An unredeemable promotion returns 409 PROMOTION_DECLINED at discounts[i].promotion, with the usual reason and facts; an unknown ID returns 404 RESOURCE_NOT_FOUND at discounts[i].promotion.promotion_id. A failure creates neither an order nor a session, so you can retry the corrected request with the same idempotency key.

Read the result in order.discounts by expanding order on a session read or calling GET /v1/orders/{order_id}. A trial plan defers an eligible offer to order.deferred_promotions, ready for its first charged cycle. A once offer on a signup without a trial is consumed by the signup order. See Discounts and first-shipment offers.

Buyer changes to subscription terms, address, or entered codes keep a by-ID promotion while it remains eligible. If it becomes unusable before payment, the next reprice removes it. If payment finds the change first, it returns 409 VERSION_CONFLICT without charging, so checkout can show the new total.

discounts isn't accepted with type: "order"; apply it to the existing order through POST /v1/orders/{order_id}/discounts.

Handle a code that doesn't apply#

A code the buyer enters ends in one of three ways. Branch on the outcome and the machine-readable reason, not on the message text.

OutcomeResponseWhere to read the reason
Applied200, and the code is in discounts or deferred_promotionsNone
Valid, but not applied200, the order unchanged, and an entry in meta.warningsmeta.warnings[].reason
Can't be redeemed409 with error.code: "PROMOTION_DECLINED"error.details[0].reason

Every PROMOTION_DECLINED reason returns 409 conflict_error. This includes an unknown code, an ineligible order, an incompatible currency, and no_discountable_balance on both new and existing orders. For expired, not_yet_started, exhausted, and inactive, details[0].current_status gives the stored status of the promotion or code, such as active for a promotion that has ended. A code with invalid characters or length returns 400 INVALID_REQUEST with detail INVALID_VALUE at the code's parameter.

POST /v1/orders/{order_id}/pay returns 409 PROMOTION_DECLINED with details[0].reason exhausted when another payment takes the last use while this one is starting. Retry with a new Idempotency-Key; Flint removes the discount and returns 409 VERSION_CONFLICT.

The order is $40.00 and the code needs $100.00. For minimum_not_met, the error says how far the order is from the minimum, so you can tell the buyer to add $60.00 without parsing the message:

JSON
{
  "error": {
    "type": "validation_error",
    "code": "PROMOTION_DECLINED",
    "message": "Minimum purchase is not met for this promotion",
    "param": "promotion",
    "doc_url": "https://developers.withflintpay.com/docs/errors#promotion_declined",
    "remediation": {
      "retry": "none"
    },
    "details": [
      {
        "code": "PROMOTION_DECLINED",
        "param": "promotion",
        "message": "Minimum purchase is not met for this promotion",
        "reason": "minimum_not_met",
        "required_money": {"amount": 10000, "currency": "USD"},
        "current_money": {"amount": 4000, "currency": "USD"},
        "gap_money": {"amount": 6000, "currency": "USD"}
      }
    ]
  }
}

These are the reasons a buyer-entered code most often returns. The Promotions reference lists every value. Treat a reason you don't recognize like not_eligible.

reasonReturned asTell the buyer
code_invalidErrorThe code isn't recognized. Check for a typo.
expired, inactive, exhaustedErrorThe code is no longer available.
not_yet_startedErrorThe offer hasn't started yet.
minimum_not_metErrorAdd gap_money more to use the code.
not_eligibleErrorThe cart doesn't qualify for the offer.
already_appliedErrorThe code is already on the order.
codes_disabledErrorCodes can't be used on this order.
max_promotions_reachedWarningThe order already has the maximum number of offers.
superseded_by_better_offerWarningAnother offer from the same group is already applied.
superseded_by_higher_priorityWarningAnother offer in the same group takes priority.
not_combinableWarningThe code can't be combined with an offer already applied.
buy_item_missingWarningAdd the items the offer requires.

Applying a code can also change discounts already on the order. Flint ranks every offer again on each apply and keeps the highest-value ones the stacking rules allow, so a new code worth more can replace one the buyer entered earlier. Render the cart from the returned discounts after every apply rather than adding the new code to what you showed before.

Each promotion the apply removed comes back in meta.warnings as a promotion_removed warning. reason says why it lost, promotion_code is set when a code applied it, and would_have_applied_money is the amount it took off:

JSON
{
  "code": "promotion_removed",
  "severity": "warning",
  "reason": "superseded_by_better_offer",
  "message": "A promotion already on the order was removed.",
  "resource_type": "promotion",
  "resource_id": "promo_1kmn0cExample",
  "promotion_code": "WELCOME5",
  "would_have_applied_money": {"amount": 500, "currency": "USD"}
}

Preview a discount#

POST /v1/discount-previews shows what a code would do without changing the order. Use it to explain a code before the buyer commits, or to show how close the cart is to an automatic offer.

cURL
curl -X POST https://api.withflintpay.com/v1/discount-previews \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -d '{
    "order_id": "ord_1kmn0aExample",
    "discount": {
      "promotion": {"promotion_code": "spring10"}
    }
  }'

The response is 200 with three lists, abridged here:

Response
{
  "data": {
    "applied": [
      {
        "promotion_id": "promo_1kmn0aExample",
        "promotion_code": "SPRING10",
        "customer_facing_name": "$10 off your order",
        "discount_class": "order",
        "amount_money": {"amount": 1000, "currency": "USD"},
        "applied_money": {"amount": 1000, "currency": "USD"}
      }
    ],
    "skipped": [],
    "available": [
      {
        "promotion_id": "promo_1kmn0bExample",
        "customer_facing_name": "$5 off orders over $50",
        "discount_class": "order",
        "promotion_decline_reason": "minimum_not_met",
        "threshold_money": {"amount": 5000, "currency": "USD"},
        "current_money": {"amount": 4000, "currency": "USD"},
        "gap_money": {"amount": 1000, "currency": "USD"}
      }
    ]
  }
}
  • applied is every discount the order would have, including ones already on it.
  • skipped is every promotion that was considered and didn't apply, each with a promotion_decline_reason and, when Flint can price it, would_have_applied_money. A previewed code with an unmet minimum appears here with threshold_money, current_money, and gap_money. Promotions already on the order that the previewed code would remove appear here too, with the reason they'd lose.
  • available is automatic promotions the order misses only by an order.subtotal or order.merchandise_subtotal_before_discounts minimum. Use gap_money for a message like "Add $10.00 more to get $5 off."

Leave out discount to preview only the automatic promotions. Unlike the apply endpoint, the body wraps the discount in discount, so sending an apply body here returns 400 INVALID_REQUEST with detail UNKNOWN_FIELD. A preview creates nothing, so it doesn't need an Idempotency-Key. A code that doesn't exist returns the same 400 error as applying it.

Remove a discount#

Send the order_discount_id values from discounts, the deferred_promotion_id values from deferred_promotions (see Signup promotions), or both. Send at least one of order_discount_ids and deferred_promotion_ids; a request with neither returns 400 INVALID_REQUEST. You can remove several in one request:

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/discounts/remove \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: remove-spring10-001" \
  -d '{
    "order_discount_ids": ["ad_1kmn0aExample"]
  }'

The response is 200 with the repriced order. Only pending discounts can be removed; a discount on a paid order is redeemed and stays.

You can remove manual discounts and discounts from code promotions. A discount from an automatic promotion applies while the order qualifies, so removing it returns 409 ACTION_NOT_ALLOWED with reason not_offered, with param naming its position, such as order_discount_ids[0]. When any ID is refused, nothing on the order changes. To stop an automatic promotion, set it to inactive. Sending the same ID twice returns 400 INVALID_REQUEST with INVALID_VALUE on the repeated ID.

To take back a signup promotion, send its ID in deferred_promotion_ids instead. The response is the order without it, and the promotion no longer attaches to the subscription:

Response
{ "deferred_promotion_ids": ["dp_1kmn0bExample"] }

Keep discounts current until payment#

You don't need to recalculate discounts yourself. Adding or removing items, changing quantities, and adding charges all reprice the order's pending discounts with the same rules as an apply.

A promotion or code you turn off, archive, or let expire, or that reaches its max_uses, leaves unpaid orders the next time they're repriced. If a buyer tries to pay before that, POST /v1/orders/{order_id}/pay removes the discount, charges nothing, and returns 409 VERSION_CONFLICT. Read the order again, show the buyer the new total, and ask them to confirm.

To refresh the order before a final review screen, call reprice. It takes no body:

cURL
curl -X POST https://api.withflintpay.com/v1/orders/ord_1kmn0aExample/discounts/reprice \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Idempotency-Key: reprice-order-001"

The response is 200 with the repriced order, abridged here:

Response
{
  "data": {
    "order_id": "ord_1kmn0aExample",
    "status": "open",
    "discounts": [
      {
        "order_discount_id": "ad_1kmn0aExample",
        "customer_facing_name": "$10 off your order",
        "promotion_code": "SPRING10",
        "applied_money": {"amount": 1000, "currency": "USD"},
        "status": "pending"
      }
    ],
    "pricing_amounts": {
      "subtotal_money": {"amount": 4000, "currency": "USD"},
      "discount_money": {"amount": 1000, "currency": "USD"},
      "total_money": {"amount": 3000, "currency": "USD"}
    }
  }
}

Build common offers#

Send any of these bodies to POST /v1/promotions. Each one is automatic, so it applies to qualifying orders as soon as you create it. An open order picks it up the next time it's repriced. To require a code instead, set "redemption_type": "code" and add codes.

Percent off a category#

Take 20% off every item in the hats category:

JSON
{
  "name": "Hat launch",
  "display_name": "20% off hats",
  "redemption_type": "automatic",
  "discount_class": "line_item",
  "application_method": {
    "type": "percent_off",
    "percent_off": 20,
    "discounted_item_rules": {
      "all": [
        {"attribute": "line_item.categories", "operator": "eq", "values": ["hats"]}
      ]
    }
  }
}

discounted_item_rules chooses the line items that get the discount. Category rules take the category's handle, and the category must already exist, or the request returns 404 RESOURCE_NOT_FOUND with param naming the rule value and details[0].resource_type set to category. Catalog setup shows how products get categories. You can also target line_item.product_id, line_item.variant_id, or line_item.bundle_id.

percent_off is a percent from 1 to 100: send 20 for 20%.

Spend threshold#

Take $10 off orders of $50 or more:

JSON
{
  "name": "Spend 50 save 10",
  "display_name": "$10 off orders of $50 or more",
  "redemption_type": "automatic",
  "discount_class": "order",
  "eligibility_rules": {
    "all": [
      {"attribute": "order.subtotal", "operator": "gte", "values": [{"amount": 5000, "currency": "USD"}]}
    ]
  },
  "application_method": {
    "type": "amount_off",
    "amount_off_money": {"amount": 1000, "currency": "USD"}
  }
}

eligibility_rules decides whether the promotion applies at all. A rule group is an object with either all (every entry must match) or any (one match is enough), holding at least one rule or nested group. To mix the two, nest a group inside another, such as {"all": [rule, {"any": [rule, rule]}]}. Omit the field for no conditions. The rule attributes table lists every attribute and operator.

Flint accepts only USD today, so an amount_off discount and a money threshold are always in USD. Leave currency_options out; the currency reference has the details.

Buy X, get Y#

Buy two tees and get a third free:

JSON
{
  "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",
    "max_applications_per_order": 1
  }
}

A unit can't count toward the purchase and be the reward, so when both rules match the same items, the cart needs three tees. With only two, the offer doesn't apply, and a code for it returns the buy_item_missing warning.

  • reward_selection picks which matching units are discounted: cheapest, highest_price, or first_added.
  • get_percent_off is the discount on the reward units. Use 50 for "buy two, get one half off."
  • max_applications_per_order limits how many times one order earns the reward. Leave it out to reward every complete set of three.

Buy-X-get-Y promotions must use discount_class: "line_item".

Free shipping#

Waive every shipping charge on the order:

JSON
{
  "name": "Free shipping weekend",
  "display_name": "Free shipping",
  "redemption_type": "automatic",
  "discount_class": "service_charge",
  "application_method": {
    "type": "percent_off",
    "percent_off": 100,
    "discounted_item_rules": {
      "all": [
        {"attribute": "charge.type", "operator": "eq", "values": ["shipping_fee"]}
      ]
    }
  }
}

A service_charge promotion discounts the order's charges and must say which ones in discounted_item_rules. The order discount lists them in order_charge_ids. The waived amount lowers pricing_amounts.charge_money rather than adding to discount_money. Add an order.subtotal rule to make it "free shipping over $75."

Run for a limited time#

Add a schedule to any promotion. Outside it, the promotion keeps status: active but reads available: false, with unavailable_reason not_yet_started before starts_at and expired after ends_at. In either state it doesn't apply to orders.

JSON
"schedule": {
  "starts_at": "2026-11-27T05:00:00Z",
  "ends_at": "2026-12-01T08:00:00Z"
}

Times are RFC 3339 in UTC.

Manage codes and redemptions#

A code promotion can have as many codes as you need: one shared code for a newsletter, or a unique code for each customer. Add a code to an existing promotion:

cURL
curl -X POST https://api.withflintpay.com/v1/promotion-codes \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: code-spring-vip-001" \
  -d '{
    "promotion_id": "promo_1kmn0aExample",
    "code": "SPRINGVIP",
    "max_uses": 1,
    "expires_at": "2026-12-31T23:59:59Z"
  }'

The response is 201 with the code:

Response
{
  "data": {
    "promotion_code_id": "pcode_1kmn0aExample",
    "promotion_id": "promo_1kmn0aExample",
    "code": "SPRINGVIP",
    "status": "active",
    "available": true,
    "max_uses": 1,
    "uses_count": 0,
    "version": 1,
    "expires_at": "2026-12-31T23:59:59Z",
    "created_at": "2026-10-14T22:19:59Z",
    "updated_at": "2026-10-14T22:19:59Z"
  }
}

A code that already exists in the same sandbox or live mode, in any letter case, returns 409 ALREADY_EXISTS.

  • Limit redemptions. max_uses on a code limits that code, and max_uses on the promotion limits all of its codes together. A use counts toward uses_count and max_uses as soon as the buyer starts paying. A failed or canceled payment releases it, and a refund doesn't give it back. An invoice's order and a partly paid order keep a discount they already carry, so uses_count can exceed max_uses. Subscription renewals keep their discount without counting a use.
  • Read one code. GET /v1/promotion-codes/{promotion_code_id} returns the code with its status, available, and uses_count. An archived code, including every code of an archived promotion, is still returned, with status: "archived", available: false, and unavailable_reason: "archived".
  • Turn a code off. PATCH /v1/promotion-codes/{promotion_code_id} with "status": "inactive" stops new redemptions. Flint removes the code from unpaid orders the next time they're repriced or paid. Set it back to active to reuse it. To create a code that is off, send "status": "inactive" on create; the default is active.
  • Retire a code. DELETE /v1/promotion-codes/{promotion_code_id} archives the code for good and frees its string for reuse. The response returns the code with status: "archived" and available: false, exactly as a following GET does. Repeating the DELETE returns 200 with the same code and changes nothing, so a retry is safe. An archived code stays readable by ID and appears in lists only when you filter for status=archived. It can't be changed: PATCH returns 409 ACTION_NOT_ALLOWED with reason: archived and current_status: archived in details[0]. Creating a code under an archived promotion returns the same error, and details[0] names the promotion. Redemption by code ignores it.
  • Turn a promotion off. PATCH /v1/promotions/{promotion_id} with "status": "inactive" pauses the promotion and all of its codes: each code keeps its own status and reads available: false with unavailable_reason: promotion_unavailable. To create a promotion that is off, send "status": "inactive" on create; the default is active. DELETE archives it, and its codes are archived with it: they read status: "archived" and can't be redeemed. Repeating the DELETE returns 200 with the archived promotion. An archived promotion can't be changed: PATCH returns 409 ACTION_NOT_ALLOWED with reason: archived and current_status: archived in details[0].
  • React to changes. Creating, changing, and archiving promotions and codes send promotion.* and promotion_code.* webhook events. Archiving a promotion sends only promotion.archived, not an event for each of its codes.

To look up a code a buyer gave you, such as in a support conversation, search by code:

cURL
curl "https://api.withflintpay.com/v1/promotion-codes?code=springvip&expand=promotion" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07"

The response is 200 with a list of codes. expand=promotion adds each code's promotion, abridged here:

Response
{
  "data": [
    {
      "promotion_code_id": "pcode_1kmn0aExample",
      "promotion_id": "promo_1kmn0aExample",
      "code": "SPRINGVIP",
      "status": "active",
      "available": true,
      "max_uses": 1,
      "uses_count": 0,
      "expires_at": "2026-12-31T23:59:59Z",
      "promotion": {
        "promotion_id": "promo_1kmn0aExample",
        "name": "Spring sale 2026",
        "display_name": "$10 off your order",
        "status": "active",
        "available": true
      }
    }
  ]
}

The code filter matches exactly, ignoring case and accents. The list includes inactive, expired, and used-up codes, so check each code's available, or pass availability=available to list only codes a buyer can redeem now. Archived codes are left out unless you pass status=archived, which also finds them by code. Use GET /v1/promotion-codes?promotion_id={promotion_id} to list exactly one promotion's codes. A lookup doesn't check whether the code would apply to an order; preview it for that.

Edit a promotion safely#

Promotions and codes each return a version that increases with every change. A promotion's version also moves when a buyer redeems it or one of its codes, and when a code is created, changed, or archived, so a promotion in use can change between your read and your write. Changing eligibility_rules or application_method replaces what decides who gets the discount and how much, so those requests require the version you read as expected_version. On other fields and on codes it's optional; send it whenever someone else might edit the same promotion.

Read the promotion right before you edit it, and keep its version with your draft:

cURL
curl https://api.withflintpay.com/v1/promotions/promo_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07"

The response, abridged, shows the promotion at version 7:

Response
{
  "data": {
    "promotion_id": "promo_1kmn0aExample",
    "name": "Spend 50 save 10",
    "status": "active",
    "uses_count": 41,
    "version": 7
  }
}

Then send your change with that version. This raises the threshold to $60:

cURL
curl -X PATCH https://api.withflintpay.com/v1/promotions/promo_1kmn0aExample \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Flint-Version: 2026-09-07" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: promo-threshold-60-v7" \
  -d '{
    "expected_version": 7,
    "eligibility_rules": {
      "all": [
        {"attribute": "order.subtotal", "operator": "gte", "values": [{"amount": 6000, "currency": "USD"}]}
      ]
    }
  }'

The response is the updated promotion with version 8. If the promotion changed after your read, Flint changes nothing and returns 409 VERSION_CONFLICT with the current version, abridged here:

Response
{
  "error": {
    "type": "conflict_error",
    "code": "VERSION_CONFLICT",
    "param": "expected_version",
    "remediation": { "retry": "after_refresh" },
    "details": [
      {
        "code": "VERSION_CONFLICT",
        "param": "expected_version",
        "resource_type": "promotion",
        "resource_id": "promo_1kmn0aExample",
        "current_version": 9
      }
    ]
  }
}

Don't resend the same body with the new number. Reconcile the draft first:

  1. Keep the change you were making.
  2. Read the promotion again.
  3. Compare the fields you changed with their current values. If a redemption or a code change moved the version, your fields are as you left them, and you can send the same change. If someone edited the same fields, decide which value should win.
  4. Send the reconciled change with the new version as expected_version and a new Idempotency-Key, because the body changed.

Leaving out expected_version while sending eligibility_rules or application_method, including "eligibility_rules": null, returns 400 INVALID_REQUEST with detail code REQUIRED. DELETE takes the fence as a query parameter, such as DELETE /v1/promotions/promo_1kmn0aExample?expected_version=9. A code's version is separate: PATCH and DELETE on a code check expected_version against the code. The promotions reference lists what moves each version.

Control how offers stack#

When several promotions could apply to one order, Flint decides which ones it keeps:

  1. Manual discounts always stay. Promotion rules never remove them.
  2. Flint collects the candidates: the code being applied or the codes sent when creating the order, promotions already on the order, and every automatic promotion the order qualifies for.
  3. Promotions that share an exclusivity.group compete, and only one from each group continues.
  4. The rest are ranked by the discount each would give on its own, largest first, and admitted in that order. A promotion is skipped when the order already has max_promotions_per_order promotions, or when its combines_with rules out a discount already admitted.

Two fields on the promotion shape this:

  • combines_with lists the discount classes the promotion can share an order with. Both promotions must allow each other's class. Leaving it out allows every class, so set it to restrict stacking: {"order": false, "line_item": true, "service_charge": true} means the promotion never shares an order with another order-wide promotion. To keep a promotion from sharing an order with any other promotion discount, set all three classes to false. On create, a class you leave out is true. On PATCH /v1/promotions/{promotion_id}, only the classes you send change, and the others keep their current value. Sending null or {}, or null for a class, returns 400.
  • exclusivity makes a set of promotions compete for one slot. Give them the same group string, 1 to 100 characters, matched exactly and case-sensitively. The promotion with the highest priority wins, and priority defaults to 0. Equal priorities go to the larger discount, then the earlier created_at, then the lower promotion_id.

For example, give a welcome offer this exclusivity, and leave the other promotions in the welcome-offers group at a lower priority. Only one of them applies to an order, and the welcome offer wins whenever it qualifies:

JSON
"exclusivity": {
  "group": "welcome-offers",
  "priority": 10
}

When a promotion loses its group, its decline reason is superseded_by_higher_priority if the winner's priority is higher, and superseded_by_better_offer otherwise.

Turn promotions on or off#

Your account settings decide whether promotions apply at all. Send the promotions object to PATCH /v1/settings, which needs the settings.write scope:

JSON
{
  "promotions": {
    "automatic_enabled": true,
    "codes_enabled": true,
    "max_promotions_per_order": 3
  }
}

Both switches are on until you turn them off. max_promotions_per_order is 2 by default and accepts 1 to 10. Manual discounts don't count toward it. When you lower it, open orders keep their most valuable promotions up to the new limit the next time they change or are repriced.

A checkout session or payment link can turn automatic promotions or codes off for its own buyers with promotion_config. For example, "promotion_config": {"codes_enabled": false} on POST /v1/checkout-sessions hides the code field on that checkout. It can't turn on something your account settings turned off, which returns 409, and it can't change max_promotions_per_order. promotion_config covers changes the buyer makes in that checkout. Changes you make with your API key follow your account settings, and the open checkout session stays open and reprices.

Discount a subscription#

A promotion applied to a subscription's signup checkout can also discount its renewals. application_method.recurrence decides how many charged cycles it covers, from only the signup order to every renewal. Subscription billing covers the options.

Subscribers see the recurring promotions still attached to them in the subscription's promotions array, with remaining_cycles for a repeating promotion. A once promotion covers the first charged cycle. On an ordinary signup that is the signup order; on a free trial it is the first charge after the trial. A once promotion that hasn't been used yet is listed, and it leaves the list once that charge uses it. The next-charge preview shows how much each promotion takes off the next charge.

Signup promotions on a subscription order#

When a buyer accepts a promotion that belongs to the subscription rather than to this order, such as a signup offer whose discount starts on the first charged cycle, the order lists it in deferred_promotions instead of discounts. The array is on every order and every buyer order, and is empty when there are none.

JSON
{
  "deferred_promotions": [
    {
      "deferred_promotion_id": "dp_1kmn0bExample",
      "promotion_id": "promo_1kmn0cExample",
      "promotion_code": "TRIAL20",
      "customer_facing_name": "20% off your first month"
    }
  ]
}
  • promotion_code is the code the buyer entered, or null when the promotion was applied by promotion_id.
  • customer_facing_name is the name as it was when the order accepted the promotion.
  • A deferred promotion doesn't discount this order. It isn't in discounts and doesn't change total_money, discount_money, or any other amount on the order.
  • When Flint creates the subscription, the promotion attaches to it, and its discount first applies to the first charged cycle. Subscription billing covers how a promotion's recurrence continues from there.

Remove one with deferred_promotion_ids on .../discounts/remove. Until the order is paid, a buyer can remove a signup promotion they applied with a code in hosted checkout, and entering the code again accepts it again. If a code is valid but another accepted promotion keeps it from applying, the apply response carries the same promotion_declined warning as for any other skipped code.

Next steps#

Stripe Checkout takes one coupon or promotion code per session. Stripe Checkout multiple coupons compares merging codes into one coupon with stacking rules.

Was this helpful?