Fix: Link display params serialization#2407
Merged
Merged
Conversation
LinkDisplayParams were serialized using the Dart field names `linkDisplayParams` and `linkDisplay`, while the native iOS and Android PaymentSheet implementations expect `link` and `display`. Add JsonKey annotations to match the native payload fields.
📝 WalkthroughWalkthroughJSON serialization key mappings for Link configuration were adjusted in payment sheet models: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Author
|
Fixes #2398 |
remonh87
approved these changes
Apr 30, 2026
Member
|
Thanks |
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LinkDisplayParams were serialized using the Dart field names
linkDisplayParamsandlinkDisplay, while the native iOS and Android PaymentSheet implementations expectlinkanddisplay.Add JsonKey annotations to match the native payload fields.
With this change,
LinkDisplayParamsis passed to the native PaymentSheet implementations using the expected fields, for exampleLinkDisplayParams(linkDisplay: LinkDisplay.never)is serialized aslink.display = "never"and is correctly applied.automaticis the default behavior, so it continues to behave the same as before.melos run format:I ran
melos run format, but it reformatted unrelated sections in existing files. I did not include those unrelated formatting changes in this PR.melos run analyze:Warnings are reported in
flutter_stripeandflutter_stripe_web, but there are no issues instripe_platform_interface, which is the package modified in this PR.melos run unittest:The modified package,
stripe_platform_interface, passed all tests, including the addedinitPaymentSheetserialization test.The overall Melos command did not fully pass because other packages do not have runnable Flutter tests:
stripe_android:Test directory "test" not found.flutter_stripe:No tests were found.stripe_ios:No tests were found.I used Codex to investigate the bug. I also ran
build_runnerand the relevant Melos commands myself, and manually reviewed the results.The only code change was adding annotations, which I fully understand.
I ran my app with the corrected version included and manually verified all three cases myself: unset
linkDisplayParams, usingLinkDisplay.automatic, and usingLinkDisplay.never.To add to that, I am not an English speaker, so I use AI translation for translating and proofreading my texts.
Summary by CodeRabbit