Closed ragulbit closed 3 months ago
I seem to have the exact same issue, just with a subscription. Can you verify that there is no debug output at all from the plugin when you finish the storekit popup, and no events are triggered either?
Yes, there is no debug output generated by the plugin, and no events are being triggered upon the completion of the purchase. The StoreKit popup displays "done," closes momentarily, but after some time, it reappears. But, if I manually close the StoreKit popup without purchase, debug output is then generated.
[CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: sample_consumable_product_01
[CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: Error ERR_PAYMENT_CANCELLED - The operation couldn’t be completed. (SKErrorDomain error 2.)
[CdvPurchase.AppleAppStore.objc] paymentQueue:updatedTransactions: State: PaymentTransactionStateFailed
[CdvPurchase.AppleAppStore.objc] processTransactionUpdate:withArgs: transactionIdentifier=
⚡️ [log] - [CdvPurchase.AppleAppStore.Bridge] DEBUG: transaction updated: state:PaymentTransactionStateFailed product:sample_consumable_product_01
⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: purchaseFailed: sample_consumable_product_01 - 6777006 - The operation couldn’t be completed. (SKErrorDomain error 2.)
⚡️ [log] - [CdvPurchase.AdapterListener] DEBUG: receiptsUpdated: [{"className":"Receipt","transactions":[],"platform":"ios-appstore"}]
⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: order.paymentMonitor => failed
⚡️ [error] - [CdvPurchase.AppleAppStore] ERROR: ERROR: 6777006 - The operation couldn’t be completed. (SKErrorDomain error 2.)
⚡️ [error] - [CdvPurchase.AppleAppStore] ERROR: error@user-script:21:268:32
error@user-script:21:2768:43
protectCall@user-script:21:3295:35
transactionUpdated@user-script:21:3586:40
@capacitor://localhost/purchase:1:107
@user-script:18:1133:13
@user-script:18:1157:52
global code@capacitor://localhost/purchase:1:55
⚡️ [log] - [CdvPurchase.AppleAppStore] INFO: order.paymentMonitor => cancelled
⚡️ [log] - [CdvPurchase] DEBUG: Calling callback: type=receiptUpdated() name=#d3b2adbbd920494790ac72920cc1d18a reason=adapterListener_receiptsUpdated
I have also stumbled upon the same issue. Tried with v11, v13.8.6 and v13.10.0 without luck.
@rohithmahesh3 @ragulbit what are your test environments? Are you testing on simulator or on physical devices? Which IOS Version? Are you using xcode supplied storekit configurations/products or appstore connect supplied ones? Capacitor/Cordova/Ionic?
I'm using ios 17.2.1 on simulator, and I have the product configured both in xcode and appstore connect, and I'm on an ionic capacitor project.
@rohithmahesh3 it's weird that the problem persists to version 11 - did you do ionic cap sync (if you're on capacitor)?
@elpollodiablo I'm using iOS 17.2 on simulator. It is working fine on the physical devices. Need to check the same with Google Play Store IAP
Based on the logs, the plugin doesn't seem to make multiple calls to the underlying SDK to initiate the purchase again, so that looks more like an issue with Apple StoreKit SDK itself. I always find it better to test with products defined on AppStore Connect on a real device, or right on the Mac (designed for iPad).
Had the same problem when testing on the simulator. Defining the product in XCode with the storekit file fixed it.
Had the same problem when testing on the simulator. Defining the product in XCode with the storekit file fixed it.
This fix worked for me.
I have the same issue. I created the storekit file as well but it didnt help. Besides, I dont see any relation to this file neither. There is no such instruction in the documentation neither.
@selcukbeyhan Did you find a solution to this?
Not sure if related, but...
I've configured the App scheme to use the local storekit file with locally defined products, but the simulator keeps showing the product prices defined in the App Store Connect and asking me to sign in to the App Store.
The storekit should not ask for login so I'm assuming the simulator is not using the correct storekit definition.
Anyone know how to debug this?
I'm launching the app using the "cap run ios" command instead of Xcode. Even if I modify the path for "StoreKitConfigurationFileReference" to non-existing file, the app still launches and gives me the products from App Store Connect, so it seems the file is not read at all.
@JanST123 Did you do anything else? For me defining the storekit file (with either App Store Connect or locally defined products) does not seem to have any effect.
@mvaljento testing on simulator simply isn't supported for applications using storekit. Not with this plugin, not with another, not natively.
@elpollodiablo That's strange. Maybe I'm not understanding. According to Apple's documentation it definitely is possible to test in-app purchases natively using the simulator. Even according to messages in this thread it should be possible. Doesn't the plugin use the native libraries under the hood?
https://www.swiftwithvincent.com/blog/how-to-easily-test-in-app-purchases
@mvaljento oh. well, while I believe I read it somewhere on developer.apple.com too, my (rather recent, few months ago) experience with this particular plugin is, that the above described problem i had while testing on the simulator (i believe i wasn't getting a callback/receipt after a purchase) went away when I tested on a physical device with the same code. I also used/tried to use a storekit file.
I then went on to use glassfy (sadly, because this plugin is a massive, massive pain in the a... to use, and involves WAY too much boilerplate work), and glassfy documentation also clearly states it's capacitor plugin will test on physical devices only.
@JanST123 Did you do anything else? For me defining the storekit file (with either App Store Connect or locally defined products) does not seem to have any effect.
@mvaljento You may need to select the storekit configuration in the Run-Configuration in Xcode (click on the App in the breadcrumb and "Edit scheme" -> Run -> Options -> Storekit configuration
@JanST123 Thanks very much for the reply. Yes, I did that and I checked that the App.xcscheme file correctly reflects that change (see "localTest.storekit" in the snippet below). However, even if I edit the filename to point to non-existent path, it still runs the app without errors. To me it seems, that the StoreKitConfigurationFileReference is never read. If you got it working, would you be kind enough to post your working scheme configuration?
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "..."
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:App.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "..."
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:App.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<StoreKitConfigurationFileReference
identifier = "../localTest.storekit">
</StoreKitConfigurationFileReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "..."
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:App.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@mvaljento Yes you can have it :) But I don't see anything special about my configuration.. unfortunately I can't remember all the details as the project is finished since some months.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "xxx"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:App.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "xxx"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:App.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<StoreKitConfigurationFileReference
identifier = "../SyncedProducts.storekit">
</StoreKitConfigurationFileReference>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "504EC3031FED79650016851F"
BuildableName = "App.app"
BlueprintName = "App"
ReferencedContainer = "container:App.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
I've integrated version
13.10.0
of thecordova-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.
Below are my logs in the Xcode.
What did I miss? I need to get the transaction details and send them to the backend through API for validation and future reference. How Can I achieve this?
I really appreciate any help you can provide.