2.3 KiB
2.3 KiB
V19 – Optional flat per-product processing
- Admin > Billing > Create/Edit plan > Processing mode: Choose outputs (default) or Per product.
- Per product accepts a fractional cost with at most 4 decimal places, e.g.
0.3750credits per product. No separate title/description/SEO choices appear for customers assigned this plan. - Customers on this plan select products, choose Product processing, and see their total credits before confirmation. That action submits title + description + SEO metadata in one enhance job. The actual debit uses the same flat rate.
- Plans without a
plan_processing_costsrow withfeature_name='product_ai'retain the three independent output costs. - Creating a new plan and selecting Per product adds the record; switching back to Choose outputs deletes it. Legacy plans are not switched automatically.
- For plans using Per product, an optional company-level
product_airate takes priority over the plan rate. It does not activate Per product mode on a plan that does not opt in. - No database migration is required; the existing processing cost tables introduced in migration 049 and numeric precision introduced in 053 are reused. Those migrations must already be applied.
- Existing completed jobs and their charges are unchanged. Future processing (including API jobs) uses the active plan's current pricing mode. If you change a plan while jobs are pending, those jobs may use the newly configured price when debited; avoid switching plans mid-batch.
- Deploy the frontend, API, and worker together.
Acceptance test
- Create a new test plan; default should be Choose outputs. Verify three independent options in Product Management.
- Edit the plan, switch to Per product, price
0.375. Reopen the popup: mode and price should persist. - Assign it to a test company and refresh the customer dashboard. Verify one Product processing action, with 10 items displaying 3.75 credits.
- Run a test job and verify one
0.375credit debit per successfully processed product. Verify title, description, and SEO result fields. - Switch back to Choose outputs; verify the three options reappear and the old per-output rates are preserved.
- Test API processing under the same plan, confirming the flat rate is used without a client-side billing bypass.