Steps to reproduce
- Check out packages repo (for me, at commit 57725eb05e91ffe1ba645a216fa28bbcbe25ca31)
- Build and run example project (from Android studio) in an iOS simulator (for me, iPad Air 11-inch M2, iOS 18.2)
- Open XCode's StoreKit Test window
- Make non-consumable purchase
- Observe that the transaction is not finalized (
completePurchase is not called), and remains in an "unfinished" state
Expected results
Transactions should be completed normally.
Actual results
Transactions are left in an unfinished state (see screenshot below). This is an error as it breaks the StoreKit contract, which requires calling finish once a purchase has been delivered.
My concern is not limited to the example code or documentation: there appears to be a bug, either in the example code, or in the library, since the example app is the best documentation for intended use of the library, and that example does not appear to finalize transactions on iOS.
Code sample
This is reproducible in the in_app_purchase example app.
I will quickly document a bit of further debugging here, in case it is helpful.
Reverting to StoreKit 1 fixes this problem
If I clear state (delete any transactions, hot restart the app), I can "fix" the issue by reverting the example app to StoreKit1 as follows:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await InAppPurchaseStoreKitPlatform.enableStoreKit1();
runApp(_MyApp());
}
This is not future-proof, as StoreKit1 is deprecated, but suggests that the issue is isolated to StoreKit2.
StoreKit2 pendingCompletePurchase appears to be false incorrectly
To investigate the StoreKit2 issue, I updated _listenToPurchaseUpdated to print some debug information on transactions:
print(
"Got transaction ${purchaseDetails.productID}/${purchaseDetails.purchaseID}: "
"${purchaseDetails.status} (pending: ${purchaseDetails.pendingCompletePurchase})",
);
Then I see the following log, corresponding to a transaction left in an unfinished state:
flutter: Got transaction upgrade/3: PurchaseStatus.restored (pending: false)
Screenshots or Video
Logs
No response
Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.35.2, on macOS 15.7.2 24G325 darwin-arm64, locale en-US) [475ms]
• Flutter version 3.35.2 on channel stable at /Users/edpizzi/src/libraries/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 05db968908 (4 months ago), 2025-08-25 10:21:35 -0700
• Engine revision a8bfdfc394
• Dart version 3.9.0
• DevTools version 2.48.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop,
enable-android, enable-ios, cli-animations, enable-lldb-debugging
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [3.0s]
• Android SDK at /Users/edpizzi/Library/Android/sdk
• Emulator version 35.2.10.0 (build_id 12414864) (CL:N/A)
• Platform android-36, build-tools 35.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2) [1,569ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [111ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.2) [110ms]
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
[✓] IntelliJ IDEA Community Edition (version 2024.3.1.1) [109ms]
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 83.0.4
• Dart plugin version 243.23177
[✓] VS Code (version 1.96.2) [7ms]
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.102.0
[✓] Connected device (4 available) [6.2s]
• Edward's iPhone (wireless) (mobile) • 00008140-000C59801E8B001C • ios •
iOS 18.7.1 22H31
• iPad Air 11-inch (M2) (mobile) • 2BE6F5D4-F9BA-463B-B366-901B4974DB83 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-18-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 •
macOS 15.7.2 24G325 darwin-arm64
• Chrome (web) • chrome • web-javascript •
Google Chrome 143.0.7499.110
! Error: Browsing on the local area network for ed ipad. Ensure the device is unlocked and
attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources [468ms]
• All expected network resources are available.
• No issues found!
Steps to reproduce
completePurchaseis not called), and remains in an "unfinished" stateExpected results
Transactions should be completed normally.
Actual results
Transactions are left in an unfinished state (see screenshot below). This is an error as it breaks the StoreKit contract, which requires calling finish once a purchase has been delivered.
My concern is not limited to the example code or documentation: there appears to be a bug, either in the example code, or in the library, since the example app is the best documentation for intended use of the library, and that example does not appear to finalize transactions on iOS.
Code sample
This is reproducible in the in_app_purchase example app.
I will quickly document a bit of further debugging here, in case it is helpful.
Reverting to StoreKit 1 fixes this problem
If I clear state (delete any transactions, hot restart the app), I can "fix" the issue by reverting the example app to StoreKit1 as follows:
This is not future-proof, as StoreKit1 is deprecated, but suggests that the issue is isolated to StoreKit2.
StoreKit2 pendingCompletePurchase appears to be false incorrectly
To investigate the StoreKit2 issue, I updated
_listenToPurchaseUpdatedto print some debug information on transactions:Then I see the following log, corresponding to a transaction left in an unfinished state:
Screenshots or Video
Logs
No response
Flutter Doctor output
Doctor output