cancel
Showing results for 
Search instead for 
Did you mean: 

User Id used for IAP S2S REST Requests

ward1992
Honored Guest

Hi Support,

    For IAP S2S requests in this doc: https://developer.oculus.com/documentation/native/ps-iap-s2s/

    1. Verify Item OwnerShip: there is no user id in the request, is this intended? if yes, how will oculus identify the user?

curl -d "access_token=OC|$APP_ID|$APP_SECRET" -d "sku=$SKU" https://graph.oculus.com/$APP_ID/verify_entitlement

     2. Consume an IAP Item: the same quest as no.1

curl -d "access_token=OC|$APP_ID|$APP_SECRET" -d "sku=$SKU" https://graph.oculus.com/$APP_ID/consume_entitlement

     3. Retrieve Items Owned:  what is the user id? app scoped id or org scoped id?

curl -G -d "access_token=OC|$APP_ID|$APP_SECRET" -d "user_id=$USER_ID" -d "fields=id,grant_time,expiration_time,item{sku}" https://graph.oculus.com/$APP_ID/viewer_purchases 

  

Thanks

3 REPLIES 3

msanatan
Explorer

I noticed the same thing... it looks wrong. I'll try USER_ID instead of APP_ID, let's see if that works. Did you figure it out?

Wang_Shi
Explorer

Also confused with this. Any Updates?

msanatan
Explorer

OK, figured it out... No idea why the docs don't have it for all requests https://developer.oculus.com/documentation/unity/ps-iap-s2s/ but the key is using the `user_id` parameter. It's only used in the "Retrieve Items Owned" example...

Here's how I verify and consume purchases in Python using the requests library:

 

def verify_oculus_in_app_purchase(meta_user_id: str, sku: str):
    return requests.post(
        f'https://graph.oculus.com/{app_id}/verify_entitlement',
        data={'sku': sku, 'access_token': access_token, 'user_id': meta_user_id}
    ).json()

def consume_oculus_in_app_purchase(meta_user_id: str, sku: str) -> bool:
    return requests.post(
        f'https://graph.oculus.com/{app_id}/consume_entitlement',
        data={'sku': sku, 'access_token': access_token, 'user_id': meta_user_id}
    ).json()

 

 

Good luck with your projects everyone!