检查Android购买状态,但未找到购买令牌 [英] Check android purchase status but return the purchase token was not found

查看:168
本文介绍了检查Android购买状态,但未找到购买令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我参考了 google play android api 来检查应用内商品的购买和消费状态。
对于某些订单,我可以得到正确的结果,但有些会返回错误,如下所示:

  error:{
错误:[
{
域:全球,
原因:purchaseTokenNotFound,
消息:未找到购买令牌,
locationType:参数,
位置:令牌
}
],
代码:404,
消息:未找到购买令牌。
}

购买令牌由google提供,是否可以伪造?



我发现如果我取消了谷歌订单,然后检查购买状态,它将返回未找到的购买标记。如果没有,我会得到正确的购买状态。



希望有人可以提供帮助。

解决方案<如果您在短时间内向同一用户多次销售相同的INAPP产品,那么很可能除最后一次购买外的所有访问令牌都将返回一个 404 代码。



例如:

john@example.com 已转到您的应用中购买 com.example.test.product 几次后,您可能会在您的记录(或Google电子钱包商家帐户)中通知您购买该产品的用户是同一用户。



当你去检查这个用户的最后一次购买时,可能会出现以下内容:

  {
kind:androidpublisher#inappPurchase,
purchaseTime:1409823171827,
purchaseState:0,
consumptionState:1,
developerPayload:我的产品|参考| 1409823162466

,但如果您要查看以前的代币,那么很可能他的购买将返回 404



我曾在某处(不记得在哪里)看到为每笔购买创建的购买凭证基本上都是基于inapp产品和Google用户。因此,每次购买很可能会销毁为同一用户创建的任何以前的购买令牌。



希望这个解释有帮助。每当我的服务器尝试连接到Google API并检查事务时,我每天都会遇到此问题。也许有一天有人会阅读并提供解决方案:)

I refered google play android api to check the purchase and consumption status of an in-app item. For some orders, I can get right result,but some return the error as below:

error: {
errors: [
{
domain: "global",
reason: "purchaseTokenNotFound",
message: "The purchase token was not found.",
locationType: "parameter",
location: "token"
}
],
code: 404,
message: "The purchase token was not found."
}

Purchase token is provided by google, does it can be faked?

I found if I cancel the google order, then check the purchase status,it will return the purchase token was not found. if not, i will get the right purchase status.

Hope somebody can help.

解决方案

If you are selling the same INAPP product to the same user muliple times within a short period, then it's very likely that all access tokens except the last purchase will return a 404 code.

For example:

john@example.com went to your app and purchased com.example.test.product a few times, you will probaly notice within your records (or Google Wallet Merchant account) that it's the same user buying the product.

When you go to check the last purchase from this user, then the following is likely to appear

{
kind: "androidpublisher#inappPurchase",
purchaseTime: "1409823171827",
purchaseState: "0",
consumptionState: "1",
developerPayload: "My Product | Ref | 1409823162466"
}

and yet if you were to check his previous tokens, then it's very likely that his purchases will return 404!

I had read somewhere (can't remember where) that the purchase token created for each purchase is basically based on the inapp product and google user. Therefore, it's very likely that each purchase will "destroy" any previous purchase token created for the same user.

Hope this explanation helps. I am constantly having this problem everyday when my server is attempting to connect to the Google API and check the transactions. Perhaps one day somebody will read this and provide a solution :)

这篇关于检查Android购买状态,但未找到购买令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