Skip to main content
New Participant
January 17, 2023

User Id used for IAP S2S REST Requests

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

msanatan
New Participant
June 15, 2023

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?

WangShi
Participant
August 31, 2023

Also confused with this. Any Updates?

msanatan
New Participant
September 30, 2023

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!