Skip to content

PlatformException(storekit2_purchase_cancelled, This transaction has been cancelled by the user., Product ID : remove_ads, null) #169524

@dinyok

Description

@dinyok

What package does this bug report belong to?

in_app_purchase

What target platforms are you seeing this bug on?

iOS

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock
in_app_purchase:
    dependency: "direct main"
    description:
      name: in_app_purchase
      sha256: "5cddd7f463f3bddb1d37a72b95066e840d5822d66291331d7f8f05ce32c24b6c"
      url: "https://pub.dev"
    source: hosted
    version: "3.2.3"
  in_app_purchase_android:
    dependency: "direct main"
    description:
      name: in_app_purchase_android
      sha256: "475b6c6541b54e6878263270d291ca8d5d7ef044263115bdec45e1e59737e3ad"
      url: "https://pub.dev"
    source: hosted
    version: "0.4.0+1"
  in_app_purchase_platform_interface:
    dependency: transitive
    description:
      name: in_app_purchase_platform_interface
      sha256: "1d353d38251da5b9fea6635c0ebfc6bb17a2d28d0e86ea5e083bf64244f1fb4c"
      url: "https://pub.dev"
    source: hosted
    version: "1.4.0"
  in_app_purchase_storekit:
    dependency: "direct main"
    description:
      name: in_app_purchase_storekit
      sha256: "02f08d5688fc2776e3e386ff7d3071b7b375ea8222e8e6bd027b15c0708e4045"
      url: "https://pub.dev"
    source: hosted
    version: "0.4.0"

Steps to reproduce

After upgrading to in_app_purchase_storekit 0.4.0 which use StoreKit2 there is a PlatformException when closing native ios product page/canceling on non consumable product

  1. Press button to buy the non consumable product
  2. close the native ios product page

Expected results

there should be no PlatformException

Actual results

there is PlatformException

Code sample

Code sample

use the sample code

Screenshots or Videos

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
          Fatal Exception: FlutterError
0  ???                            0x0 InAppPurchase2API.purchase + 800 (sk2_pigeon.g.dart:800)
1  ???                            0x0 SK2Product.purchase + 375 (sk2_product_wrapper.dart:375)
2  ???                            0x0 InAppPurchaseStoreKitPlatform.buyNonConsumable + 108 (in_app_purchase_storekit_platform.dart:108)
3  ???                            0x0 _RemoveAdsDialogState.purchaseRemoveAds + 69 (remove_ads_dialog.dart:69)

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.32.0, on macOS 15.5 24F74 darwin-arm64, locale en-ID) [566ms]
    • Flutter version 3.32.0 on channel stable at /Users/dimasferdinand/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision be698c48a6 (8 days ago), 2025-05-19 12:59:14 -0700
    • Engine revision 1881800949
    • Dart version 3.8.0
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [2.3s]
    • Android SDK at /Users/dimasferdinand/Library/Android/sdk
    • Platform android-35, 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.6+-13368085-b895.109)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [1,482ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Android Studio (version 2024.3) [31ms]
    • 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.6+-13368085-b895.109)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.2) [30ms]
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

[✓] VS Code (version 1.100.2) [10ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.110.0

[✓] Connected device (2 available) [6.7s]
    • Dimas’s iPhone (mobile)          • 00008120-00044D303CD0C01E • ios • iOS 18.5 22F76
    • Dimas’s iPad (wireless) (mobile) • 00008110-000645090184801E • ios • iOS 18.5 22F76

[✓] Network resources [413ms]
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listfound in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: in_app_purchasePlugin for in-app purchasepackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions