j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

iOS purchase popup trigger multiple times #1525

Open selcukbeyhan opened 2 months ago

selcukbeyhan commented 2 months ago

Observed behavior

The CdvPurchase.store.when().receiptUpdated is called continuously and CdvPurchase.store.when().approved never called.

Include logs with CdvPurchase.store.verbosity = CdvPurchase.LogLevel.DEBUG ⚡️ [log] - [CdvPurchase] INFO: order(MYAPP_1_MONTHLY_SUBSCRIPTION) To Native Cordova -> InAppPurchase purchase InAppPurchase1121316625 ⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: order ["options": [MYAPP_1_MONTHLY_SUBSCRIPTION, 1, , { }]] [CdvPurchase.AppleAppStore.objc] purchase: About to do IAP [CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: MYAPP_1_MONTHLY_SUBSCRIPTION [CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: Purchasing... [CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: State: PaymentTransactionStatePurchasing [CdvPurchase.AppleAppStore.objc] processTransactionUpdate:withArgs: transactionIdentifier= ⚡️ [log] - [CdvPurchase.AppleAppStore.Bridge] DEBUG: Purchase enqueued MYAPP_1_MONTHLY_SUBSCRIPTION ⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: purchaseEnqueued: MYAPP_1_MONTHLY_SUBSCRIPTION - 1 ⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: order.success ⚡️ [log] - [CdvPurchase.AdapterListener] DEBUG: receiptsUpdated: [{"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"initiated","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"}] ⚡️ [log] - [CdvPurchase.AppleAppStore.Bridge] DEBUG: transaction updated: state:PaymentTransactionStatePurchasing product:MYAPP_1_MONTHLY_SUBSCRIPTION ⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: purchasing: MYAPP_1_MONTHLY_SUBSCRIPTION ⚡️ [log] - [CdvPurchase.AdapterListener] DEBUG: receiptsUpdated: [{"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"initiated","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"}] ⚡️ [log] - [CdvPurchase] DEBUG: Calling callback: type=receiptUpdated() name=#1558798c200b4c113a056b073e8523df reason=adapterListener_receiptsUpdated ⚡️ [log] - MYAPP Receipt is updated ⚡️ [log] - [CdvPurchase] INFO: verify(Receipt) ⚡️ [log] - [CdvPurchase.Validator] DEBUG: Schedule validation: {"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"initiated","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"} ⚡️ [log] - [CdvPurchase.Validator] DEBUG: Validation requests=2 responses=1 ⚡️ [log] - [CdvPurchase] INFO: finish(Receipt) ⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: finish(virtual.MYAPP_1_MONTHLY_SUBSCRIPTION) ⚡️ [log] - [CdvPurchase.AdapterListener] DEBUG: receiptsUpdated: [{"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"finished","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"}] ⚡️ [log] - [CdvPurchase] DEBUG: Calling callback: type=receiptUpdated() name=#1558798c200b4c113a056b073e8523df reason=adapterListener_receiptsUpdated ⚡️ [log] - MYAPP Receipt is updated ⚡️ [log] - [CdvPurchase] INFO: verify(Receipt) ⚡️ [log] - [CdvPurchase.Validator] DEBUG: Schedule validation: {"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"finished","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"} ⚡️ [log] - [CdvPurchase] INFO: finish(Receipt) ⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: finish(virtual.MYAPP_1_MONTHLY_SUBSCRIPTION) ⚡️ [log] - [CdvPurchase.AdapterListener] DEBUG: receiptsUpdated: [{"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"finished","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"}] ⚡️ [log] - [CdvPurchase] DEBUG: Calling callback: type=receiptUpdated() name=#1558798c200b4c113a056b073e8523df reason=adapterListener_receiptsUpdated ⚡️ [log] - MYAPP Receipt is updated ⚡️ [log] - [CdvPurchase] INFO: verify(Receipt) ⚡️ [log] - [CdvPurchase.Validator] DEBUG: Schedule validation: {"className":"Receipt","transactions":[{"className":"Transaction","transactionId":"virtual.MYAPP_1_MONTHLY_SUBSCRIPTION","state":"finished","products":[{"id":"MYAPP_1_MONTHLY_SUBSCRIPTION"}],"platform":"ios-appstore"}],"platform":"ios-appstore"} ⚡️ [log] - [CdvPurchase] INFO: finish(Receipt)

Expected behavior

I would assume that when the user confirms the subscription on the device, the method "CdvPurchase.store.when().approved" should be called. However, it is never called and the method "CdvPurchase.store.when().receiptUpdated" is called continuously. The app continuously asks for confirmation of purchase.

This seems to be similar to the issue #1513 but the suggestion about the storekit file didnt work neither. There is no such instruction in the documentation.