Jeff Padgett
Jeff Padgett

Reputation: 2539

Inconsistent - "The project id used to call the Google Play Developer API has not been linked in the Google Play Developer Console."

So here's the thing - I have a node.js backend server for my Android App. I am using the Google Play billing library, and using the backend to verify the purchase as google Docs recommend.

Now, all the other answers out there regarding this error seem to refer to a consistent problem.

My backend SOMETIMES verifies, and SOMETIMES comes back with this as an error, indicating that in fact, my service account IS linked (as shows up in my consoles).

I tried two different 3rd party libraries, and I have the same issue. Sometimes one will respond with verification success, while the other will say my account is not linked. Sometimes they are both negative, sometimes both positive.

It seems inconsistent.

var platform = 'google';
        var payment = {
            receipt: purchaseToken, // always required  ... this is google play purchaseToken
            productId: subID,  // my subscription sku id
            packageName: 'com.xxxxxx', // my package name
            keyObject: key,  // my JSON file
            subscription: true, // optional, if google play subscription

        };



   var promise2 = iap.verifyPayment(platform, payment, function (error, response) {
        /* your code */
        if (error) {
            console.log('error with iap, ' , error);
            return true;
        } else {
            console.log('success with iap, response is: ', response);
            return true;
        }
    });

I also tried with a different library, got same results:

var receipt = {
            packageName: "com.xxxx",
            productId: subID,  // sku subscription id
            purchaseToken: purchaseToken // my purchase token
            };

            var promise = verifier.verifySub(receipt, function cb(err, response) {
                if (err) {
                    console.log('within err, was there a response? : ', response); 
                console.log('there was an error validating the subscription: ', err);
                //console.log(err);
                return true;
                } else {
                console.log('sucessfully validated the subscription');
                // More Subscription info available in “response”
                console.log('response is: ', response    );
                return true;
                }
               });


// return promises later.

Any else experience this issue?

Upvotes: 3

Views: 2869

Answers (1)

Jeff Padgett
Jeff Padgett

Reputation: 2539

TLDR; Create a new product ID.

I eventually found the answer. The problem was not with my code, or with permissions in the Google Developer Console OR the Google Play Console. Everything was set up correctly except for one thing.

Previously, before setting up Test License Accounts in Google Play Console, I had made an actual Subscription purchase with real money on my productID "X".

Then, after adding the same google account that bought the subscription as a test user, I continued to test results on the same subscription, productID "X".

Even though I had cancelled the REAL purchase, the actual expiration date was not for another month.

Therefore, I believe sometimes Google was getting confused when I would buy/cancel the purchase - confusing the test subscription with the real subscription.

Creating a new Product ID, and only using that, solved my problem, and purchases are verified consistently.

Upvotes: 12

Related Questions