1 minute readNewAgent-ready
A cookbook of small pricing functions you can copy
Seven pricing functions of about ten lines each, from cost plus to a fair price for agent buyers, with a step by step guide to run one on your own endpoint and register it. Every example on the page is checked on each change.
Writing your own pricing function used to start from a blank file. The new Pricing Function Cookbook in the documentation gives you seven to copy.
- Seven recipes: cost plus, competitor match with a floor, time decay, inventory aware, a fair price for agent buyers with no agent surcharge, rounding to a .99 price, and bundles. Each is plain JavaScript you can read at a glance.
- A walkthrough: run a recipe with a tiny server, register it as your own function, activate it and compute a price with it, with every command ready to copy.
- Examples that stay true: each recipe is run on the request shown and must give the answer shown, and the walkthrough goes through the real register, activate and compute steps every time we change the product.
- Fixed examples: the Pricing Functions and Compute Price examples now show the fields the API actually reads, and are checked the same way.
