【问题标题】:“The item that you requested is not available for purchase” Error in my ionic android app“您要求的商品不可购买”我的 ionic android 应用程序中的错误
【发布时间】:2016-08-24 11:12:06
【问题描述】:

我正在尝试将应用内购买与 (cordova plugin add cordova-plugin-inapppurchase) 集成到我的应用中,但不幸的是遇到了这个恼人的错误“您请求的项目不可购买”。 我已经完成了所有这些:

1.Apk 签名发布,在开发者控制台和设备上的版本相同,在开发者控制台上列出的用于测试的帐户相同,与我的不一样。

2.产品在开发者控制台上处于活动状态。

但它仍然显示无法购买。

【问题讨论】:

    标签: android cordova ionic-framework in-app-purchase


    【解决方案1】:

    *****添加 Android 计费密钥***

    您的应用内结算许可证密钥应手动添加到您的项目中。此密钥可在 Google Play 开发者控制台的服务和 API 中找到。

    许可证密钥在安装过程中设置:

    cordova plugin add cc.fovea.cordova.purchase --variable BILLING_KEY="MIIB...AQAB"
    
    Replace MIIB...AQAB with your own android license key.
    

    要更改它,请删除插件并使用新密钥将其重新添加。**

    在 Android 上创建新产品

    从开发者控制台添加应用内购买项目 激活它们 无需发布应用程序。 购买类型:

    对于消耗性、非消耗性和非续订订阅,请选择“托管”。 对于免费和付费订阅,请选择“订阅”。

    【讨论】:

    【解决方案2】:

    这是控制器,它正确获取商品详细信息价格,但是当我购买任何商品时,它会给出错误(您要求的商品不可购买)

    var productIds = ['com.ionicframework.****7.productone','com.ionicframework.***7.producttwo']; // var spinner = '
    ';

    $scope.loadProducts = function () { $ionicLoading.show({ template: spinner + 'Loading Products...' }); 在应用程序内购买 .getProducts(productIds) .then(函数(产品){ $ionicLoading.hide(); $scope.products = 产品; }) .catch(函数(错误){ $ionicLoading.hide(); 控制台日志(错误); }); };

    $scope.buy = function (productId) {

    $ionicLoading.show({ template: spinner + 'Purchasing...' });
    inAppPurchase
      .buy(productId)
      .then(function (data) {
        console.log(JSON.stringify(data));
        console.log('consuming transactionId: ' + data.transactionId);
        return inAppPurchase.consume(data.type, data.receipt, data.signature);
      })
      .then(function () {
        var alertPopup = $ionicPopup.alert({
          title: 'Purchase was successful!',
          template: 'Check your console log for the transaction data'
        });
        alert('consume done!');
        $ionicLoading.hide();
      })
      .catch(function (err) {
        $ionicLoading.hide();
     [enter image description here][1]
        $ionicPopup.alert({
          title: 'Something went wrong',
          template: JSON.stringify(err)
        });
      });
    

    };

    $scope.restore = 函数 () { $ionicLoading.show({ template: spinner + '恢复购买...' }); 在应用程序内购买 。恢复购买() .then(函数(购买){ $ionicLoading.hide();

        $ionicPopup.alert({
          title: 'Restore was successful!',
          template: 'Check your console log for the restored purchases data'
        });
      })
      .catch(function (err) {
        $ionicLoading.hide();
        $ionicPopup.alert({
          title: 'Something went wrong',
          template: JSON.stringify(err)
        });
      });
    

    };

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-18
      • 1970-01-01
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多