如何使用 cordova-plugin-purchase 获取本地化价格
How to get localized prices with cordova-plugin-purchase
在我使用 Cordova 创建的应用程序中,我想使用 IAP 并以当地货币显示价格。
为此我使用了这个插件:https://github.com/j3k0/cordova-plugin-purchase
关于我的文档:
When you perform the initial refresh() call, the store's server will be contacted to load informations about the registered products: human readable title and description, price, etc.
但是当我执行以下代码时,我得到了产品,但价格设置为 "null"
store.verbosity = store.DEBUG;
store.ready(function() {
store.refresh();
alert("Object:"+ store.get(PREMIUM_PACK_ID));
alert("Price:"+ store.get(PREMIUM_PACK_ID).price);
});
for (var i = 0; i < this.products.length; i++){
var params = this.products[i];
store.register({
id: params.id,
alias: params.label,
type: params.type || store.CONSUMABLE
});
}
store.refresh();
一些信息:
- 命令行界面 5.2
- Android 5
- 应用处于封闭 Beta 测试模式
- PREMIUM_PACK_ID === 商店中的产品 ID
- 刷新并准备好执行
- 尝试刷新一两次...
有人用这个插件成功获取 IAP 价格吗?
我在打开问题之前尝试 post 这里...
最后使用这个其他 IAP 插件:https://github.com/Wizcorp/phonegap-plugin-wizPurchase
适用于 IOS 和 Android。
在我使用 Cordova 创建的应用程序中,我想使用 IAP 并以当地货币显示价格。
为此我使用了这个插件:https://github.com/j3k0/cordova-plugin-purchase
关于我的文档:
When you perform the initial refresh() call, the store's server will be contacted to load informations about the registered products: human readable title and description, price, etc.
但是当我执行以下代码时,我得到了产品,但价格设置为 "null"
store.verbosity = store.DEBUG;
store.ready(function() {
store.refresh();
alert("Object:"+ store.get(PREMIUM_PACK_ID));
alert("Price:"+ store.get(PREMIUM_PACK_ID).price);
});
for (var i = 0; i < this.products.length; i++){
var params = this.products[i];
store.register({
id: params.id,
alias: params.label,
type: params.type || store.CONSUMABLE
});
}
store.refresh();
一些信息:
- 命令行界面 5.2
- Android 5
- 应用处于封闭 Beta 测试模式
- PREMIUM_PACK_ID === 商店中的产品 ID
- 刷新并准备好执行
- 尝试刷新一两次...
有人用这个插件成功获取 IAP 价格吗?
我在打开问题之前尝试 post 这里...
最后使用这个其他 IAP 插件:https://github.com/Wizcorp/phonegap-plugin-wizPurchase
适用于 IOS 和 Android。