gpt4 book ai didi

google-chrome - 应用内购买不适用于 chrome 扩展

转载 作者:行者123 更新时间:2023-12-05 01:27:23 24 4
gpt4 key购买 nike

应用内购买屏幕正在返回:

Screenshot of In-App screen

错误是:

An unexpected error has occurred. Please try again later. Dismiss

如您所见,它的一半也是黑色的。

Buy.js:

  /*GOOGLE's CODE
...
*/



/*CODE FOR IN-APP PURCHASES*/


var prodButPrefix = "btnProdID-";
var statusDiv;

function init() {
console.log("App Init");
statusDiv = $("#status");
// getProductList();

}

$("#div1").click(function() {
checkIfBought("package2016");
});


/*****************************************************************************
* Get the list of purchased products from the Chrome Web Store
*****************************************************************************/
var purchased = false;
function getLicenses() {
console.log("google.payments.inapp.getPurchases");
console.log("Retreiving list of purchased products...");
google.payments.inapp.getPurchases({
'parameters': {env: "prod"},
'success': onLicenseUpdate,
'failure': onLicenseUpdateFailed
});
}

function checkIfBought(sku_init){
getLicenses();
function getLicenses() {
console.log("google.payments.inapp.getPurchases");
console.log("Retreiving list of purchased products...");
google.payments.inapp.getPurchases({
'parameters': {env: "prod"},
'success': onLicenseUpdate,
'failure': onLicenseUpdateFailed
});
}

function onLicenseUpdate(response) {
console.log("onLicenseUpdate", response);
var licenses = response.response.details;
var count = licenses.length;
for (var i = 0; i < count; i++) {
var license = licenses[i];
if(sku_init == licenses[i].response.details.sku){ //if purchased
purchased = true;
}
addLicenseDataToProduct(license);
}
console.log("");
}

function onLicenseUpdateFailed(response) {
console.log("onLicenseUpdateFailed", response);
console.log("Error retreiving list of purchased products.");
}

if(purchased == false){
buyProduct("package2016");
}
}



/*****************************************************************************
* Purchase an item
*****************************************************************************/


function buyProduct(sku) {
console.log("google.payments.inapp.buy", sku);
//var sku = "";
google.payments.inapp.buy({
'parameters': {'env': 'prod'},
'sku': sku,
'success': onPurchase,
'failure': onPurchaseFailed
});
}


function onPurchase(purchase) {
console.log("onPurchase", purchase);
var jwt = purchase.jwt;
var cartId = purchase.request.cardId;
var orderId = purchase.response.orderId;
console.log("Purchase completed. Order ID: " + orderId);
getLicenses();
}

function onPurchaseFailed(purchase) {
console.log("onPurchaseFailed", purchase);
var reason = purchase.response.errorType;
console.log("Purchase failed. " + reason);
}

这是在控制台中打印的内容:

google.payments.inapp.buy package2016

当我关闭应用内支付屏幕时,会打印出:

onPurchaseFailed Object {request: Object, response: Object} Purchase failed. PURCHASE_CANCELED

最佳答案

我给 Chrome 开发支持发了邮件,他们说:

In the Chrome Web Store, You are not allowed to purchase your own Apps/Extensions. In order to test your item, you need to access it from different account you have. (Not from your developer account).

关于google-chrome - 应用内购买不适用于 chrome 扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39923575/

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