PremiumCurrencySystem.V2 is the gameplay-side bridge between platform store
receipts and ServerCurrencyAuthority.V2. It does not replace App Store or
Google Play server validation. Instead, it consumes the verified receipt result,
checks that the product is allowed to grant premium currency, rejects unsafe
receipts, and fulfills the purchase through the same auditable ledger path used
by server-authored economy mutations.
Runtime Surface#
FV2PremiumCurrencyProductmaps a platform SKU to a premium currency grant, local minor-unit price, provider, region, display text id, and enabled state.FV2PremiumCurrencyCatalogstores the purchasable product catalog and the accepted store environments such asproductionandsandbox.FV2PremiumCurrencyReceiptis the server-verified purchase evidence. It includes product id, store SKU, transaction id, optional original transaction id, Google PlaypurchaseToken, signed payload, signature, receipt fingerprint, account binding, environment, quantity, claimed grant amount, refund state, and verification state.FV2PremiumCurrencyStoreVerificationEndpointdescribes the platform server API surface the commerce service must call before fulfillment.ValidatePremiumCurrencyCatalogproves that real-money products only grant currencies flagged as premium inCurrencyDefinition.V2.ValidatePremiumCurrencyReceiptrejects missing account bindings, missing signed receipt evidence, unverified receipts, refunded receipts, expired receipts, environment mismatches, replayed receipt fingerprints, disabled products, SKU/provider mismatches, non-premium currency grants, and claimed amount mismatches.FulfillPremiumCurrencyPurchasebuilds aplatform.iapledger grant and applies it throughServerCurrencyAuthority.V2; it never writes balances directly.
Store Integration#
Apple receipts are represented by the App Store Server API transaction lookup:
GET /inApps/v1/transactions/{transactionId}. The commerce service stores the
verified signedTransactionInfo payload, transaction id, original transaction
id when present, account binding, environment, and a stable receipt fingerprint
before calling gameplay fulfillment.
Google Play receipts are represented by the Google Play Developer API
purchases.products.get endpoint:
GET /androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}.
The commerce service passes the verified ProductPurchase payload, product id,
order/transaction id, purchaseToken, account binding, environment, and receipt
fingerprint into FV2PremiumCurrencyReceipt.
The gameplay layer treats bStoreVerified as a prerequisite. A receipt with the
right shape but no server verification is rejected.
Fulfillment Rules#
- Premium currency products must have a product id, store SKU, provider,
positive price, positive grant amount, region, ISO currency code, and a
currency id present in
CurrencyDefinition.V2. - Real-money products may only grant currencies where
IsPremiumLike()is true. The default catalog grantscurrency.gems. - Receipt product id, SKU, provider, store environment, account id, platform account hash, payload, signature, transaction id, and receipt fingerprint are mandatory.
- Google Play fulfillment also requires
purchaseToken. - Refunded, expired, unverified, disabled-product, and mismatched-provider/SKU receipts fail before any ledger request is built.
- Claimed grant amount must equal
(GrantAmountMinorUnits + BonusAmountMinorUnits) * Quantity. - Receipt replay is blocked by deterministic transaction ids plus ledger tags
for
iap.receipt.<fingerprint>andiap.transaction.<transactionId>. - Fulfillment uses
SourceId = platform.iap, requires the source to be trusted byServerCurrencyAuthority.V2, and recordspremium.currencyaudit tags on the immutable currency ledger.
Validation Commands#
Run these checks when touching premium currency behavior:
python3 V2/ue/Tools/check-v2-premium-currency-system.py
python3 V2/ue/Tools/check-v2-server-currency-authority.py
python3 V2/ue/Tools/check-v2-currency-ledger.py
python3 V2/ue/Tools/check-v2-currency-definition.py
python3 V2/ue/Tools/check-v2-ci-workflow.py
python3 -m json.tool V2/ue/Content/V2/Gameplay/Economy/PremiumCurrencySystem_V2_Contract.json
python3 -m json.tool V2/ue/Build/Horde/v2-buildgraph-job.json
python3 V2/tools/validate-v2-docs.py
Official platform references:
- Apple App Store Server API: https://developer.apple.com/documentation/appstoreserverapi
- Apple Get Transaction Info: https://developer.apple.com/documentation/appstoreserverapi/get-transaction-info
- Google Play
purchases.products.get: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products/get - Google Play
ProductPurchase: https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.products