Google Play Purchase API giving me invalid data

13,482 views
Skip to first unread message

zdd...@gmail.com

unread,
Sep 3, 2013, 6:23:20 AM9/3/13
to google-apis-e...@googlegroups.com
Hi all,

I had done a in-app billing v3 purchase and the return receipt as follow:
receipt: {"nonce":-7221594494856150694,"orders":[{"notificationId":"-662487986559083631","orderId":"12999763169054705758.1328614329617175","packageName":"com.mycompany.app","productId":"com.zealotdigital.fhmobile.diamond1","purchaseTime":1377515611000,"purchaseState":0,"purchaseToken":"egeqbpjbyqqlegbsxrachdmk"}]}

signature: hVkThA0EHojCY1BVlfGtsvvzAH4AU75kW24n3qpG8I7kIcpE0I4iYk3IPqZcy3U1H33mhrgyUmFrVXxnmmKhRrEvhrdMgb1V+Tl75JYvP5ISaNBX6L/0kTioFVcP3DEmkVoiZ/JfbELU8lMeu9zYh/gYltP6kYRSsAKp2Pd9EUbVfuG6RmlL065WJ7Cpd1NkyQ5d6ExY+62w+dj2JYuaXt0o9EV4j464+SrwxrOfGTLwLwZwh80Sk9B/vTSRcVfEp0L0lQkIjjVqkQAK8UUM11+TIJ7LXrX7+AI6lb3xIwrwIK4bxJaih1hCR2vReFFk9Ev4Z0I0959Bu/+z8HGjeQ==


Now, I want to do a server side validation of the receipt by querying the google play purchase api as follow

GET
https://www.googleapis.com/androidpublisher/v1.1/applications/com.mycompany.app/inapp/com.zealotdigital.fhmobile.diamond1/purchases/egeqbpjbyqqlegbsxrachdmk?access_token=ya29.AHES6ZT6tIzezrpXp9k9lnFI-ocw-WfM_Rm0h8TEuHS_lzdOx0LFyac

the access_token is generated by following the oath2.0 guideline... it's a valid token as per my post here.

However, I get the following response from google
{  "error": {   "errors": [    {     "domain": "global",     "reason": "invalid",     "message": "Invalid Value"    }   ],   "code": 400,   "message": "Invalid Value"  } }


Can anyone here enlighten me on what's wrong with the value i passed in? Your help is very much appreciated.. Thanks.


Fergus Rourke

unread,
Jan 9, 2014, 7:34:02 PM1/9/14
to google-apis-e...@googlegroups.com
I also have the same problem, exact same error message. Did you ever resolve what was causing your error?

Julian Dreißig

unread,
Feb 7, 2014, 11:12:27 AM2/7/14
to google-apis-e...@googlegroups.com
Hi,

same problem over here, I have tried to validate a purchase with the Android Publisher API and only get the mentioned Error 400. Happens both when trying in the Explorer or with a direct HTTP request. I don't think it is related to the OAuth part, since I get different error messages when providing invalid credentials.

Any input would be greatly appreciated, thanks.

- Julian

Jeremy Cheng

unread,
Feb 15, 2014, 7:49:12 PM2/15/14
to google-apis-e...@googlegroups.com
Same problem, any solutions?

Stephen Longhurst

unread,
Feb 19, 2014, 10:34:47 AM2/19/14
to google-apis-e...@googlegroups.com
I'm getting the same error, but only on some purchases.  One user, same product purchased 3 times in my app, all purchases within the space of about 10 minutes.  First and second purchases fail to verify with the 400 Invalid value error, but the final one goes through fine with the expected result.

I can look at my users transaction history and manually perform the verify on historical receipt data, and there doesn't seem to be a pattern I can see as to why some fail and others work.

Sorry it's not an answer, just thought I'd add to the users having the problem.

Cheers,

  Steve

mikel

unread,
Mar 27, 2014, 9:48:39 PM3/27/14
to google-apis-e...@googlegroups.com
Did anyone figure out which parameter was the culprit? I also suspect this must be some specific account-related issue, since a general outage on this api is highly unlikely.

mikel

