vs2017未找到匹配令牌怎么回事_检查Android购买状态,但未找到购买令牌

在使用谷歌Play商店API检查应用内购买状态时遇到问题,部分订单返回'purchaseTokenNotFound'错误。当取消订单后,检查会找不到购买令牌。原因可能是短时间内同一用户多次购买同一产品,导致旧的购买令牌失效。解决方案是关注最近一次的购买记录,因为每次购买可能会覆盖之前的令牌。希望此解释能帮助到遇到同样问题的人。
摘要由CSDN通过智能技术生成

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 :)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值