我正在试验phonegap和应用程序购买。我在应用程序购买方面都是新手。
我正在使用这个插件:
https://www.npmjs.com/package/cc.fovea.cordova.purchase
基本上,我需要做的是创建一个简单的应用程序,它提供为期3天的免费试用,然后停止工作或发出错误或警告之类的东西(只是停止工作,阻止用户使用该应用程序),直到他们有了主动的自动更新订阅。
到目前为止,我发现的每一个信息和教程都是关于消耗品和非消费品的。
我需要学习的是auto-renewing subscription purchase。
我按照本指南在itunes连接帐户中创建了一个产品:
https://github.com/j3k0/cordova-plugin-purchase/wiki/HOWTO#create-ios-applications
我在我的Phonegap项目中添加了以下代码:
// We must wait for the "deviceready" event to fire
// before we can use the store object.
document.addEventListener('deviceready', initializeStore, false);
function initializeStore() {
// Let's set a pretty high verbosity level, so that we see a lot of stuff
// in the console (reassuring us that something is happening).
store.verbosity = store.INFO;
// We register a dummy product. It's ok, it shouldn't
// prevent the store "ready" event from firing.
store.register({
id: "XXXXXXX",
alias: "Upgrade Membership",
type: store.PAID_SUBSCRIPTION
});
// When every goes as expected, it's time to celebrate!
// The "ready" event should be welcomed with music and fireworks,
// go ask your boss about it! (just in case)
store.ready(function() {
console.log("\\o/ STORE READY \\o/");
alert('\\o/ STORE READY \\o/');
});
// After we've done our setup, we tell the store to do
// it's first refresh. Nothing will happen if we do not call store.refresh()
store.refresh();
}现在,我要问的问题是:
type: store.PAID_SUBSCRIPTION用于自动续订吗?id: "XXXXXXX",是我的应用程序包ID还是itunes中显示的产品ID?任何帮助都将不胜感激。
发布于 2017-04-10 12:56:35
1)我是否需要具体检查用户是否有活动订阅?还是苹果会自动为我这么做?
-以store.get(productId)的形式提出请求,并检查产品的状态,以查看用户是否已经订阅。
( 3)类型: store.PAID_SUBSCRIPTION用于自动续订吗?
-是的,这是正确的
( 4)是id:"XXXXXXX",我的应用程序包ID,还是显示在iTunes连接中的产品ID?
-不,这不是ID,使用ProductID
https://stackoverflow.com/questions/43004320
复制相似问题