unread,
Mar 31, 2014, 5:35:01 PM3/31/14
to google-apis-e...@googlegroups.com
So far I've only been able to get a couple variants of errors: "invalid login", "invalid permissions", and "invalid value". "invalid value" covers way too broad a range of errors that it's getting impossible to track down where the error is -- the google play account level, dev console project level, or specific malformed api query parameter. I've yet to get a response that gives me a little more information to work with.

I've followed all documented steps: creating a dev console project with play account, performing oauth with said account to retrieve token and refresh_token, etc. However, using the api with these credentials only results in "invalid value" and this is with real payment tokens generated on production servers. One caveat is that I'm trying to perform status gets on subscription transactions -- don't know if this could be the issue...

Any assistance would be appreciated

Thanks

mikel

unread,
Mar 31, 2014, 7:13:02 PM3/31/14
to google-apis-e...@googlegroups.com
I still suspect that something on the account level is not setup right, because it doesn't matter if I use the APIs explorer, the node client SDK or my request through my own HTTP request -- they all return the same errors. This is a sample request and response we’re getting:

Pierre Merienne

unread,
Apr 1, 2014, 9:43:45 AM4/1/14
to google-apis-e...@googlegroups.com
I'm getting the same issue on inapp (subscription works fine). 

Perhaps this is due to a androidpublisher backend error! I hope it will be fixed soon.

Benjamin Herzig

unread,
Apr 22, 2014, 1:05:10 PM4/22/14
to google-apis-e...@googlegroups.com
Got the same error today on both endpoint (in app and subscriptions). I use the "google-api-services-androidpublisher:v1.1-rev22-1.18.0-rc".

Vi Key

unread,
May 25, 2014, 4:34:00 AM5/25/14
to google-apis-e...@googlegroups.com
Hi all! I have the same problem. What I can do to solve it?

Jan Hermans

unread,
Jun 27, 2014, 5:20:37 AM6/27/14
to google-apis-e...@googlegroups.com
Same thing here with me... exactly the same error message.

Id did following tests:

1. change the 'packageName' This resulted in a message the package name was invalid: "No application was found for the given package name."
This led me conclude I used the correct packeg name.

2. change the 'productId'. This resulted in a message the the product Id is not correct = "Product not found for this application."
This led me conclude I used the correct productId 

3. I switched to the purchase:get method and tried the same values. This gives me an error "The purchase token is associated with a non-subscription purchase. Only subscription purchases are supported for this call."
This led me conclude I used the correct token was used since google recognised it as a purchase and not a subscription.

Does any one else have some other thoughts on this?

Op dinsdag 3 september 2013 12:23:20 UTC+2 schreef zdd...@gmail.com:

Vi Key

unread,
Jun 27, 2014, 5:28:17 AM6/27/14
to google-apis-e...@googlegroups.com
Problem is solved! Server products verifying not works with IABv2, use instead IABv3 in your applications! It gives you other, long purchase token, that accept by Google API.

Clyde Allen

unread,
Jul 27, 2014, 8:15:54 AM7/27/14
to google-apis-e...@googlegroups.com


在 2014年6月27日星期五UTC+8下午5时28分17秒,Vi Key写道:
Problem is solved! Server products verifying not works with IABv2, use instead IABv3 in your applications! It gives you other, long purchase token, that accept by Google API.

 No , IABv3 also have the problem , Why ?

GET https://www.googleapis.com/androidpublisher/v1.1/applications/xxx_package_name/inapp/xxx_productId/purchases/gmijkgoncbohqlddkbyhbgrg.6w2zSG1Oo_AyDU7U1KkpSKBOi4p_2GfYXaOdBygwkpL2zpS94haJit4D2VF6UvfT_Ga2BFXxUQWckmTYAmMCpbmGtpF0RJJj3Xyq-zIuYWbTi6W5LU4X_N0?key={YOUR_API_KEY}


{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "purchaseTokenDoesNotMatchProductId",
"message": "The purchase token does not match the product ID.",
"locationType": "parameter",
"location": "token"
}
],
"code": 400,
"message": "The purchase token does not match the product ID."
}
}


jason toulotte

