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.5KViews1like2CommentsS2S API `viewer_purchases` errors
The documentation for this API suggests the following (from this page -- https://developer.oculus.com/reference/platform/v34/o_v_r_requests_i_a_p_8h😞 $ curl -G -d "access_token=$USER_ACCESSTOKEN" -d "fields=id,item{sku}" https://graph.oculus.com/$APPID/viewer_purchases I have used the GetAccessToken() call (from Unity) to get what looks like a valid User Access Token. I then use that value and a valid $APPID, and get the following error: "{"error":{"message":"Unsupported post request. Object with ID '$APPID' does not exist, cannot be loaded due to missing permissions, or does not support this operation","type":"OCApiException","code":100,"error_subcode":33,"fbtrace_id":"An4VQxosLHb9uiWeDYZO5ef"}}"", The $APPID does exist, and i have been able to use other S2S API calls using it. What is the correct way to call the "viewer_purchases" method?1.2KViews2likes0Comments