Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement platform pay payment method capturing for web #1565

Merged

Conversation

cornwe19
Copy link
Contributor

@cornwe19
Copy link
Contributor Author

@jonasbark @jamesblasco @remonh87 this supersedes #1478

@cornwe19
Copy link
Contributor Author

cornwe19 commented Jan 4, 2024

@jonasbark @jamesblasco @remonh87 looking for feedback on this PR. It addresses a sizeable feature gap that exists on web.

Copy link
Member

@remonh87 remonh87 left a comment

Choose a reason for hiding this comment

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

Many thanks for this PR. I did review it and in general it looks good. However I am not convinced about adding the web paymentrequest options to isPlatformPaysupported interface. @jonasbark what are your thoughts about it?

@@ -99,6 +99,7 @@ abstract class StripePlatform extends PlatformInterface {
/// Check if either google pay or apple pay is supported on device.
Future<bool> isPlatformPaySupported({
IsGooglePaySupportedParams? params,
PlatformPayWebPaymentRequestCreateOptions? paymentRequestOptions,
Copy link
Member

Choose a reason for hiding this comment

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

I do not like the fact we need to inject a web specific method into the platform interface this should be independent. Is this really required for just checking if platformpay is supported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Honestly, I agree, it'd be preferable to hide the web implementation details here, but on web there is no implicit payment method (e.g. Apple Pay would be the only thing available in iOS apps), so without the ability to minimally filter which payment methods you want to support on web, we'd be limiting developers using the Flutter Stripe package on web pretty severely.

Note that the web options, much like the Google Pay options already passed to this method, are optional and come with a reasonable default. This means no breaking change and if they aren't supplied on web, will simply check for the availability of any wallet pay solution including Stripe's own Link Pay.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@remonh87 thoughts on my explanation above? Do you have suggestions for a different approach here given the constraints?

Copy link
Member

Choose a reason for hiding this comment

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

no looks to me. I noticed some conflicts in this branch but we are good to go. @jonasbark do you want to have a look at it as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent. Thanks for your input. I'll get the conflicts cleared up shortly

@remonh87 remonh87 self-requested a review January 23, 2024 19:13
@cornwe19 cornwe19 force-pushed the feature/1122-wallet-pay-web-payment-method branch from 5a1a1b8 to 5c92c14 Compare January 24, 2024 15:48
@cornwe19
Copy link
Contributor Author

@remonh87 I've resolved conflicts and reformatted code based on your suggestions. Let me know if there are any other outstanding items on this one. Excited to get this merged through

c.c. @jonasbark

@remonh87
Copy link
Member

Thanks for the work. I am running the CI now and give Jonas till tomorrow to have a look at it else I will merge it.

@cornwe19
Copy link
Contributor Author

@remonh87 Thanks!

I'm seeing some failures like IntegrationError: Please call Stripe() with your publishable key. You used an empty string. in stripe_js tests. That doesn't immediately feel like something I could have broken with this PR, but please let me know if there's some mitigation required here.

@cornwe19
Copy link
Contributor Author

@remonh87 thoughts on getting this merged today?

@cornwe19
Copy link
Contributor Author

cornwe19 commented Feb 2, 2024

@remonh87 any remaining items blocking this pr?

@cornwe19 cornwe19 force-pushed the feature/1122-wallet-pay-web-payment-method branch from 8f5327f to ab6cab3 Compare February 7, 2024 15:54
@cornwe19
Copy link
Contributor Author

cornwe19 commented Feb 7, 2024

@remonh87 Just synced this PR with latest main. I suspect checks will need to be rerun and will probably fail in similar ways to how they did on Jan, 24th. Please let me know if there's any action needed here. Hoping to get this PR merged soon.

Thanks!

@jaxnz
Copy link
Contributor

jaxnz commented Feb 10, 2024

Excited to see the PR to be merged

@cornwe19
Copy link
Contributor Author

@remonh87 FYI I just realized the way I had implemented payment request cancellation wasn't aligned with how iOS and Android implement it. Added a commit to update that (it now uses a StripeException with LocalizedErrorMessage having failure code FailureCode.Canceled)

Looking forward to getting this merged.

@remonh87 remonh87 merged commit 7d9ab23 into flutter-stripe:main Feb 14, 2024
3 of 5 checks passed
@cornwe19 cornwe19 deleted the feature/1122-wallet-pay-web-payment-method branch February 14, 2024 20:40
@haomingzhang0101
Copy link

haomingzhang0101 commented Feb 19, 2024

Thanks for the great work! I am wondering when this feature will be released. @remonh87

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants