应用内购买屏幕正在返回:
应用程序内屏幕的屏幕截图 https://i.stack.imgur.com/E5Qf1.png
错误是:
发生意外的错误。请稍后再试。解雇
正如你所看到的,其中一半也是黑色的。
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. payment.inapp.buy 包2016
当我关闭应用内支付屏幕时,会打印以下内容:
onPurchaseFailed 对象 {请求:对象,响应:对象}
购买失败。购买_取消
我给 Chrome 开发支持发送了电子邮件,他们说:
在 Chrome 网上应用店中,您不能购买自己的
应用程序/扩展。为了测试您的项目,您需要访问它
来自您拥有的不同帐户。 (不是来自您的开发者帐户)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)