How to verify purchase for android app in server side (google play in app billing v3)

前端 未结 6 487
再見小時候
再見小時候 2020-11-30 16:41

I have a simple app (needs user login with account). I provide some premium features for paid users, like more news content.

I need to record if the user has bought

6条回答
  •  醉酒成梦
    2020-11-30 17:13

    Marc Greenstock's answer is definitely enlightening, a few things to pay attention though which took me a long time to figure out (at least way more time than I expected):

    1. I had to check "Enable G Suite Domain-wide Delegation" on Service Account settings. Without this I kept getting this error: "The current user has insufficient permissions to perform the requested operation" Image with Enable G Suite Domain-wide Delegation option checked

    2. For testing purposes you can create a JWT token for your service account here, just don't forget to select RS256 Algorithm.

    3. The public key is the "private_key_id" from your downloaded JSON file. It also has the following format:

      -----BEGIN PUBLIC KEY----- {private_key_id} -----END PUBLIC KEY-----

    4. The private key is the "private_key" from your downloaded JSON file

    5. The required claims for the JWT generation are described here.

    6. Confused about what exactly a JWT Token is and how it is assembled? Don't be ashamed, check this link. Odds are you are just like me and took a long time to bother looking for what exactly it is, it is (way) simpler than it looks.

提交回复
热议问题