Repository navigation
docs(purchase): a player whose own limit ran out gets a limit decline, not an inventory one - #83
Merged
Conversation
…it runs out The comments on the inventory and limit statuses of PurchaseConfirmationStatus and PurchaseRegistrationStatus now say when each applies: - FAILED_INSUFFICIENT_INVENTORY: a stock shared across players has run out - FAILED_PURCHASE_LIMIT_EXCEEDED: the item's own remaining count (max_purchasable) is lower than the quantity purchased, for example 0 - FAILED_PACK_LIMIT_EXCEEDED: the same, for the pack's remaining count Comments only; the wire contract is unchanged. docs/gen/swagger.v1.json is regenerated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FAILED_INSUFFICIENT_INVENTORY now applies when a stock shared across players is lower than the quantity, for example 0, so a purchase of 2 with 1 shared unit left still has a documented status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
A game backend asked which decline status to send from
ConfirmPaymentwhen a player has no purchases of a price point left. The published comment forFAILED_INSUFFICIENT_INVENTORY("due to insufficient inventory") reads as a fit for that case, but Stash shows the player "This offer just sold out" for it. A per-player limit should get "Purchase limit reached". On 29 Oct we agreed with that game's engineers thatPURCHASE_CONFIRMATION_STATUS_FAILED_PURCHASE_LIMIT_EXCEEDEDis the right status: https://stashgg.slack.com/archives/C0BTY2W7NGN/p1793292550487739This PR writes that rule into the enum comments, so every integrator reading the API reference picks the same status. Soeren Walls approved this exact text, including narrowing
INSUFFICIENT_INVENTORYto a stock shared across players, on 31 Oct 2026. Review round 1 made the shared-stock comment quantity-aware as well (lower than the quantity, for example 0), so a purchase larger than the shared stock left still has a documented status.Grounding (pie-mono
main):go_workspace/pkg/integrations/generic/checkout_failure_reason.go,confirmationStatusToReason(L128-147):INSUFFICIENT_INVENTORYmaps toOFFER_OUT_OF_STOCK, and bothPURCHASE_LIMIT_EXCEEDEDandPACK_LIMIT_EXCEEDEDmap toPURCHASE_LIMIT_REACHED.registrationStatusToReason(L83-101) maps the register statuses value for value.ConfirmPaymentRequest.PurchasedItem.quantityandRegisterPaymentRequest.PurchaseRegistration.quantityinpurchase/v1/service.proto, andPurchasableItem.max_purchasableincatalog/v1/service.proto("refuses a purchase whose quantity exceeds it"). The comments say "lower than the quantity purchased, for example 0", which covers a purchase of 2 with 1 left and does not decline the purchase that uses up the last unit.What changed
server/egress/shop/purchase/v1/enums.proto, comments only:PurchaseConfirmationStatus:FAILED_INSUFFICIENT_INVENTORY(a stock shared across players is lower than the quantity purchased, for example 0),FAILED_PURCHASE_LIMIT_EXCEEDED(the item'smax_purchasableis lower than the quantity purchased) andFAILED_PACK_LIMIT_EXCEEDED(the same, for the pack'smax_purchasable).PurchaseRegistrationStatus: the same three statuses, worded to match, since the two enums map value for value.docs/gen/swagger.v1.jsonregenerated. A structural diff shows only thetitletext of these two enums changed (8 and 4 paths); no per-value docs were dropped (no comment ends in a period).The wire contract is unchanged. These comments reach docs.stash.gg through the usual publish chain: this PR, then the pie-mono
proto/publicbump and swagger regeneration, then the docs deploy. stashgg/stash-docs#189 updates theConfirmPaymentsection of the real-time catalog endpoints page.Intent
flowchart LR C{{"Confirm-time check<br/>in the game backend"}}:::existing C -- "shared stock<br/>lower than quantity" --> I["FAILED_INSUFFICIENT_INVENTORY<br/>comment: stock shared across players"]:::this C -- "item max_purchasable<br/>lower than quantity" --> L["FAILED_PURCHASE_LIMIT_EXCEEDED<br/>comment: quantity-aware"]:::this C -- "pack max_purchasable<br/>lower than quantity" --> P["FAILED_PACK_LIMIT_EXCEEDED<br/>comment: quantity-aware"]:::this I --> S1(["Player: offer sold out"]):::existing L --> S2(["Player: purchase limit reached"]):::existing P --> S2 classDef this fill:#ffd8a8,stroke:#e8590c,stroke-width:4px,color:#111 classDef existing fill:#dbe4ff,stroke:#4263eb,stroke-width:1px,color:#111Legend: orange = changed here, blue = existing behaviour; hexagon = rule, rounded = what the player sees where the checkout renders the reason.
Big Picture
Facts only: Stash already handles all three statuses on
main; this PR changes no behaviour, only which status the reference tells integrators to send.🤖 Generated with Claude Code
Tip
💥 Blast Radius — No Risk
Intent: Help integrators choose the decline status that gives players the appropriate message when a purchase limit or shared stock runs out.
The change updates shared guidance without changing runtime behavior or wire values.
Overview
server/egress/shop/purchase/v1/enums.protoclarifies the inventory, item-limit, and pack-limit statuses for registration and confirmation.Shop reach: none — no shop runtime behavior changes; the revised guidance is available to all integrators.
Payments path: The catalog's
max_purchasableinforms the game backend's limit check, which selects a registration or confirmation decline status. The reference now directs per-player limits to purchase-limit statuses and shared stock shortages to insufficient inventory; the PR describes the existing status-to-player-message mapping.Scope is the purchase enum comments and one generated output; enum values and request and response fields are unchanged.
Not reviewed: 1 generated file(s) — marked
linguist-generatedin.gitattributes:docs/gen/swagger.v1.json.