Product
Overview
The Product Service manages virtual currencies and handles receipt processing for the various app stores.
WARNING: As of brainCloud 3.9, the Product service is being deprecated in favor of two replacement services: AppStore for in-app purchases and product/promotions/pricing requests and VirtualCurrency for currency operations. The APIs in the replacement services are similar, but improved; more generic method names and cleaner, more standardized response formats. The Product service and APIs will continue to be available until the end of 2019. We strongly recommend that all new apps use the AppStore and VirtualCurrency services instead.
The Product service includes APIs for:
- Managing Virtual Currencies
- Handling In-app Purchases (IAP)
- Querying Promotions
Virtual Currencies
The following API calls are used to manage a user's currency balances:
[GetCurrency](/api/capi/product/getcurrency)- get current currency balances[AwardCurrency](/api/capi/product/awardcurrency)- call when currency is awarded. Note that[ConsumeCurrency](/api/capi/product/consumecurrency)- call when currency is consumed[ResetCurrency](/api/capi/product/resetcurrency)- resets the users currency to zero
Note that there are Parent and Peer versions of these APIs available as well.
For security reasons, the above calls are normally only available via cloud code. You can make them client callable by enabling the [x] Allow Currency Calls from Client compatibility flag on the Design | Core App Info | Advanced Settings page of the Design Portal.
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
- 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. 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:
[GetSalesInventory](/api/capi/product/getsalesinventory)[GetSalesInventoryByCategory](/api/capi/product/getsalesinventorybycategory)
These methods are used to confirm store receipts:
Facebook -
ConfirmFacebookPurchaseGoogle Play -
ConfirmGooglePlayPurchaseiOS -
VerifyItunesReceiptWindows -
VerifyMicrosoftReceipt
These methods are for performing Steam purchases:
[StartSteamTransaction](/api/capi/product/startsteamtransaction)[FinalizeSteamTransaction](/api/capi/product/finalizesteamtransaction)
Promotions
In addition to the above purchase flow, 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 APIs are:
[GetEligiblePromotions](/api/capi/product/geteligiblepromotions)
📄️ AwardCurrency
Overview
📄️ AwardParentCurrency
Overview
📄️ AwardPeerCurrency
Overview
📄️ ConfirmFacebookPurchase
Overview
📄️ ConfirmGooglePlayPurchase
Overview
📄️ ConsumeCurrency
Overview
📄️ ConsumeParentCurrency
Overview
📄️ ConsumePeerCurrency
Overview
📄️ FinalizeSteamTransaction
Overview
📄️ GetCurrency
Overview
📄️ GetEligiblePromotions
Overview
📄️ GetParentCurrency
Overview
📄️ GetSalesInventory
Overview
📄️ GetSalesInventoryByCategory
Overview
📄️ ResetCurrency
Overview
📄️ ResetParentCurrency
Overview
📄️ StartSteamTransaction
Overview
📄️ VerifyItunesReceipt
Overview
📄️ VerifyMicrosoftReceipt
Overview