Skip to content

Add deferred payment methods for web #1881

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

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

EduardDumitrescu
Copy link
Contributor

Hello,

I've created a branch which exposes methods that would let a developer do a deferred payment on web using the new interop way.

EduardDumitrescu and others added 30 commits June 10, 2024 11:14
… into main

# Conflicts:
#	packages/stripe/CHANGELOG.md
#	packages/stripe/pubspec.yaml
#	packages/stripe_android/CHANGELOG.md
#	packages/stripe_android/pubspec.yaml
#	packages/stripe_platform_interface/pubspec.yaml
#	packages/stripe_web/pubspec.yaml
# Conflicts:
#	packages/stripe_android/CHANGELOG.md
… into web_deffered_payment

# Conflicts:
#	packages/stripe/pubspec.yaml
#	packages/stripe_android/CHANGELOG.md
#	packages/stripe_android/pubspec.yaml
#	packages/stripe_js/CHANGELOG.md
#	packages/stripe_js/lib/src/js/elements/element_creation_options.dart
#	packages/stripe_js/lib/src/js/payment_requests/payment_request.dart
#	packages/stripe_js/pubspec.yaml
#	packages/stripe_platform_interface/CHANGELOG.md
#	packages/stripe_platform_interface/lib/src/models/payment_sheet.dart
#	packages/stripe_platform_interface/lib/src/models/payment_sheet.freezed.dart
#	packages/stripe_platform_interface/lib/src/models/payment_sheet.g.dart
#	packages/stripe_platform_interface/pubspec.yaml
#	packages/stripe_web/CHANGELOG.md
#	packages/stripe_web/lib/src/widgets/payment_element.dart
#	packages/stripe_web/pubspec.yaml
Eduard Dumitrescu added 3 commits September 25, 2024 10:35
… into web_deffered_payment

# Conflicts:
#	packages/stripe/CHANGELOG.md
#	packages/stripe/lib/src/stripe.dart
#	packages/stripe/pubspec.yaml
#	packages/stripe_js/CHANGELOG.md
#	packages/stripe_js/lib/src/js/elements/element_creation_options.dart
#	packages/stripe_js/pubspec.yaml
#	packages/stripe_platform_interface/CHANGELOG.md
#	packages/stripe_platform_interface/pubspec.yaml
#	packages/stripe_web/CHANGELOG.md
#	packages/stripe_web/lib/src/widgets/payment_element.dart
#	packages/stripe_web/pubspec.yaml
… into web_deffered_payment

# Conflicts:
#	packages/stripe_platform_interface/CHANGELOG.md
#	packages/stripe_web/pubspec.yaml
Eduard Dumitrescu added 6 commits October 30, 2024 14:40
… into web_deffered_payment

# Conflicts:
#	packages/stripe/CHANGELOG.md
#	packages/stripe/pubspec.yaml
#	packages/stripe_js/CHANGELOG.md
#	packages/stripe_js/lib/src/api/payment_intents/confirm_payment_options.freezed.dart
#	packages/stripe_js/lib/src/js/elements/elements.dart
#	packages/stripe_js/pubspec.yaml
#	packages/stripe_platform_interface/CHANGELOG.md
#	packages/stripe_web/CHANGELOG.md
#	packages/stripe_web/lib/src/widgets/payment_element.dart
#	packages/stripe_web/pubspec.yaml
@dhoffer
Copy link

dhoffer commented Nov 28, 2024

Hi @EduardDumitrescu I am trying to implement Flutter web for Stripe CC payments. Sounlds like you are way ahead of me in implementing this. Could you send me your code that handles the Stripe CC payments for Flutter web? My email is [email protected], much appreciated.

Eduard Dumitrescu and others added 3 commits June 3, 2025 11:45
… into web_deffered_payment

# Conflicts:
#	packages/stripe/CHANGELOG.md
#	packages/stripe/pubspec.yaml
#	packages/stripe_js/CHANGELOG.md
#	packages/stripe_js/pubspec.yaml
#	packages/stripe_platform_interface/CHANGELOG.md
#	packages/stripe_platform_interface/pubspec.yaml
#	packages/stripe_web/CHANGELOG.md
#	packages/stripe_web/lib/src/web_stripe.dart
#	packages/stripe_web/lib/src/widgets/payment_element.dart
#	packages/stripe_web/pubspec.yaml
@ciprig
Copy link

ciprig commented Jul 10, 2025

Hi @remonh87 ,

Just checking in on this PR. This is a crucial fix for the Stripe deferred payments support on web.

We wanted to let you know that we have successfully deployed and validated this exact code in our production application, so we're confident in its stability.

The branch is updated and ready for review. Please let us know if there's anything we can do to help get this merged.

Thank you!

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.

thanks for the PR I think overall it looks good just left some remarks

@@ -1,6 +1,6 @@
name: flutter_stripe
description: Flutter library for Stripe. Supports PaymentSheets, Apple & Google Pay, SCA, PSD2 and much more.
version: 11.5.1
version: 11.6.0
Copy link
Member

Choose a reason for hiding this comment

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

Let’s not bump the version we will do this when we release

@@ -11,6 +10,7 @@ class ConfirmPaymentOptions with _$ConfirmPaymentOptions {
const factory ConfirmPaymentOptions({
/// The Elements instance that was used to create the Payment Element.
@ElementsConverter() required Elements elements,
String? clientSecret,
Copy link
Member

Choose a reason for hiding this comment

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

good catch!

Nit: let's add a doc here

The PaymentIntent's client secret.

@@ -1,3 +1,8 @@
## 11.6.0
Copy link
Member

Choose a reason for hiding this comment

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

We will define the version (I think we want to add some more) to this can be removed

@@ -1,6 +1,6 @@
name: stripe_js
description: Stripe.js bindings for dart. This package is used by Stripe web so that the Stripe js sdk can be invoked directly.
version: 6.4.0
version: 6.4.1
Copy link
Member

Choose a reason for hiding this comment

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

same here not needed to add a version

@@ -101,6 +102,19 @@ class MethodChannelStripe extends StripePlatform {
.parse(result: result!, successResultKey: 'paymentMethod');
}

@override
Future<PaymentMethod> createPaymentMethodWithElements() =>
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 prefer to add this method as we really want to stay close to the stripe react native implementation here.

@@ -427,6 +441,28 @@ class MethodChannelStripe extends StripePlatform {
return isSupported ?? false;
}

@override
Future<AvailableMobilePayOptions> availableMobilePayOptions({
Copy link
Member

Choose a reason for hiding this comment

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

what is the use of this method? we have a function called: isPlatformPaySupported


const PaymentElement({
super.key,
required this.clientSecret,
this.clientSecret,
Copy link
Member

Choose a reason for hiding this comment

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

I am thinking maybe we should split the widget into two constructors to make it clear for consumer what to add. In case for:

without intent => mode, anount and currency are required

with intent => client secret is required.

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