Dynamic Pricing (AI-Driven Pricing)
Description / Background
AI-Driven Pricing adds a target-sales input to the pricing-rule flow. The pricing engine compares the restaurant’s target sale with its Organic Projection and recommends a price decrease or increase to support sales or profit maximization.
Objectives
- Let a restaurant owner set a revenue target for the pricing-rule period.
- Use the relationship between Target Sale and Organic Projection to select an AI pricing strategy.
- Present the initial recommendation and pending AI-generated price modifiers for review.
- Support approval or rejection of pending price modifiers.
- For a new restaurant with missing Organic Projection data, the UI should show
Calculating...orN/A. - An empty Target Sale blocks saving and shows required-field validation:
Please enter a target amount. - Organic Projection is recalculated daily, so a restaurant can pivot from discount to surge during the month.
- The critical validation rule is that Target Sale must be accepted when lower than, equal to, or higher than Organic Projection.
- Pricing strategies:
Scenario Condition Strategy Revenue Gap (Demand Generation) Target Sale > Organic Projection Decrease price to stimulate demand and close the revenue gap. Target Met (Profit Optimization) Target Sale = Organic Projection Increase price for profit optimization. High Demand (Surge Pricing) Target Sale < Organic Projection Increase price aggressively to capitalize on high organic demand and scarcity.
Scope
- adds AI-driven behavior to the Partner Portal pricing-rule flow:
- includes create/edit form handling
- initial recommendation retrieval
- pending price-modifier retrieval
- approval and rejection actions
- and localized interface strings
Location
Partner Portal → Pricing Rules → create or edit a pricing rule. The rule type is ai_driven in the shipped payload.
How to find AI Driven Pricing Rule
- Open the Partner Portal Pricing Rules
- Choose the AI-Driven Pricing rule type when it is available. Current production note: the option is hidden in the UI as of 2026-07-16, so it is not reachable there today.
How to set AI Driven Pricing Rule
- Open Partner Portal -> Pricing Rules
- Create Pricing Rules -> Select the AI-Driven Pricing rule typ on Rules & Restrictions section
- Enter the Target Sale amount.
- Submit the pricing rule. The shipped frontend sends the target sale and target-sale period in the pricing-rule payload, with the AI rule using a range period and all-day application.
- Review pending AI-generated price modifiers and approve or reject them when presented.
Sequence Diagram / Flow
flowchart LR
form["AI-driven pricing form"] --> recommendation["Initial recommendation API"]
recommendation --> state["Pricing state"]
state --> preview["Recommendation preview"]
modifiers["Pending price modifiers API"] --> cards["Pending approval cards"]
cards --> approve["Approve modifier"]
cards --> reject["Reject modifier"]
ERD
erDiagram
Restaurant ||--o{ PricingRule : "owns"
Restaurant ||--o{ OrganicProjection : "has daily"
Restaurant ||--o{ PricingRecommendation : "receives"
PricingRule ||--o| PricingRecommendation : "produces"
PricingRecommendation ||--o{ PriceModifier : "generates"
PricingRecommendation }o--|| PricingStrategy : "selects"
Restaurant {
string id PK
}
PricingRule {
string id PK
string restaurant_id FK
string rule_type "ai_driven"
decimal target_sale
string target_sale_period "monthly range"
date start_date
date end_date
string mode "range"
string application "all_day"
}
OrganicProjection {
string id PK
string restaurant_id FK
decimal value
date as_of_date
datetime calculated_at
}
PricingRecommendation {
string id PK
string restaurant_id FK
string rule_id FK
decimal organic_projection
decimal last_month_revenue
decimal mtd_revenue
decimal gap_to_close
decimal confidence
string strategy_code FK
datetime created_at
}
PriceModifier {
string id PK
string restaurant_id FK
string recommendation_id FK
string menu_item_id
decimal suggested_price
string status "pending|approved|rejected"
datetime created_at
}
PricingStrategy {
string code PK
string condition "gap|met|surge"
string action "decrease|increase|surge_increase"
string display_name
}
Derived from flow + payload — no schema in PRD/PR. PricingStrategy seeded: gap (target>organic → decrease), met (= → increase), surge (< → aggressive). PriceModifier.status defaults pending; flips via /approve, /reject. OrganicProjection daily recalc.
Backend Implementation
no backend update.
Hybrid Implementation
No hybrid implementation is specified in the PRD, task, or feature PR.
Frontend Implementation
-
A new “AI-Driven” rule type is added to the pricing-rule dropdown, so the owner can pick it alongside the existing rule types. A
showflag on each rule type lets product hide or show it without touching code (currently hidden in production — see the Improvement log). -
The dates are fixed to the current month. Start date is today, end date is the last day of the month, and the period dropdown only offers “monthly”. The owner cannot pick custom dates or specific days/times — the rule is meant to run for the rest of the month, all day, every day.
-
The Target Sale field drives the AI recommendation live. Add a debounced fetch into the field so the price-engine returns an initial recommendation 500 ms after the owner stops typing. A skeleton shows while it waits.
-
A four-column metrics panel appears next to the Target Sale field, showing Last Month Revenue, Month-to-Date Revenue, Organic Projection (with a confidence badge — green / yellow / red), and Gap to Close. Add a tooltip so the owner knows what the Organic Projection means.
-
Pending price modifiers appear as cards the owner can approve or reject. Add the modifier list into the alert so it shows the rule name, business rationale, period, suggested adjustment, and affected menu items. After approve or reject, refresh the list so the owner always sees the current queue.
-
The AI-Driven option can be turned on or off with a single flag flip, so the production hide (2026-07-16) was a one-line change rather than a UI rewrite.
-
The Target Sale field becomes the single source of truth for what the AI recommends — the engine’s response drives the metrics panel automatically.
-
The pending-modifier list is store-driven and self-refreshing, so the owner always sees the current queue after every approve or reject.
PR #1149
Mobile Implementation
No mobile implementation is specified in the PRD, task, or feature PR.
PRD & Task
- PRD: Target Sales & Profit Maximization (AI-Driven Pricing)
- Task: AI Driven Implementation
- Feature PR: feat: dynamic pricing AI driven
Design
No design asset is specified in the PRD, task, or feature PR.
API Blueprint
| Method | Path | URL | Description | Payload |
|---|---|---|---|---|
| GET | /pricing/recommendations/predict | Price-engine base URL | Fetch initial AI recommendation | Query parameters include the recommendation inputs; restaurant ID is sent in X-Restaurant-Id |
| GET | /price_modifiers | Price-engine base URL | Fetch pending price modifiers | Query parameters include modifier status and restaurant ID |
| POST | /price_modifiers/:id/approve?restaurant_id=:restaurant_id | Price-engine base URL | Approve a pending modifier | Empty request body |
| POST | /price_modifiers/:id/reject?restaurant_id=:restaurant_id | Price-engine base URL | Reject a pending modifier | Empty request body |
New Query
No new query.
DB Schema / Database Migration
No database schema or migration.
Improvement:
| Feature Name | Date | What Changed | Description |
|---|---|---|---|
| Target Sales & Profit Maximization | 2026-06-18 | AI-Driven pricing shipped | book-bite PR 1149 merged with the AI pricing recommendation flow, pending modifier approval cards, API wiring, and localized interface text. |
| Target Sales & Profit Maximization | 2026-07-16 | AI-Driven rule option hidden | The UI option was hidden by book-bite PR 1201, fix: hide ai driven, which added show: false. The driving task 86d3q83wv, “Hide dropdown option AI Driven”, has an empty description, so no reason is recorded there. |
| Target Sales & Profit Maximization | 2026-07-17 | RapidCanvas worker disabled | hh-server PR 8447, “Fix/disable rapidcanvas worker”, was merged one day after the UI was hidden. |