unread,
Dec 9, 2014, 4:02:51 AM12/9/14
to google-apis-e...@googlegroups.com
Same problem, any solutions?

jason toulotte

unread,
Dec 9, 2014, 10:08:53 AM12/9/14
to google-apis-e...@googlegroups.com
... I used the subscriptionID instead of PurchaseToken

Irina Dinarieva

unread,
Jan 19, 2015, 6:37:10 AM1/19/15
to google-apis-e...@googlegroups.com
Hello, I have the same problem.
inapp purchase verify fails with { "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid Value", "reason" : "invalid" } ], "message" : "Invalid Value" }  while subscription purchase verifies with the same data. Purchase token has been obtained with IABv3.
The same error I can generate for  subscription purchase  if I send there wrong purchase token. But for the token with which subscription purchase works ok I still can't verify purchase.
Is there still no solution to this problem?


jason toulotte

unread,
Jan 19, 2015, 8:31:44 AM1/19/15
to google-apis-e...@googlegroups.com

what format is your purchase token ? The purchase token and purchaseID are similar
--
You received this message because you are subscribed to the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-explorer-users+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Irina Dinarieva

unread,
Jan 20, 2015, 7:57:16 AM1/20/15
to google-apis-e...@googlegroups.com
Here is example of my data (I just have changed package name a little).

Data for  AndroidPublisher.Purchases.Get subscriptionGet = purchases.get(googlePackageName, subscriptionId, purchaseToken);  is :
{packageName=net.mediaspectrum.replica, subscriptionId=m1b, token=nibjlnlmehbhoaeajdnjjfdh.AO-J1OxV7SkEJJJX34PAUVEoBwYeERf8vxuv36iylKgFTvX0_5qZboBWDkE2w3MLU9AXo0w5HtxzTXW_IjOLJRMVtv6QxLydcPLxwAK1iVxsBbRJzSGy38zAsy6nRCFbidw44ZXp_r9b}

Data for AndroidPublisher.Inapppurchases.Get productGet = inapppurchases.get(googlePackageName, purchaseId, purchaseToken); is :
{packageName=net.mediaspectrum.replica, productId=m1b, token=nibjlnlmehbhoaeajdnjjfdh.AO-J1OxV7SkEJJJX34PAUVEoBwYeERf8vxuv36iylKgFTvX0_5qZboBWDkE2w3MLU9AXo0w5HtxzTXW_IjOLJRMVtv6QxLydcPLxwAK1iVxsBbRJzSGy38zAsy6nRCFbidw44ZXp_r9b}

For subscriptionGet execute passes and for productGet execute fails. I use Java API but result I get is exactly as people describe in this topic.

понедельник, 19 января 2015 г., 16:31:44 UTC+3 пользователь jason toulotte написал:

jason toulotte

unread,
Jan 20, 2015, 8:11:00 AM1/20/15
to google-apis-e...@googlegroups.com
"For subscriptionGet execute passes and for productGet execute fails. I use Java API but result I get is exactly as people describe in this topic." => if your purchase is a subscription i think this is normal


--
You received this message because you are subscribed to the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-explore...@googlegroups.com.

Irina Dinarieva

unread,
Jan 20, 2015, 8:57:05 AM1/20/15
to google-apis-e...@googlegroups.com
What do you mean by "normal"? My purchase is an AutoRenewing subscription.  After execution subscriptionGet returns me two dates InitiationTimestampMsec and ValidUntilTimestampMsec. But it seems that InitiationTimestampMsec is a starting time of just the current subscription. I mean that if user has first subscribed say six month ago and then subscription has renewed some times then I will have date of only last one subscription. So I hoped to use AndroidPublisher.Inapppurchases.Get and that it would give me that first date six month ago. Is it not possible at all? Are you saying that only one of these two methods should work?

вторник, 20 января 2015 г., 16:11:00 UTC+3 пользователь jason toulotte написал:
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-explorer-users+unsub...@googlegroups.com.

jason toulotte

unread,
Jan 20, 2015, 9:22:44 AM1/20/15
to google-apis-e...@googlegroups.com
I said "normal" because AndroidPublisher.Inapppurchases.Get is only for purchase, not for subscription. 
SubscriptionGet give only the last subscription date, you should save the date of the first subscription if you need it.

To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-explore...@googlegroups.com.

Irina Dinarieva

unread,
Jan 20, 2015, 9:26:16 AM1/20/15
to google-apis-e...@googlegroups.com
O.....  That a surprise! Thanks a lot.

вторник, 20 января 2015 г., 17:22:44 UTC+3 пользователь jason toulotte написал:
I said "normal" because AndroidPublisher.Inapppurchases.Get is only for purchase, not for subscription. 
SubscriptionGet give only the last subscription date, you should save the date of the first subscription if you need it.

Le Tue Jan 20 2015 at 14:57:05, Irina Dinarieva <irina.d...@gmail.com> a écrit :
What do you mean by "normal"? My purchase is an AutoRenewing subscription.  After execution subscriptionGet returns me two dates InitiationTimestampMsec and ValidUntilTimestampMsec. But it seems that InitiationTimestampMsec is a starting time of just the current subscription. I mean that if user has first subscribed say six month ago and then subscription has renewed some times then I will have date of only last one subscription. So I hoped to use AndroidPublisher.Inapppurchases.Get and that it would give me that first date six month ago. Is it not possible at all? Are you saying that only one of these two methods should work?

вторник, 20 января 2015 г., 16:11:00 UTC+3 пользователь jason toulotte написал:
"For subscriptionGet execute passes and for productGet execute fails. I use Java API but result I get is exactly as people describe in this topic." => if your purchase is a subscription i think this is normal


Le Tue Jan 20 2015 at 13:57:16, Irina Dinarieva <irina.d...@gmail.com> a écrit :
Here is example of my data (I just have changed package name a little).

Data for  AndroidPublisher.Purchases.Get subscriptionGet = purchases.get(googlePackageName, subscriptionId, purchaseToken);  is :
{packageName=net.mediaspectrum.replica, subscriptionId=m1b, token=nibjlnlmehbhoaeajdnjjfdh.AO-J1OxV7SkEJJJX34PAUVEoBwYeERf8vxuv36iylKgFTvX0_5qZboBWDkE2w3MLU9AXo0w5HtxzTXW_IjOLJRMVtv6QxLydcPLxwAK1iVxsBbRJzSGy38zAsy6nRCFbidw44ZXp_r9b}

Data for AndroidPublisher.Inapppurchases.Get productGet = inapppurchases.get(googlePackageName, purchaseId, purchaseToken); is :
{packageName=net.mediaspectrum.replica, productId=m1b, token=nibjlnlmehbhoaeajdnjjfdh.AO-J1OxV7SkEJJJX34PAUVEoBwYeERf8vxuv36iylKgFTvX0_5qZboBWDkE2w3MLU9AXo0w5HtxzTXW_IjOLJRMVtv6QxLydcPLxwAK1iVxsBbRJzSGy38zAsy6nRCFbidw44ZXp_r9b}

For subscriptionGet execute passes and for productGet execute fails. I use Java API but result I get is exactly as people describe in this topic.

понедельник, 19 января 2015 г., 16:31:44 UTC+3 пользователь jason toulotte написал:

what format is your purchase token ? The purchase token and purchaseID are similar
Le Mon Jan 19 2015 at 12:37:12, Irina Dinarieva <irina.d...@gmail.com> a écrit :


--
You received this message because you are subscribed to the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-explorer-users+unsubsc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Irina Dinarieva

unread,
Jan 20, 2015, 11:49:24 AM1/20/15
to google-apis-e...@googlegroups.com
Still what seems strange to me. Actually I do save date of the first subscription. But what about the situation: say we have our customer who subscribed 6 months ago and subscription is AutoRenewing. She used the app for a while and then didn't switch her device on for a few months. Then she switches on again, the app calls the server (me) and I execute SubscriptionGet on the server and receive the dates from the last subscription from Google. So I have a hole in my data. I don't know what happened in that few months when I didn't receive any calls from her device. Did subscription last all that time or did she canceled it and then has subscribed again. So Google doesn't allow to see subscription "history" anyhow? If so then i consider it to be a flaw.

