谷歌Android出版商API与“410 purchaseTokenNoLongerValid”错误

问题描述:

在收到订购状态响应(https://developers.google.com/android-publisher/api-ref/purchases/subscriptions/get)API与谷歌Android出版商API与“410 purchaseTokenNoLongerValid”错误

{ 
    "error": { 
    "errors": [ 
     {  
     "domain": "androidpublisher",  
     "reason": "purchaseTokenNoLongerValid",  
     "message": "The purchase token is no longer valid." 
     } 
    ], 
    "code": 410, 
    "message": "The purchase token is no longer valid." 
    } 
} 

我找不到“purchaseTokenNoLongerValid”提及任何响应或“购买令牌没有在Android发布程序API的情况下,无论是在文档中还是在Google搜索中,“更有效”。

我能猜到这是什么错误意味着,但更好的确切地知道,反正,我应该与此错误后,认购呢?

看起来像当用户从谷歌帐户更改其密码或删除帐户购买令牌被撤销。然后这个错误将在每个请求中返回。

这里的原因的OAuth2令牌列表 - https://developers.google.com/identity/protocols/OAuth2#expiration,但我觉得这是完全一样的情况。

  • 用户已取消访问。
  • 令牌未使用六个月。
  • 用户更改密码,令牌包含Gmail作用域。
  • 用户帐户已超过一定数量的令牌请求。
+0

这不是OAuth2用户错误和令牌不涉及OAuth2令牌。 – Blago

+0

我没有说它是OAuth2令牌,我说它可以是“相同的情况”。 – ksimka

我认为谷歌刚刚更新了自己的API,并开始与响应状态代码410给未更新的很长一段时间(没有订阅续订)与购买令牌的请求。所以他们肯定100%认为用这种令牌的订阅不会被更新。

所以,这是一个好消息,因为现在你能检测出这种购买令牌,不把它们发送到验证可言,如果你以前做过。

我从谷歌官方回应Play支援小组关于此错误:

I took a look and the order ID you provided is associated with an account that has now been deleted. This is why it does not pass verification. This is a good example of the licensing system working as intended.

You may feel free to simply ignore this subscription.

而另一封电子邮件后,我询问更多细节:

Technically, the subscription is still active even though it's not attached to an account - hence, it does not show as cancelled. We're aware it's confusing not to receive a clear message about the account's status and just get an error back, though. This is an area of our product we're still actively working on.

What you can do is use the API to revoke the subscription, which is fine to do now that you have confirmation that the account is gone. Then it will read as cancelled and will no longer throw an error when making an API call.