-
-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Approved never fires after initiating the purchase #1568
Comments
I have the exact same issue on iOS Simulator. I tried following all the Apple's Sandbox testing instructions for setting up storekit configuration, sandbox account etc but nothing helps. The purchase flow is stuck in a loop unless i close the dialog in which case the purchase simply fails. The purchase handlers never get called. Android works perfectly on the emulator. |
ios simulator does not support this. you need to check this on a test device. |
Hi, |
same issue for me :( |
same here too |
Me too. Works as expected on Android using Android Studio and Simulator. iOS simulator with XCode does exactly what mustaqt said above. It asks for payment, accepts and says it is complete. Note, that no payment is made on the CC on file for the test account. Anyone solved this???? |
After quite a bit of testing and turning on store.verbosity = 4 for debug, it looks like it does send the order, but I'm guessing at this point that Apple isn't actually processing anything in simulator or test sandbox mode, so it never gets to the verify and receipt stage. It's my best guess at the moment. |
Can you spot any errors or useful logs in XCode? |
No errors in the logs, even on debug level logging. It just stops and never gets to the verify and receipt stage. It's like it never even tries to send the order to Apple Pay. |
Same issue |
I've had some users tell me it's was problem with their sandbox user account. Can you try logging out from AppStore sandbox from settings then login again? Can you try a different Test account (created from AppStore connect). This document can be interesting read: https://developer.apple.com/documentation/storekit/in-app_purchase/testing_in-app_purchases_with_sandbox |
I have the similar issue and started to read the code. I think the relevant transaction monitor is not initialised and therefore, the event is not being triggered. Example: the requestPayment call is initialising the relevant transaction monitor. However, the getOffer().order() has a monitor but it doesn't emit the relevant event:
Could this be the issue? |
|
here are the logs: 10.19.0 - [FirebaseMessaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. If you'd prefer to manually integrate Firebase Messaging, add "FirebaseAppDelegateProxyEnabled" to your Info.plist, and set it to NO. Follow the instructions at: [CdvPurchase.AppleAppStore.objc] load: Starting product request... ⚡️ [log] - LOGPREFIX - Subscription: ngOnInit is called To Native Cordova -> InAppPurchase purchase InAppPurchase1883072168 [CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: LOGPREFIX_1_MONTHLY_SUBSCRIPTION |
in my case, approved is emitted once only, at the app.component: |
Here is my code: `
/* ----------------------------- */ |
here is the purchase code: async purchaseViaCdvPurchasePlugin(item: number) {
} |
Seeing "Create CdvPurchase..." twice is an indication that the plugin is both "bundled" by the build chain and "loaded" by ionic. This used to create problem but should be fine since version 13.10.0 It looks like a bug with the "autoFinish" flag. A race condition happens with "finish" by the native SDK gets reported too quickly, before the handling of the "approved" event was done. The clue: PaymentTransactionStateFinished occured before Receipt Updated. I recommend you try without that flag until a fix is in place. |
Race condition occured when the "transactionFinished" call was made before the debounced "receiptUpdated" call was processed. This prevented the "approved" callback from being triggered.
There's an attempted fix in branch |
indeed, without the flag, I see the validator being called now. |
I'm not setting autoFinish option anywhere. Is it true by default? |
It's false by default. |
Race condition occured when the "transactionFinished" call was made before the debounced "receiptUpdated" call was processed. This prevented the "approved" callback from being triggered.
I've integrated version 13.10.0 of the cordova-plugin-purchase into my Ionic application. Additionally, I've set up a consumable product in the Apple App Store and created a dedicated sandbox user for testing purposes.
While I can successfully retrieve product details from the store and display them in the application template, I'm encountering an issue during the purchase process. After initiating the purchase, the popup appears prompting me to enter the sandbox user password, then the popup shows "done" and closes. However, approximately 10 seconds later, the purchase popup reappears. This repetitive behavior persists, occurring in a recurring manner.
The text was updated successfully, but these errors were encountered: