Understanding VerifyPurchases for "Non-Consumables"
-
Hi there,
I have a mobile application that I am planning to release on both Android and iOS. My monetization strategy is to have a virtual currency and then a cosmetic store where the user can unlock items via VC. The user earns VC via gameplay and also upon watching ads. I also allow the user to purchase VC via IAP (which I can use VerifyPurchases on brain cloud to award to the user). I was also going to sell a coin boost that is not purchasable via VC (IAP only).
I am seeing that VerifyPurchases automatically will award VC to my server-side VC balance upon a successful verify. What happens with Non-Consumable products (like my coin booster) upon successful verification? I don't see anything in the available APIs to read if a product was successfully purchased. Is it now up to the client to then save more data on braincloud to log this purchase, or to use a post hook on verifyPurchases to record this purchase? I am currently keeping track of my unlocks in player statistics. What's the best practice here?
Thanks,
Davis -
Hi Davis,
As with most things brainCloud - there are a few ways that you could approach this.
You could certainly use player statistics - as you are for your other unlocks.
brainCloud allows you to attach "extra data" to a product - they are essentially key+value pairs, that get returned as a simple JSON map in the VerifyPurchase response.
You could catch that response on the client, or for more security, do it from the server - either via a cloud code script that wraps the VerifyPurchase() call itself, or as you said, a post-hook on the VerifyPurchase call. Just update the named "statistic" based on the "extra data" portion of the VerifyPurchase response.
There is one other way of doing this - which is to have a special currency for your "coin booster". <- brainCloud allows you to have as many as you want.
To use it, simply create a currency called "coinBooster" - and allow the customer to buy one of them. Voila - no custom code!
Hope that helps!
Paul.
-
Thanks Paul that all makes sense. I will likely go with wrapping the Verify call in a cloud script to be consistent with my other purchase code.
-
Happy to help!

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login