Open Macfa opened 3 years ago
add index.html header section
<meta http-equiv="Content-Security-Policy" content="default-src * 'self' 'unsafe-inline' 'unsafe-eval'; connect-src * https://validator.fovea.cc; style-src * 'self' 'unsafe-inline'; media-src *">
I think this is related to https://github.com/j3k0/cordova-plugin-purchase/issues/995
You'd want to check if the window.store.ready()
becomes true
at all. I think the problem is that at some point Apple added a new product type, which is not recognized by cordova-non-renewing-subscription
and thus the product is finished too early, see p.finish()
:
A possible fix may be to check the type before finishing. I didn't test this thoroughly.
if (!nrProduct) {
if (p.type !== window.store.APPLICATION) {
p.finish();
}
return;
}
@jussihuotari I put your code into my project then, works Thanks
@jussihuotari worked like a charm
hi I build a subscription using cordova I've following your code ( https://github.com/j3k0/cordova-non-renewing-subscription ) click a manage your subscription button and "subscribe now!" it show 2 items what i registerd and I choose 1 item show "loading.." popup and that's all I read document again but I don't know what do i do.. would you help me what i wrong ?
index.html
`function OpenInAppPurchase() { // Create some dummy HTML page (for testing). // Your content, somewhere, has a "Manage Subscription" button, right? document.getElementById('DivPageClassRegisterPurchaseHTML').innerHTML = '
Manage your subscription
';}`
app_init.js
`var app = { initialize: function() { document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); document.addEventListener("resume", onDviceResume, false); }, onDeviceReady: function() {
here error code
`2021-01-14 22:40:50.851170+0900 testapp[22283:1393277] InAppPurchase[objc]: processPendingTransactionUpdates 2021-01-14 22:40:51.026580+0900 testapp[22283:1393102] InAppPurchase[js]: load ok: { valid:[{"id":"kr.test.testapp.1month","description":null,"introPrice":null,"introPricePaymentMode":null,"billingPeriodUnit":"Day","countryCode":"KR","introPricePeriodUnit":null,"discounts":[],"title":null,"price":"₩79,000","billingPeriod":0,"group":null,"priceMicros":79000000000,"currency":"KRW","introPricePeriod":null,"introPriceMicros":null},{"id":"kr.test.testapp.3month","description":" 화상수업을 3달 간 받을 수 있는 자동갱신이 안되는 아이템입니다","introPrice":null,"introPricePaymentMode":null,"billingPeriodUnit":"Day","countryCode":"KR","introPricePeriodUnit":null,"discounts":[],"title":" 화상수업 3달 구독","price":"₩249,000","billingPeriod":0,"group":null,"priceMicros":249000000000,"currency":"KRW","introPricePeriod":null,"introPriceMicros":null}] invalid:[] } 2021-01-14 22:40:51.047957+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> products loaded 2021-01-14 22:40:51.061813+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp.1month (registered) 2021-01-14 22:40:51.064330+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp.3month (registered) 2021-01-14 22:40:51.069204+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> product kr.test.testapp.1month is valid (kr.test.testapp.1month) 2021-01-14 22:40:51.072093+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> owned? false 2021-01-14 22:40:51.073343+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp.1month -> valid 2021-01-14 22:40:51.073509+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp.1month (valid) 2021-01-14 22:40:51.074844+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp.1month (valid) 2021-01-14 22:40:51.075809+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> product kr.test.testapp.3month is valid (kr.test.testapp.3month) 2021-01-14 22:40:51.077705+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> owned? false 2021-01-14 22:40:51.079157+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp.3month -> valid 2021-01-14 22:40:51.083768+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp.3month (valid) 2021-01-14 22:40:51.087552+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp.3month (valid) 2021-01-14 22:40:51.104059+0900 testapp[22283:1393102] ERROR Internal navigation rejected - not set for url='about:blank'
2021-01-14 22:40:51.269709+0900 testapp[22283:1393102] [store.js] DEBUG: update()
2021-01-14 22:40:51.270683+0900 testapp[22283:1393102] InAppPurchase[js]: loading appStoreReceipt
2021-01-14 22:40:51.271258+0900 testapp[22283:1393102] InAppPurchase[objc]: appStoreReceipt:
2021-01-14 22:40:51.302391+0900 testapp[22283:1393102] InAppPurchase[js]: infoPlist: kr.test.testapp,1.5.9,22642688,????
2021-01-14 22:40:51.304287+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp ->
2021-01-14 22:40:51.304498+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> registered
2021-01-14 22:40:51.304595+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> product kr.test.testapp registered and owned
2021-01-14 22:40:51.304684+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (registered)
2021-01-14 22:40:51.304807+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (registered)
2021-01-14 22:40:51.304895+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> approved
2021-01-14 22:40:51.304975+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (approved)
2021-01-14 22:40:51.305141+0900 testapp[22283:1393102] [store.js] DEBUG: product -> defer finishing kr.test.testapp
2021-01-14 22:40:51.305567+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> approved
2021-01-14 22:40:51.305678+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (approved)
2021-01-14 22:40:51.305788+0900 testapp[22283:1393102] [store.js] DEBUG: product -> defer finishing kr.test.testapp
2021-01-14 22:40:51.307061+0900 testapp[22283:1393102] [store.js] DEBUG: product -> finishing kr.test.testapp
2021-01-14 22:40:51.307191+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> finished
2021-01-14 22:40:51.307282+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> finishing kr.test.testapp (a application)
2021-01-14 22:40:51.307478+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> owned
2021-01-14 22:40:51.308823+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (owned)
2021-01-14 22:40:51.309712+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (owned)
2021-01-14 22:40:51.309839+0900 testapp[22283:1393102] [store.js] DEBUG: product -> finishing kr.test.testapp
2021-01-14 22:40:51.310883+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> finished
2021-01-14 22:40:51.311908+0900 testapp[22283:1393102] [store.js] DEBUG: ios -> finishing kr.test.testapp (a application)
2021-01-14 22:40:51.313475+0900 testapp[22283:1393102] [store.js] DEBUG: state: kr.test.testapp -> owned
2021-01-14 22:40:51.314637+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (owned)
2021-01-14 22:40:51.314850+0900 testapp[22283:1393102] [nonRenewing.js] Product updated: kr.test.testapp (owned)
2021-01-14 22:40:55.768700+0900 testapp[22283:1393102] The preference key "AutoHideSplashScreen" is not defined and will default to "TRUE" 2021-01-14 22:41:01.541928+0900 testapp[22283:1393102] showMainScreen -> openSubscriptionManager 2021-01-14 22:41:03.016516+0900 testapp[22283:1393102] [nonRenewing.js] Event renew 2021-01-14 22:41:04.473551+0900 testapp[22283:1393102] [nonRenewing.js] Event buy-1 2021-01-14 22:41:04.473886+0900 testapp[22283:1393102] [nonRenewing.js] Purchase product at index 1`