I am having trouble calling the Google Play Developer API.
I have followed all steps listed on https://developers.google.com/android-publisher/authorization . This includes
- Create Project and enabled Google Play Android Developer API (with my Google Play Console Account)
- Link the project through Settings > Developer Account > API Access
- Grant access to service account with finance permissions to the app through the Google Play Console.
- Create OAuth 2.0 Client Id, Client Secret, and Redirect URI credentials.
- Generate the Refresh Token and the Access Token by sending POST request.
Then, to call the purchases.subscriptions.get API, I used the following CURL command:
(https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get)
curl -X GET "https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}" -H "Authorization: Bearer {access_token}" -H "Accept: application/json" --compressed
However, I am receiving the following error:
"error": {
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation.",
"errors": [
{
"domain": "androidpublisher",
"message": "The current user has insufficient permissions to perform the requested operation.",
"reason": "permissionDenied"
}
]
}
}
I have read and implemented changes recommended in other posts such as
- added in-app product/subscription before granting permission or linking to service account
- opened "in-app products/subscription" and performed some updates
- Verified all Users and Permissions through Google Play Console
- eg. service account is admin user
- waited over 48 hours to allow Google to propagate all access rights for APIs.
I have also tried calling the API through https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get#authorization-scopes but still no luck (get an error).
If anyone has any suggestions, that would be very much appreciated. Thanks.