我正在尝试验证我的购买(现在消耗品)。因此,我正在开发小型服务器应用程序。我发现了这个git软件包 hms iap Server in Democofig
in Democofig 脚本需要2个变量
客户端,客户端。我从App Gallery Connect Connect仪表板从Project设置 - >应用程序信息中获得。
pruchasing后,我正在写下我的购买令牌,我得到了我inapperpurchasedata.purchasetoken。
我要求从服务器到IAP服务器。它总是返回:
"{\"responseCode\":\"6\",\"responseMessage\":\"Token is expired or invalid\"}"
购买工作正在用于沙箱(测试),我正在尝试达到: https:https:https:https:https: //orders-at-dre.iap.dbankcloud.com 。
我不清楚哪个令牌已过期或无效?访问令牌还是我的购买令牌?
I am trying to validate my purchases(for now consumables). For this reason i am developing small server app. I found out this git package hms iap server demo
In DemoCofig script has need 2 variable
ClientId, ClientSecret. I getted from app gallery connect dashboard from Project Settings->App Information.

After pruchasing i am writing the console my purchase token which i getted InAppPurchaseData.PurchaseToken.
and i am requesting from my server to IAP Server. It always returning:
"{\"responseCode\":\"6\",\"responseMessage\":\"Token is expired or invalid\"}"
Purchasing job is working on SandBox(Test), I am trying to reach : https://orders-at-dre.iap.dbankcloud.com.
I am not clearly understand which token is expired or invalid ? Access Token or my purchase token ?
发布评论
评论(1)
该接口提示令牌无效或已过期。通常,令牌是一个访问权限(有效期为1小时,很短)。购买的有效期为30天。 (也有可能到期的可能性,但它的可能性比前者小得多)。
可能的原因如下:
AT已过期。在这种情况下,需要再次获得AT(高概率)。
API for Obtaining an App-等级访问令牌
格式(中概率)
无效
请确保请求主体的格式在使用AT作为请求主体时正确。
根据请求标头指定身份验证信息。详细信息如下:
根据请求标头指定身份验证信息:
应用程序级访问令牌:授权:基本base64(appat:atvalue)
示例:app级访问令牌是
thisisappatValue
,然后appat:atvalue
isappat:thisisappatValue
。因此,在
base64(appat:atvalue)中替换
“ appat:thisisappatvalue” 生成值== 。appat:atvalue
in授权
在请求标头中的值如下:基本QVBQVQ6DGHPC0LZQXBWQXRWYWX1ZQ ==
有关详细信息,请检查。
puphaseToken与appid不符(低概率)。
站点请求错误(低概率)
您还可以参考,但它是中文,您可以翻译它。
This interface prompts that the token is invalid or expired. Generally, the token is an AccessToken (the validity period is 1 hour, AT for short). The validity period of the purchaseToken is 30 days. (There is also a possibility of expiration, but it is much less likely than the former).
The possible causes are as follows:
The AT has expired. In this case, the AT needs to be obtained again (high probability).
API for Obtaining an App-Level Access Token
Invalid AT format (medium probability)
Ensure that the format of the request body is correct when the AT is used as the request body.
The authentication information is specified based on the request header. The details are as follows:
Authentication information is specified based on the request header:
App-level access token: Authorization: Basic Base64(APPAT:atvalue)
Example: The app-level access token is
thisIsAppAtValue
, thenAPPAT:atvalue
isAPPAT:thisIsAppAtValue
.Therefore, replace
APPAT:atvalue
inBase64(APPAT:atvalue)
with"APPAT:thisIsAppAtValue"
to generate valueQVBQQVQ6dGhpc0lzQXBwQXRWYWx1ZQ==
.The value of
Authorization
in the request header is as follows:Basic QVBQQVQ6dGhpc0lzQXBwQXRWYWx1ZQ==
For details check this docs.
The purchaseToken does not match the appID (low probability).
Site request error (low probability)
You can also refer to this forum similar questions, but it is in Chinese, you can translate it.