feat(api): invoice item create accepts pricing[price] + quantity (newer Stripe SDK shape) - #71
Merged
Merged
Conversation
Newer Stripe SDKs (stripe-java 31 / API 2025+) create invoice items with pricing[price] and quantity instead of amount, which the allowlist rejected as parameter_unknown. Accept the new shape: resolve the price, derive amount = unit_amount x quantity (quantity defaults to 1), enforce amount XOR pricing with Stripe's exclusive-params error, and serialize quantity plus the pricing.price_details block on responses. Persist price_id/product_id/quantity (migration 020) so the fields survive reads — without the columns the create response carried them but GET/LIST silently dropped them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HapqvjSLa6A6zRqe6dYyvu
This was referenced Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
stripe-java 31 (Stripe API 2025+) creates invoice items with
pricing[price]+quantityinstead ofamount. billtap'svalidateInvoiceItemCreateallowlist rejects these withparameter_unknown, so any client on a current SDK cannot create invoice items at all (observed as extra-usage payment flows failing with the client mapping the rejection to a 503).The OpenAPI-generated request schema (
internal/stripecompat/validation_generated.go, PostInvoiceitems) already lists both params — only the hand-written validation/handler/model/storage path was missing.Changes
pricing[price]/quantity; requireamountXORpricing[price]; rejectamount+quantityandamount+pricingwith Stripe's exclusive-params message; keep the amount-path non-zero + currency checks.resource_missingon unknown id), deriveamount = unit_amount × quantity(quantity defaults to 1), currency from the price.price_id/product_id/quantity(migration 020) — without the columns the create response carried the fields but GET/LIST silently dropped them (read-back test included).quantity+pricing: {type: "price_details", price_details: {price, product}, unit_amount_decimal}per the current Stripe response shape.Verification
go build ./.../go vet ./internal/...cleango test ./internal/api/ ./internal/billing/ ./internal/storage/ -count=1all greenTestInvoiceItemPricingCreate: 6 subtests — pricing×quantity drives finalize amount_due, quantity default, both exclusivity rejections, missing price, amount-path regression + persistence read-back.🤖 Generated with Claude Code
https://claude.ai/code/session_01HapqvjSLa6A6zRqe6dYyvu