gpt4 book ai didi

javascript - 谷歌浏览器 : payments API returns purchase failed while transaction is successful

转载 作者:行者123 更新时间:2023-11-27 22:51:12 24 4
gpt4 key购买 nike

我正在 Chrome 扩展程序内使用付款 API 进行应用内购买。

我能够发起购买,该购买会起作用并激活交易,但回调会转到 onPurchaseFailed 而不是 onPurchase。

list :

"offline_enabled": true,
"name": "__MSG_name__",
"description": "__MSG_description__",
"manifest_version": 2,
"version": "1.1.2",
"default_locale": "en",
"icons": {
"128": "style/128_on.png"
},
"background": {
"persistent": true,
"scripts": [ "js/jquery.min.js","js/bg.js" ]
},
"browser_action": {
"default_title": "__MSG_name__",
"default_icon": "style/128_off.png",
"default_popup": "popup.html"
},
"key": "...",
"oauth2": {
"client_id": "...",
"scopes": [ "https://www.googleapis.com/auth/chromewebstore.readonly" ]
},
"permissions": [ "*://*/*", "activeTab", "tabCapture", "tabs" ]

API购买方式:

google.payments.inapp.buy({
parameters: {'env': "prod"},
'sku': sku,
'success': onPurchase,
'failure': onPurchaseFailed
});

我得到:

onPurchaseFailed Object{
checkoutOrderId:"10370910..."
response:Object{
errorType:"PURCHASE_CANCELED"}
}

但是许可证被激活:

google.payments.inapp.getPurchases({
'parameters': {'env': 'prod'},
'success': onLicenseUpdate,
'failure': onLicenseUpdateFail
});

返回:

createdTime: //some number
itemId: //some string
kind:"chromewebstore#payment"
sku: //some string
state:"ACTIVE"

我怀疑发生这种情况是因为购买窗口在关闭时发送了取消消息,从而触发了 onPurchaseFailed 回调。如何处理这个问题?

最佳答案

我发现的唯一方法是在失败回调中检查付款

关于javascript - 谷歌浏览器 : payments API returns purchase failed while transaction is successful,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38043180/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com