Concepts
Catalog: products, prices, coupons and promotion codes
How to set up what a merchant sells (products and immutable prices, monthly, yearly or one time) and its discounts (coupons and promotion codes), with a worked example in integer cents, the discount math, and the limits of this version.
The catalog is what one merchant sells and the discounts it offers. It has four objects, shaped like Stripe's:
| Object | Id | What it is |
|---|---|---|
| Product | prod_... | A thing the merchant sells, such as "Pro". |
| Price | price_... | What a product costs and how often: one time, every month or every year. A product has one or more prices. |
| Coupon | coupon_... | A discount: a percent or an amount off, for one charge, a number of months, or forever. |
| Promotion code | promo_... | The text a shopper types, such as LAUNCH20, that applies a coupon. One coupon can have many codes. |
Every object belongs to one merchant, and the mode (test or live) is the merchant's. A create names the merchant with merchant_id in the body, or with the merchant id in a ZeroPoint-Account header (Stripe-Account is accepted too); with neither, a platform that has only one merchant in the key's mode uses that one, and a platform with more answers 400 parameter_invalid (param merchant_id). The same goes for the discount preview. On a list, merchant_id or the header filters to one merchant; with neither, the list covers every merchant of the platform in that mode, except a prices list by lookup_keys whose matches span more than one merchant, which is refused (below). A read, update or delete of one product, price, coupon or promotion code sent with the header answers 404 resource_missing when the object belongs to another merchant, the same answer as an id that does not exist. The merchant is checked the same way however it is named: another platform's merchant, or one in the other mode, answers 404 resource_missing. Catalog objects move no money. They work in live mode with no extra step, so a merchant can build its live catalog before its first live sale. Checkout and subscriptions read the catalog when they charge.
Scopes: catalog:read for reads and the discount preview, catalog:write for creates and updates.
Prices are immutable
A price's unit_amount, currency, recurring interval, type and product never change. An update that sends one answers 400 parameter_immutable. To change what a plan costs, create a new price and archive the old one with PATCH /v1/prices/{price_id} and {"active": false}. Subscribers on the old price keep it; new buyers get the new one.
If you find prices by lookup_key, move the key to the new price in the same call that creates it: send "lookup_key": "pro_monthly", "transfer_lookup_key": true. Without transfer_lookup_key a key another price holds answers 409 lookup_key_in_use. Moving a key does not change open checkout sessions or live subscriptions; they keep the price they started with.
Amounts
Prices use Stripe's field name unit_amount, not amount_cents as payments do. Both are integer cents: 2900 is $29.00. There are no decimals anywhere on the money path. percent_off on a coupon is a number with at most two decimal places, such as 20 or 12.5.
Updates: PATCH or POST
Updates use PATCH on the object's path, as the rest of this API does. Stripe updates with POST to the object path, and that works here too for products, prices, coupons and promotion codes: POST /v1/prices/{price_id} is the same operation as PATCH /v1/prices/{price_id}, with the same fields, checks and scope, and no Idempotency-Key. metadata on an update merges key by key, as on Stripe: the keys you send are set, a key sent as "" is removed, "metadata": "" removes every key, and {} or no metadata changes nothing. The 50-key limit applies to the result.
Every catalog route also takes Stripe's form encoding (application/x-www-form-urlencoded, such as metadata[tier]=pro), checked by the same rules as JSON; see api-conventions.
Worked example
A merchant sells Pro at $29 a month and Premium at $52 a month, each with an annual price, a $15 one-time 7-day pass, and a launch code for 20% off the first charge. An Idempotency-Key header is optional on these creates, since they never reach the processor: send one to make a retry safe (the same key and body replay the first answer); without one each request creates a new object.
- Create the products:
- Create the prices:
| Product | Price | unit_amount | recurring | lookup_key |
|---|---|---|---|---|
| Pro | monthly | 2900 | {"interval":"month"} | pro_monthly |
| Pro | annual | 25056 | {"interval":"year"} | pro_annual |
| Premium | monthly | 5200 | {"interval":"month"} | premium_monthly |
| Premium | annual | 44928 | {"interval":"year"} | premium_annual |
| Pro 7-day pass | one time | 1500 | none | pro_pass_7d |
The annual amounts are 12 months less 28%. An annual discount is a second price, not a coupon: the merchant sets the number, and the pricing page works out the "save 28%" label from the two prices. A price with no recurring is one time. The 7 days of the pass are the merchant's rule: the service grants no access. Keep the length in product metadata, as above, and read it when the purchase completes.
- Create the coupon and its code:
- Check what the code takes off a price, without using it:
The answer for Pro monthly is subtotal 2900, discount_amount 580, total 2320. On Pro annual it is 25056, 5011, 20045; on the pass 1500, 300, 1200. Codes match regardless of case. The preview writes nothing and holds no use of the code.
Discount math
All amounts are integer cents. A percent discount is rounded half up to the cent; an amount discount is at most the subtotal; the total is never below 0.
| Price | Coupon | Discount | Total |
|---|---|---|---|
| 2900 | 20% | 580 | 2320 |
| 2900 | 33% | 957 | 1943 |
| 2900 | 12.5% | 363 | 2537 |
| 2900 | 33.33% | 967 | 1933 |
| 1500 | 100% | 1500 | 0 |
| 1500 | 2000 off | 1500 | 0 |
| 25056 | 15% | 3758 | 21298 |
| 1 | 50% | 1 | 0 |
A total of 0 is returned as the number 0; no $0 charge is ever sent.
When a code applies
A code applies when all of these hold, checked in this order. The preview answers the first that fails in refusal, inside a 200, with refusal_message to show the shopper:
| Check | refusal |
|---|---|
The code is active and exists on this merchant, it has not expired, and its coupon is not deleted or past redeem_by | promotion_code_invalid |
A code limited to one customer is used by that customer; the price's product is in the coupon's applies_to.products; the subtotal meets restrictions.minimum_amount | promotion_code_not_applicable |
The code and its coupon have uses left (max_redemptions) | promotion_code_exhausted |
With once_per_customer, this customer has not used it already | promotion_code_already_redeemed |
The message to the shopper is the same for every promotion_code_invalid case, so a page never reveals whether a guessed code exists.
A use is held when checkout or a subscription starts a payment with the code, and kept once the payment succeeds. When two shoppers race for the last use, one gets the discount and the other gets promotion_code_exhausted before any charge, with the checkout still open.
Limits of this version
- USD only. Every price,
amount_offandminimum_amountisusd. - There is no tax: no tax fields on prices and no tax math. A checkout that needs a tax line cannot also take a promotion code in this version.
- Prices are immutable (above). Prices have no delete; archive them.
- Recurring prices are
monthoryearwithinterval_count1. Quantity is 1. No tiered, metered or pay-what-you-want prices. once_per_customercounts one use per email when the email is known, else percus_id. The email is what the buyer typed and is not verified, so on a guest checkout it is a courtesy limit, not a guarantee: a shopper with a second address gets a second use. A guest who later becomes a customer with a different email can use the code once more. For a hard limit, restrict the code to onecustomer.- A void or refund keeps the code's use counted. The use is not given back.
- Deleting a coupon stops new uses at once; discounts already on a subscription keep applying for their remaining duration.
- The catalog sends no webhook events.
Moving from Stripe
Every object takes stripe_id, the Stripe id it came from: set it on create, or later by PATCH while it is null. It is unique per merchant, so a create or PATCH that repeats one answers 409 stripe_id_in_use naming the object that holds it, and says so when that object was deleted. A migration that is run again therefore does not make duplicates. Lists filter by stripe_id. A different stripe_id on an object that has one answers parameter_immutable.
To copy a whole Stripe catalog with a Stripe restricted read-only key, use the import_stripe_catalog tool; see migrate-from-stripe-catalog.
Routes
| Method and path | Scope | Purpose |
|---|---|---|
POST /v1/products | catalog:write | Create a product (Idempotency-Key optional) |
GET /v1/products, GET /v1/products/{product_id} | catalog:read | List (filters merchant_id, active, ids, stripe_id) or read |
PATCH /v1/products/{product_id}, POST /v1/products/{product_id} | catalog:write | Change name, description, active, default_price, metadata |
DELETE /v1/products/{product_id} | catalog:write | Only a product with no prices; else 409 product_has_prices, archive it instead |
POST /v1/prices | catalog:write | Create a price (Idempotency-Key optional) |
GET /v1/prices, GET /v1/prices/{price_id} | catalog:read | List (filters merchant_id, product, active, type, recurring.interval, currency, lookup_keys, stripe_id) or read |
PATCH /v1/prices/{price_id}, POST /v1/prices/{price_id} | catalog:write | Change active, lookup_key, nickname, metadata |
POST /v1/prices/{price_id}/discount_preview | catalog:read | What a code takes off a price; writes nothing |
POST /v1/coupons | catalog:write | Create a coupon (Idempotency-Key optional) |
GET /v1/coupons, GET /v1/coupons/{coupon_id} | catalog:read | List or read |
PATCH /v1/coupons/{coupon_id}, POST /v1/coupons/{coupon_id} | catalog:write | Change name, metadata |
DELETE /v1/coupons/{coupon_id} | catalog:write | Stop new uses of the coupon and all its codes |
POST /v1/promotion_codes | catalog:write | Create a code for a coupon (Idempotency-Key optional); without code one is generated |
GET /v1/promotion_codes, GET /v1/promotion_codes/{promotion_code_id} | catalog:read | List (filter code matches regardless of case) or read |
PATCH /v1/promotion_codes/{promotion_code_id}, POST /v1/promotion_codes/{promotion_code_id} | catalog:write | Change active, metadata; promotion codes have no delete |
Every list refuses a query parameter it does not take with 400 parameter_unknown, naming it in param, rather than ignoring it: an ignored filter would list objects you did not ask for, and code that takes data[0] would charge the wrong price. Stripe's array forms are read (lookup_keys[]=pro_monthly, lookup_keys[0]=pro_monthly and repeated lookup_keys=pro_monthly are the same filter), and so is recurring[interval]. lookup_keys matches exactly, any of up to 10. A lookup_keys list that names no merchant (no merchant_id, no header) and whose matching prices belong to more than one of your merchants is refused with 400 parameter_invalid (param merchant_id), because data[0] could be another merchant's price; when they all belong to one merchant it lists as usual. currency lists usd prices; another currency lists nothing. The price list and retrieve take expand for product only (expand[]=data.product on the list, expand[]=product on a retrieve), as API conventions lists. Not supported, so refused: created, recurring[usage_type], recurring[meter] (prices); shippable, url (products); created (coupons, promotion codes, customers); customer_account (promotion codes); test_clock (customers). The MCP list tools take the same filters and refuse an argument they do not take the same way. A retrieve of a product, coupon, promotion code or customer takes no query parameters: expand or any other name answers 400 parameter_unknown naming it. A price retrieve takes only expand[]=product; another expand path answers 400 parameter_unavailable. Read any other referenced object with its own GET.
MCP tools: create_product, update_product, list_products, get_product, create_price, update_price, list_prices, get_price, create_coupon, list_coupons, get_coupon, create_promotion_code, update_promotion_code, list_promotion_codes, preview_discount, and import_stripe_catalog (see migrate-from-stripe-catalog). Each calls the same service as its route. On the create tools, preview_discount and import_stripe_catalog, merchant_id is optional when the platform has only one merchant in the key's mode. The creates derive their own key, so the same call within 24 hours returns the first object. There is no delete tool. The set_up_pricing prompt walks this example with the tools.