{"object":"doc","slug":"catalog","title":"Catalog: products, prices, coupons and promotion codes","summary":"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.","tags":["concept","catalog","billing","prices","discounts","stripe"],"body":"# Catalog\n\nThe catalog is what one merchant sells and the discounts it offers. It has four objects, shaped like Stripe's:\n\n| Object | Id | What it is |\n|---|---|---|\n| Product | `prod_...` | A thing the merchant sells, such as \"Pro\". |\n| Price | `price_...` | What a product costs and how often: one time, every month or every year. A product has one or more prices. |\n| Coupon | `coupon_...` | A discount: a percent or an amount off, for one charge, a number of months, or forever. |\n| Promotion code | `promo_...` | The text a shopper types, such as `LAUNCH20`, that applies a coupon. One coupon can have many codes. |\n\nEvery 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.\n\nScopes: `catalog:read` for reads and the discount preview, `catalog:write` for creates and updates.\n\n## Prices are immutable\n\nA 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.\n\nIf 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.\n\n## Amounts\n\nPrices 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`.\n\n## Updates: PATCH or POST\n\nUpdates 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.\n\nEvery 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`.\n\n## Worked example\n\nA 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.\n\n1. Create the products:\n\n```\nPOST /v1/products\n{\"merchant_id\":\"mch_...\",\"name\":\"Pro\"}\n\nPOST /v1/products\n{\"merchant_id\":\"mch_...\",\"name\":\"Premium\"}\n\nPOST /v1/products\n{\"merchant_id\":\"mch_...\",\"name\":\"Pro 7-day pass\",\"metadata\":{\"access_days\":\"7\"}}\n```\n\n2. Create the prices:\n\n| Product | Price | `unit_amount` | `recurring` | `lookup_key` |\n|---|---|---|---|---|\n| Pro | monthly | 2900 | `{\"interval\":\"month\"}` | `pro_monthly` |\n| Pro | annual | 25056 | `{\"interval\":\"year\"}` | `pro_annual` |\n| Premium | monthly | 5200 | `{\"interval\":\"month\"}` | `premium_monthly` |\n| Premium | annual | 44928 | `{\"interval\":\"year\"}` | `premium_annual` |\n| Pro 7-day pass | one time | 1500 | none | `pro_pass_7d` |\n\n```\nPOST /v1/prices\n{\"merchant_id\":\"mch_...\",\"product\":\"prod_...\",\"unit_amount\":2900,\"currency\":\"usd\",\"recurring\":{\"interval\":\"month\"},\"lookup_key\":\"pro_monthly\"}\n\nPOST /v1/prices\n{\"merchant_id\":\"mch_...\",\"product\":\"prod_...\",\"unit_amount\":1500,\"currency\":\"usd\",\"lookup_key\":\"pro_pass_7d\"}\n```\n\nThe 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.\n\n3. Create the coupon and its code:\n\n```\nPOST /v1/coupons\n{\"merchant_id\":\"mch_...\",\"name\":\"Launch 20%\",\"percent_off\":20,\"duration\":\"once\"}\n\nPOST /v1/promotion_codes\n{\"merchant_id\":\"mch_...\",\"coupon\":\"coupon_...\",\"code\":\"LAUNCH20\",\"restrictions\":{\"once_per_customer\":true}}\n```\n\n4. Check what the code takes off a price, without using it:\n\n```\nPOST /v1/prices/{price_id}/discount_preview\n{\"merchant_id\":\"mch_...\",\"promotion_code\":\"launch20\",\"email\":\"pat@example.com\"}\n```\n\nThe 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.\n\n## Discount math\n\nAll 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.\n\n| Price | Coupon | Discount | Total |\n|---|---|---|---|\n| 2900 | 20% | 580 | 2320 |\n| 2900 | 33% | 957 | 1943 |\n| 2900 | 12.5% | 363 | 2537 |\n| 2900 | 33.33% | 967 | 1933 |\n| 1500 | 100% | 1500 | 0 |\n| 1500 | 2000 off | 1500 | 0 |\n| 25056 | 15% | 3758 | 21298 |\n| 1 | 50% | 1 | 0 |\n\nA total of 0 is returned as the number 0; no $0 charge is ever sent.\n\n## When a code applies\n\nA 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:\n\n| Check | `refusal` |\n|---|---|\n| 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` |\n| 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` |\n| The code and its coupon have uses left (`max_redemptions`) | `promotion_code_exhausted` |\n| With `once_per_customer`, this customer has not used it already | `promotion_code_already_redeemed` |\n\nThe message to the shopper is the same for every `promotion_code_invalid` case, so a page never reveals whether a guessed code exists.\n\nA 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.\n\n## Limits of this version\n\n- USD only. Every price, `amount_off` and `minimum_amount` is `usd`.\n- 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.\n- Prices are immutable (above). Prices have no delete; archive them.\n- Recurring prices are `month` or `year` with `interval_count` 1. Quantity is 1. No tiered, metered or pay-what-you-want prices.\n- `once_per_customer` counts one use per email when the email is known, else per `cus_` 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 one `customer`.\n- A void or refund keeps the code's use counted. The use is not given back.\n- Deleting a coupon stops new uses at once; discounts already on a subscription keep applying for their remaining duration.\n- The catalog sends no webhook events.\n\n## Moving from Stripe\n\nEvery 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`.\n\nTo copy a whole Stripe catalog with a Stripe restricted read-only key, use the `import_stripe_catalog` tool; see `migrate-from-stripe-catalog`.\n\n## Routes\n\n| Method and path | Scope | Purpose |\n|---|---|---|\n| `POST /v1/products` | `catalog:write` | Create a product (Idempotency-Key optional) |\n| `GET /v1/products`, `GET /v1/products/{product_id}` | `catalog:read` | List (filters `merchant_id`, `active`, `ids`, `stripe_id`) or read |\n| `PATCH /v1/products/{product_id}`, `POST /v1/products/{product_id}` | `catalog:write` | Change `name`, `description`, `active`, `default_price`, `metadata` |\n| `DELETE /v1/products/{product_id}` | `catalog:write` | Only a product with no prices; else `409 product_has_prices`, archive it instead |\n| `POST /v1/prices` | `catalog:write` | Create a price (Idempotency-Key optional) |\n| `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 |\n| `PATCH /v1/prices/{price_id}`, `POST /v1/prices/{price_id}` | `catalog:write` | Change `active`, `lookup_key`, `nickname`, `metadata` |\n| `POST /v1/prices/{price_id}/discount_preview` | `catalog:read` | What a code takes off a price; writes nothing |\n| `POST /v1/coupons` | `catalog:write` | Create a coupon (Idempotency-Key optional) |\n| `GET /v1/coupons`, `GET /v1/coupons/{coupon_id}` | `catalog:read` | List or read |\n| `PATCH /v1/coupons/{coupon_id}`, `POST /v1/coupons/{coupon_id}` | `catalog:write` | Change `name`, `metadata` |\n| `DELETE /v1/coupons/{coupon_id}` | `catalog:write` | Stop new uses of the coupon and all its codes |\n| `POST /v1/promotion_codes` | `catalog:write` | Create a code for a coupon (Idempotency-Key optional); without `code` one is generated |\n| `GET /v1/promotion_codes`, `GET /v1/promotion_codes/{promotion_code_id}` | `catalog:read` | List (filter `code` matches regardless of case) or read |\n| `PATCH /v1/promotion_codes/{promotion_code_id}`, `POST /v1/promotion_codes/{promotion_code_id}` | `catalog:write` | Change `active`, `metadata`; promotion codes have no delete |\n\nEvery 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](api-conventions.md) 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`.\n\nMCP 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.","updated":1795275945}