How to reliably consume S2S IAP items from a user's inventory
Hey! I think there's an oversight in the existing API for consumable inventory that I'd like to know the correct way of working around. Let's say I have a feature where I'm awarding a player currency for purchasing a consumable item via in app purchases (like listed on this page https://developer.oculus.com/documentation/unity/ps-iap-s2s/). What I'm trying to do from our game's server, is consume the 100 coins consumable and credit the player with coins after it has been consumed. This workflow in itself is not too complicated, but the details around the transaction I'm unsure about. I think with the naiive implementation of "consume the item via the api, and then credit the currency in the database" there's a risk of both consuming the item from meta's s2s API, and _not_ awarding the currency due to a database error or a server crash. The inverse is also true, where I could eagerly credit the currency, and roll back my transaction if the s2s consume query fails, because we might be forced to roll back the transaction if the server crashes during the request to the s2s API (even if that request is one that the meta server's considers successfully completed). Usually, the workflow for this kind of thing would use transaction objects for the consumption of the item so that we could record that we were _about_ to consume the item, then if anything goes wrong, we could query the state of that transaction on the vendor API and mark it as finalized if it did in fact succeed but we never recorded the result. (the steam API InitTxn, QueryTxn and FinalizeTxn are an example of this kind of transaction workflow). I think I could do this with the meta S2S API's by using a transaction recorded on our servers if: 1) I could consume an item by it's item ID instead of it's sku 2) I could check if we've consumed the item with the given item id Also, I'm not sure what to do about chargebacks or other kinds of voided transactions for consumable items.1.5KViews1like2CommentsGet user Info from the app's backend service
Is there a way for the App's server to fetch Quest user ID based on the access token? The flow looks like this 1. Client calls the backend with access token. 2. Backend calls Quest API to fetch user ID, base on the access token. We don't want the client to directly send the user ID, because we want to make sure the caller can verify itself based on access tokens.671Views1like0Comments