18

This happens when I was using Google Play Android Developer API in Google Developers Console to test the status of purchased product, and the result is always like this

{
 "error": {
  "errors": [
   {
    "domain": "androidpublisher",
    "reason": "projectNotLinked",
    "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."
   }
  ],
  "code": 403,
  "message": "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."
 }
}

Have checked this out using another Developer account (and package name) and it works just fine. I sure have linked the API project from Google Developers Console to Google Play Developer Console -> API Access settings, and try to recreate as many as possible but none of the projects worked.

So what am I missing here? What does it mean "not linked" besides the linked project I made in the settings of Google Play console.

vnoob0
  • 389
  • 1
  • 2
  • 7

8 Answers8

13

In case anybody else has the same issue, try adding a new product/subscription in your Google Play console account. That worked for me, although seems to be some kind of inconsistency problem in Google services.

Diyan_K
  • 171
  • 1
  • 5
  • Changing the title of a product didn't work, but creating a new one did. This is a bit ridiculous... Angry that this took so long. Terrible error message considering "linking" is not at all the problem. – aardvarkk Oct 30 '19 at 20:28
  • Didn’t work for me. I created a new subscription but still got the same error. – AliRehman7141 Jan 12 '22 at 06:54
10

After days trying to use API Explorer to use Android Publisher API but failed, I requested support from Google and receive the answer "It looks like API Explorer is no longer supported for the Publishing API". So basically I can't use API Explorer to check in-app purchase token again. Hope this help who's struggling with this.

vnoob0
  • 389
  • 1
  • 2
  • 7
  • I guess there is another error. If it is not supported, why is it in the API reference at November 2017 (your post was 3 years ago). I guess it is supported, by there went something wrong with the linking. After I linked the project, I got `Edit not found for this application` and not `The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console.` – Bevor Nov 05 '17 at 14:39
10

Make sure the InApp-product is created after linking the API-project.

If you (like me) created the InApp-product first, and then linked the API-project afterwards, you will not be able to call any of the androidpublisher.purchases.* endpoints without getting the "projectNotLinked"-error. Neither from code or via the API-explorer.

You can verify this is the problem by calling androidpublisher.inappproducts.list. If this succeeds, your API-project is correctly linked to the Google Play Console...

It will not help to recreate users in Google API's. Nor to change authentication between OAuth 2.0 client IDs or Service account keys. Everything will work as expected when you create a new InApp-product after linking the API-project.

  • This actually fixed the problem! I'd done everything and it kept saying not linked. As soon as I created a new in-app product all of a sudden it succeeded, thanks so much! – Cliff Cawley Jan 08 '19 at 23:15
  • It worked for me too. This must be a pain to finally find that this is the case. Will it be okay to delete old SKU using API? – Philip Borbon May 31 '19 at 03:52
  • @PhilipBorbon; I don't see any reason why deleting the old SKU using the API shouldn't work, but I haven't tried it myself... – Lars Peter Larsen Jun 03 '19 at 09:23
  • I tried it, delete will fail once the subscription has been published. It's the same as the Google Developer Console said, can't remove it once it's published. – Philip Borbon Jun 03 '19 at 23:35
2

I got this too and just gave up on getting it to work, instead switching back to v1.1 of the API:

final URL url = new URL(
        "https://www.googleapis.com/androidpublisher" +
        "/v1.1/applications/" + "com.example.app.id" +
        "/subscriptions/" + subcriptionId +
        "/purchases/" + googlePurchaseReceipt +
        "?access_token=" + googleAccessToken);

Hopefully someone will post a better answer sometime and we can all switch to v2 of the API.

Brian White
  • 8,332
  • 2
  • 43
  • 67
2

You need to link the project in the Google Play Developer Console under Settings -> Api Access.

See my complete answer here: https://stackoverflow.com/a/25825907/1745234

Community
  • 1
  • 1
Fabrizio Farenga
  • 460
  • 1
  • 5
  • 16
1

The APIs Explorer doesn't appear to work with v2 of the API. A bug has been reported: https://code.google.com/p/google-apis-explorer/issues/detail?id=268

Trenton
  • 11,678
  • 10
  • 56
  • 60
1

I have exactly the same issue. but i have resolved . [request]: - you must link project Google Play Developer Console before you create inapp purchase

0

I got the same error message when using a "SERVICE ACCOUNT" for authentication. But everything works fine when using a OAuth client of type "installed application". To fix:

  1. Go to the API Access page on the Google Play Developer Console.
  2. Click on "Create oAuth client" button.
  3. Make sure you select "Installed Application"
  4. Use the generated client id and secret to get access/refresh tokens as described in https://developers.google.com/android-publisher/authorization
  5. Use the access token to make api requests.
Dushyanth
  • 461
  • 5
  • 4
  • Yeah, that way works fine, the problem is with the Service Account come together with V2 of the API. – vnoob0 Aug 13 '14 at 02:58