App Store
The AppStore Service provides access to Product / Pricing / Promotion features, as well as integrations with supported AppStores.
This service replaces the deprecated Product Service for purchases and product / pricing data. Currency operations have been moved to the new VirtualCurrency Service.
It includes APIs for:
- Handling In-app Purchases (IAP)
- Querying Products and Promotions
API Summary
Verifying In-app Purchases
The specifics of processing in-app purchases from platform to platform vary slightly, but the overall flow is as follows:
- Client app requests a list of products from brainCloud ( GetSalesInventory )
- Client app requests the localized pricing details for the products from the AppStore
- Client app displays the products with prices to the user
- User chooses to purchase a product
- Client app invokes the purchase API from the AppStore. AppStore performs the purchase, and sends back a receipt to the client
- Client sends the receipt to brainCloud for validation ( VerifyPurchase ). brainCloud performs a back-channel verification of the receipt with the AppStore – and if all is good, makes any required changes to virtual currency balances
The follow call requests the list of products for sale:
This method is used to confirm store receipts:
- VerifyPurchase - standardized receive verification for Apple, Google, Facebook and Steam purchases
Performing Two-part Purchases
Some AppStores, like Steam, do a real-time two-part purchase. The following new API methods handle this requirement:
- StartPurchase - Generic version of start purchase.
- FinalizePurchase - Generic version of finalize purchase.
Promotions
In addition to the above purchase flows, the app can also query to see if any promotions are currently active (for display in banners, etc.), using the GetEligiblePromotions call – and can make manual adjustments to virtual currency balances.
The promotions API(s) are:
- GetEligiblePromotions - Retrieves eligible promotions.
📄️ FinalizePurchase
Finalize a two-part purchase transaction. Currently only used for Steam purchases. On success, the player will be awarded the associated currencies.
📄️ GetEligiblePromotions
Get eligible promotions.
📄️ GetSalesInventory
Method gets the active sales inventory for the passed-in currency type and platform.
📄️ GetSalesInventoryByCategory
Method gets the active sales inventory for the passed-in currency type, platform, and category.
📄️ RefreshPromotions
Returns up-to-date eligible 'promotions' for the user and a 'promotionsRefreshed' flag indicating whether the user's promotion info required refreshing.
📄️ ReturnPurchase
Mock version of return purchase, use for test purpose.
📄️ StartPurchase
Initialize a two-part purchase transaction. Currently only used for Steam purchases.
📄️ SysAwardProduct
Awards the current user the product item rewards without requiring a purchase (free, no purchase transaction recorded).
📄️ SysAwardProductToUser
Awards the specified user the product item rewards without requiring a purchase (free, no purchase transaction recorded).
📄️ SysGenerateAzureADAccessToken
Generates an Azure AD access token.
📄️ SysGetTransactionDetails
Returns details of the identified product transaction.
📄️ SysGetTransactionsPage
Gets the page of product transactions information from the server based on the specified context.
📄️ SysGetTransactionsPageOffset
Gets the page of product transactions information from the server based on the encoded context and specified page offset.
📄️ SysRecordTransaction
Records a manual transaction. Useful for stores that are not yet directly supported -- or for apps that doing purchases via other means - but still want to record them in brainCloud for reporting purposes.
📄️ VerifyPurchase
Used to verify a purchase receipt for Apple AppStore, Google Play, Facebook or Windows. The contents passed into receiptData are store-specific. On success, the player will be awarded the associated currencies.