Skip to content

Clarify documentation gaps, update examples, add warning to ensure completePurchase is being called#11601

Merged
auto-submit[bot] merged 12 commits into
flutter:mainfrom
LouiseHsu:read-me-example-updates
Jun 2, 2026
Merged

Clarify documentation gaps, update examples, add warning to ensure completePurchase is being called#11601
auto-submit[bot] merged 12 commits into
flutter:mainfrom
LouiseHsu:read-me-example-updates

Conversation

@LouiseHsu

@LouiseHsu LouiseHsu commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Fixes flutter/flutter#186377
This PR updates the README.md with lots of examples, and also adds a runtime warning when finish() hasnt been called.

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • [] I followed [the version and CHANGELOG instructions], using [semantic versioning] and the [repository CHANGELOG style], or I have commented below to indicate which documented exception this PR falls under[^1].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under[^1].
  • All existing and new tests are passing.

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Apr 28, 2026
@LouiseHsu LouiseHsu changed the title hello Clarify documentation gaps, update examples Apr 28, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 11, 2026
@LouiseHsu LouiseHsu changed the title Clarify documentation gaps, update examples Clarify documentation gaps, update examples, add warning to ensure completePurchase is being called May 12, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu added the CICD Run CI/CD label May 12, 2026
@LouiseHsu LouiseHsu marked this pull request as ready for review May 20, 2026 20:00

@LongCatIsLooong LongCatIsLooong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The documentation LGTM. Did you by any chance look into if it is possible to change the API to force developers to kick off the product delivery process to make sure they don't leave a purchase hanging?

/// For convenience, [PurchaseDetails.pendingCompletePurchase] indicates if a
/// purchase is pending for completion.
///
/// **iOS/macOS Warning:**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also do you mean to make the warning header occupy an entire line? I think when this renders dartdoc probably won't respect the line feed after "**".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not completing a transaction on Android for 3 days would result in a refund seems more dire. Is that supposed to be documented here along with the iOS/macOS warning?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So I looked into wrapping it in a closure, but the biggest problem is that purchases aren't guaranteed to complete immediately (eg. parental controls), and also, purchases aren't always initiated from inside an app (eg code redemption)
So there are multiple edge cases where theres a gap when money is charged and the products are delivered. If the app is terminated during the gap, you can get into a weird state where the transaction was initiated and finished and removed off the transaction queue by our completePurchase() block, but the app has yet to actually handle the purchase.

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 CICD Run CI/CD p: in_app_purchase platform-ios platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[in_app_purchase_storekit] Ensure completePurchase() will be called by developers when handling transactions

2 participants