Skip to content

Conversation

@LongCatIsLooong
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong commented Jul 15, 2025

Fixes flutter/flutter#169524

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

message: "This transaction has been cancelled by the user.",
details: "Product ID : \(id)")))
sendTransactionUpdate(
transaction: verification.unsafePayloadValue, receipt: verification.jwsRepresentation)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the documentation unsafe seems to mean that the transaction is potentially unverified.

@stuartmorgan-g
Copy link
Collaborator

/gemini review

@stuartmorgan-g
Copy link
Collaborator

(Don't mind me, just testing out the newly enabled review bot on some of our open PRs to see how it does 🙂)

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the in_app_purchase_storekit plugin to handle pending, cancelled, and unverified transactions without throwing PigeonErrors. It introduces a new unverified case to the SK2ProductPurchaseResult enum and updates the StoreKit2 implementation to return the corresponding SK2ProductPurchaseResult in these scenarios.

Comment on lines 418 to 420
static Future<bool> isIntroductoryOfferEligible(String productId) async {
final bool result = await _hostApi.isIntroductoryOfferEligible(productId);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This function can be simplified for improved conciseness. The intermediate result variable is unnecessary; the Future from the _hostApi call can be returned directly using Dart's arrow syntax (=>).

  static Future<bool> isIntroductoryOfferEligible(String productId) =>
      _hostApi.isIntroductoryOfferEligible(productId);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the style guide might be wrong now that we use dart format.

@stuartmorgan-g stuartmorgan-g added the triage-ios Should be looked at in iOS triage label Aug 19, 2025
@hellohuanlin
Copy link
Contributor

hellohuanlin commented Aug 21, 2025

cc @LongCatIsLooong for the next step from triage meeting.

@dogukangulyasar

This comment was marked as spam.

@okorohelijah
Copy link
Contributor

cc @LouiseHsu from triage meeting

Copy link
Contributor

@LouiseHsu LouiseHsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 👀

@LongCatIsLooong LongCatIsLooong added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 29, 2025
@auto-submit auto-submit bot merged commit c7a25fa into flutter:main Sep 29, 2025
80 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 30, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Sep 30, 2025
flutter/packages@34eec78...287739d

2025-09-29 [email protected] Roll Flutter (stable) from
d693b4b to ac4e799 (4 revisions) (flutter/packages#10124)
2025-09-29 [email protected] Fix CODEOWNERS error
(flutter/packages#10127)
2025-09-29 [email protected] [file_selector] Update Pigeon in
Android implementation (flutter/packages#10126)
2025-09-29 [email protected]
[In_app_purchase_storekit] Do not throw PigeonError when a transaction
is pending / cancelled / unverified (flutter/packages#9627)
2025-09-29 [email protected] [video_player] Separate texture ID on
Android (flutter/packages#10029)
2025-09-29 [email protected] Roll Flutter from
6cc976e to 96fe3b3 (32 revisions) (flutter/packages#10125)
2025-09-29 [email protected]
[camera_android_camerax] Fix NV21 Format (flutter/packages#10022)
2025-09-29 [email protected] Manual roll Flutter from
b1a28bc to 6cc976e (4 revisions) (flutter/packages#10116)
2025-09-29 [email protected] [camera_avfoundation]
Implementation swift migration - part 13 (flutter/packages#9930)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
okorohelijah pushed a commit to okorohelijah/flutter that referenced this pull request Oct 7, 2025
flutter/packages@34eec78...287739d

2025-09-29 [email protected] Roll Flutter (stable) from
d693b4b to ac4e799 (4 revisions) (flutter/packages#10124)
2025-09-29 [email protected] Fix CODEOWNERS error
(flutter/packages#10127)
2025-09-29 [email protected] [file_selector] Update Pigeon in
Android implementation (flutter/packages#10126)
2025-09-29 [email protected]
[In_app_purchase_storekit] Do not throw PigeonError when a transaction
is pending / cancelled / unverified (flutter/packages#9627)
2025-09-29 [email protected] [video_player] Separate texture ID on
Android (flutter/packages#10029)
2025-09-29 [email protected] Roll Flutter from
6cc976e to 96fe3b3 (32 revisions) (flutter/packages#10125)
2025-09-29 [email protected]
[camera_android_camerax] Fix NV21 Format (flutter/packages#10022)
2025-09-29 [email protected] Manual roll Flutter from
b1a28bc to 6cc976e (4 revisions) (flutter/packages#10116)
2025-09-29 [email protected] [camera_avfoundation]
Implementation swift migration - part 13 (flutter/packages#9930)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
details: "Product ID : \(id)")))
sendTransactionUpdate(
transaction: verification.unsafePayloadValue, receipt: verification.jwsRepresentation)
case .pending, .userCancelled:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both the pending and userCancelled states should be communicated to the upper layer via either the buyXXX method or the purchaseStream.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://github.com/flutter/packages/blob/main/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart#L181

      await SK2Product.purchase(
        purchaseParam.productDetails.id,
        options: options,
      );
      // The result is ignored(maybe pending/userCanceled)!
      return true;

reidbaker pushed a commit to AbdeMohlbi/flutter that referenced this pull request Dec 10, 2025
flutter/packages@34eec78...287739d

2025-09-29 [email protected] Roll Flutter (stable) from
d693b4b to ac4e799 (4 revisions) (flutter/packages#10124)
2025-09-29 [email protected] Fix CODEOWNERS error
(flutter/packages#10127)
2025-09-29 [email protected] [file_selector] Update Pigeon in
Android implementation (flutter/packages#10126)
2025-09-29 [email protected]
[In_app_purchase_storekit] Do not throw PigeonError when a transaction
is pending / cancelled / unverified (flutter/packages#9627)
2025-09-29 [email protected] [video_player] Separate texture ID on
Android (flutter/packages#10029)
2025-09-29 [email protected] Roll Flutter from
6cc976e to 96fe3b3 (32 revisions) (flutter/packages#10125)
2025-09-29 [email protected]
[camera_android_camerax] Fix NV21 Format (flutter/packages#10022)
2025-09-29 [email protected] Manual roll Flutter from
b1a28bc to 6cc976e (4 revisions) (flutter/packages#10116)
2025-09-29 [email protected] [camera_avfoundation]
Implementation swift migration - part 13 (flutter/packages#9930)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App p: in_app_purchase platform-ios platform-macos triage-ios Should be looked at in iOS triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

8 participants