Delivery requests the purchased credit count on open credit-purchase invoice orders
Operator need
The Delivery Workbench credit-reservations drawer shows an open invoice order's amount and Revenue status. Operators also need the number of credits purchased on that invoice so they can understand what the pending payment will fund without opening or reverse-engineering the invoice.
Delivery cannot infer this from amount_total_cents. One invoice can contain
multiple package types, quantities can vary, and offering prices can change.
Revenue owns the Order and Order Items, so the displayed count must come from
the invoice order rather than a current-catalog price match.
Delivery consumer
Delivery is ready to consume an additive nullable credits_granted number on
each entry in GET /api/v1/orders/credit-purchases response
open_invoice_orders. When present, the open-order card renders the amount and
credit count together, for example $300.00, 16 credits. Until Revenue supplies
the field, Delivery keeps the current amount-only display.
The Delivery parser accepts the field without making it required, so the addition is backward-compatible and can deploy independently.
Revenue ask
Revenue, please add credits_granted to each open invoice-order projection,
calculated from that Order's persisted Order Items and quantities. The value
should represent the total credits the invoice will grant when paid, including
multi-package carts. Please confirm when the production read returns the field
so Delivery can verify the operator card against an open invoice.
References
- Revenue endpoint:
GET /api/v1/orders/credit-purchases - Revenue projection:
open_invoice_orders - Delivery consumer:
app/workbench/workbench-page.client.tsx - Delivery parser:
lib/revenue/reservation-client.ts