вторник, 20 января 2015 г., 17:22:44 UTC+3 пользователь jason toulotte написал:
I said "normal" because AndroidPublisher.Inapppurchases.Get is only for purchase, not for subscription. 
SubscriptionGet give only the last subscription date, you should save the date of the first subscription if you need it.

Le Tue Jan 20 2015 at 14:57:05, Irina Dinarieva <irina.d...@gmail.com> a écrit :
What do you mean by "normal"? My purchase is an AutoRenewing subscription.  After execution subscriptionGet returns me two dates InitiationTimestampMsec and ValidUntilTimestampMsec. But it seems that InitiationTimestampMsec is a starting time of just the current subscription. I mean that if user has first subscribed say six month ago and then subscription has renewed some times then I will have date of only last one subscription. So I hoped to use AndroidPublisher.Inapppurchases.Get and that it would give me that first date six month ago. Is it not possible at all? Are you saying that only one of these two methods should work?

вторник, 20 января 2015 г., 16:11:00 UTC+3 пользователь jason toulotte написал:
"For subscriptionGet execute passes and for productGet execute fails. I use Java API but result I get is exactly as people describe in this topic." => if your purchase is a subscription i think this is normal


Le Tue Jan 20 2015 at 13:57:16, Irina Dinarieva <irina.d...@gmail.com> a écrit :
Here is example of my data (I just have changed package name a little).

Data for  AndroidPublisher.Purchases.Get subscriptionGet = purchases.get(googlePackageName, subscriptionId, purchaseToken);  is :
{packageName=net.mediaspectrum.replica, subscriptionId=m1b, token=nibjlnlmehbhoaeajdnjjfdh.AO-J1OxV7SkEJJJX34PAUVEoBwYeERf8vxuv36iylKgFTvX0_5qZboBWDkE2w3MLU9AXo0w5HtxzTXW_IjOLJRMVtv6QxLydcPLxwAK1iVxsBbRJzSGy38zAsy6nRCFbidw44ZXp_r9b}

Data for AndroidPublisher.Inapppurchases.Get productGet = inapppurchases.get(googlePackageName, purchaseId, purchaseToken); is :
{packageName=net.mediaspectrum.replica, productId=m1b, token=nibjlnlmehbhoaeajdnjjfdh.AO-J1OxV7SkEJJJX34PAUVEoBwYeERf8vxuv36iylKgFTvX0_5qZboBWDkE2w3MLU9AXo0w5HtxzTXW_IjOLJRMVtv6QxLydcPLxwAK1iVxsBbRJzSGy38zAsy6nRCFbidw44ZXp_r9b}

For subscriptionGet execute passes and for productGet execute fails. I use Java API but result I get is exactly as people describe in this topic.

понедельник, 19 января 2015 г., 16:31:44 UTC+3 пользователь jason toulotte написал:

what format is your purchase token ? The purchase token and purchaseID are similar
Le Mon Jan 19 2015 at 12:37:12, Irina Dinarieva <irina.d...@gmail.com> a écrit :


--
You received this message because you are subscribed to the Google Groups "Google APIs Explorer Users Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apis-explorer-users+unsubsc...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Asim Pereira

unread,
Feb 25, 2015, 12:14:13 AM2/25/15
to google-apis-e...@googlegroups.com
Same problem here.
Noticed that for the purchases that fail verification, the token is shorter than the one that succeeds.
Failed : bejkisafehwyqgjmjwbucuww
Success : bijgpoogmdjifiagpdhfijok.AO-J1OwhWC7CAw-QD_Hi0yuLxFrN_obHLQmrczew2gb-YEuwVPmWJS8hq8UNKgBbfO4OpdGMWMWGt-A7uI0qUlUc1-Bvh8cX3NaWnHxdOWKKbomjP3HtSlrsh6UGgGtz8FVppZKXlahGu4KEdOT83Wc0dvtpJPpRVQ

Wonder if some devices with older Google Services are generating token which are no longer valid?
Hope somebody from Google will respond to this issue.
Till then its just lost revenue and frustrated users.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages