2.9 KiB
B2B partner price lists and minimum quantities (Phase 3B)
Staff create organization-scoped price lists for a business account. A draft can be edited; activating it requires a verified account, at least one eligible variant, and no other active list for the same account and currency. Active and archived terms cannot be changed. Archive the current list before activating its replacement.
| Method | Route | Permission | Purpose |
|---|---|---|---|
| GET | /api/v1/b2b/accounts/:accountId/price-lists |
b2b.price.read |
List the account's lists with limit, offset, and optional status |
| POST | /api/v1/b2b/accounts/:accountId/price-lists |
b2b.price.manage |
Create a draft with name and currency |
| GET | /api/v1/b2b/price-lists/:id |
b2b.price.read |
Read the list and its variant terms |
| PUT | /api/v1/b2b/price-lists/:id/items/:variantId |
b2b.price.manage |
Set draft unitPrice and minQuantity |
| DELETE | /api/v1/b2b/price-lists/:id/items/:variantId |
b2b.price.manage |
Remove a draft item |
| POST | /api/v1/b2b/price-lists/:id/activate |
b2b.price.manage |
Freeze and activate the list |
| POST | /api/v1/b2b/price-lists/:id/archive |
b2b.price.manage |
Retire the active list |
| POST | /api/v1/b2b/price-lists/:id/price-check |
b2b.price.read |
Check quantities and preview merchandise total |
Supported currencies are INR, USD, EUR, and GBP. unitPrice is a positive decimal string with exactly two fractional digits; minQuantity is an integer from 1 to 1,000,000. A variant must be active, belong to a published product in the same organization, and use the list currency. A price check takes { "lines": [{ "variantId": "<UUID>", "quantity": 12 }] } with 1–100 distinct variants. It returns each unit price, minimum, line total, currency, and merchandise total. The check revalidates variant eligibility even after activation.
This merchandise preview excludes stock, discounts, tax, shipping, credit, and payment terms. It does not create a quotation or order. Those rules belong to later B2B phases and must snapshot the selected terms before an order can use them. Existing retail checkout prices are unchanged.
Run pnpm db:deploy before starting the updated API. The migration grants b2b.price.read and b2b.price.manage to existing system Owner roles; grant custom roles explicitly.