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

Add deferred payment methods for web #1881

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
07af94b
add jsonarray case
EduardDumitrescu Jun 10, 2024
265bc9a
update pubspec name
EduardDumitrescu Jun 10, 2024
787fe3f
revert pubspec name
EduardDumitrescu Jun 10, 2024
75eb561
bump version
EduardDumitrescu Jun 10, 2024
444e7fc
update used android version
EduardDumitrescu Jun 10, 2024
dfd9eff
update changelog
EduardDumitrescu Jun 10, 2024
cfa369e
add temporary run on ui
EduardDumitrescu Jun 11, 2024
0a9fc5e
set include if null to false
EduardDumitrescu Jun 14, 2024
da0e10c
add creation options
EduardDumitrescu Jun 19, 2024
d2a5ec7
add confirm payment method
EduardDumitrescu Jun 20, 2024
bfcc58c
add client secret to confirm payment options
EduardDumitrescu Jun 20, 2024
8457ab5
make client secret optional
EduardDumitrescu Jun 20, 2024
2f4a9b2
fix payment element client secret error
EduardDumitrescu Jun 20, 2024
674ef1e
add handle next action
EduardDumitrescu Jun 20, 2024
4fc31dd
use map for handle next action
EduardDumitrescu Jun 20, 2024
8037745
use jsify on map
EduardDumitrescu Jun 20, 2024
da70e73
add retrieve payment intent
EduardDumitrescu Jun 20, 2024
d55b5b2
move methods to platform interface
EduardDumitrescu Jun 21, 2024
e8fdc96
export element appearance
EduardDumitrescu Jun 25, 2024
4cef409
expose locale
EduardDumitrescu Jun 25, 2024
95b0dc1
expose billing info
EduardDumitrescu Jun 26, 2024
df5d2f0
Merge branch 'main' of https://github.com/flutter-stripe/flutter_stri…
EduardDumitrescu Jun 27, 2024
8514e41
add update locale for android
EduardDumitrescu Jul 1, 2024
7129309
Merge branch 'main' of https://github.com/flutter-stripe/flutter_stripe
Jul 12, 2024
e8de3e7
add changelogs
Jul 12, 2024
272c61a
refactor to fix payment request no such method on web release
Jul 24, 2024
37e7f81
expose available mobile pay
Jul 25, 2024
a5501b4
Merge branch 'main' of https://github.com/flutter-stripe/flutter_stri…
Aug 3, 2024
3457442
cleanup after interop merge
Aug 5, 2024
41cc5dd
resolve compilation errors
Aug 5, 2024
65e7aa5
Merge branch 'main' of https://github.com/flutter-stripe/flutter_stri…
Sep 25, 2024
999e320
fix merge errors
Sep 25, 2024
2ac8be2
Merge branch 'main' of https://github.com/flutter-stripe/flutter_stri…
Sep 30, 2024
232af88
Merge branch 'main' of https://github.com/flutter-stripe/flutter_stri…
Oct 30, 2024
8b85bde
fix build error after merge
Oct 30, 2024
05367ef
remove unused import on elements_submit.dart
Oct 30, 2024
ea03ab0
remove unused import on create_payment_method_with_elements.dart
Oct 30, 2024
0990bf1
expose wallets models
Oct 31, 2024
0221611
add default value to payment method
Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/stripe/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 11.2.1

**Features**
- Add deferred payment methods for web

## 11.2.0

**Features**
Expand Down
23 changes: 23 additions & 0 deletions packages/stripe/lib/src/stripe.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ class Stripe {
return isSupported;
}

Future<AvailableMobilePayOptions> availableMobilePayOptions({
IsGooglePaySupportedParams? googlePay,
PlatformPayWebPaymentRequestCreateOptions? webPaymentRequestCreateOptions,
}) async {
await _awaitForSettings();

return await _platform.availableMobilePayOptions(
params: googlePay,
paymentRequestOptions: webPaymentRequestCreateOptions,
);
}

/// Launches the relevant native wallsheet (Apple Pay on iOS and Google Pay on Android)
/// in order to create a payment intent
///
Expand Down Expand Up @@ -284,6 +296,16 @@ class Stripe {
}
}

Future<PaymentMethod> createPaymentMethodWithElements() =>
_platform.createPaymentMethodWithElements();

Future<void> elementsSubmit() => _platform.elementsSubmit();

Future<PaymentIntent> handleCardAction(
final String paymentIntentClientSecret,
) =>
_platform.handleCardAction(paymentIntentClientSecret);

/// Creates a single-use token that represents a credit card’s details.
///
/// Tokens are considered legacy, use [PaymentMethod] and [PaymentIntent]
Expand Down Expand Up @@ -696,6 +718,7 @@ class Stripe {
}

bool _needsSettings = true;

void markNeedsSettings() {
_needsSettings = true;
if (!_platform.updateSettingsLazily) {
Expand Down
4 changes: 2 additions & 2 deletions packages/stripe/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_stripe
description: Flutter library for Stripe. Supports PaymentSheets, Apple & Google Pay, SCA, PSD2 and much more.
version: 11.2.0
version: 11.2.1
homepage: https://github.com/flutter-stripe/flutter_stripe
repository: https://github.com/flutter-stripe/flutter_stripe

Expand All @@ -24,7 +24,7 @@ dependencies:
meta: ^1.8.0
stripe_android: ^11.2.0
stripe_ios: ^11.2.0
stripe_platform_interface: ^11.2.0
stripe_platform_interface: ^11.2.1
dev_dependencies:
flutter_test:
sdk: flutter
Expand Down
4 changes: 4 additions & 0 deletions packages/stripe_js/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.3.0
**Features**
- add method for deferred payment

## 6.2.1
**Features**
- Add support for any kind of payment method in setup intent with [confirmSetup]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:stripe_js/src/api/converters/js_converter.dart';
import 'package:stripe_js/stripe_api.dart';

import 'package:freezed_annotation/freezed_annotation.dart';

part 'confirm_payment_options.freezed.dart';
part 'confirm_payment_options.g.dart';

Expand All @@ -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,

/// Parameters that will be passed on to the Stripe API.
/// Refer to the Payment Intents API for a full list of parameters.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:stripe_js/src/api/converters/js_converter.dart';
import 'package:stripe_js/src/api/elements/elements.dart';

part 'create_payment_method_with_elements_data.freezed.dart';
part 'create_payment_method_with_elements_data.g.dart';

@freezed
class CreatePaymentMethodWithElementsData
with _$CreatePaymentMethodWithElementsData {
const factory CreatePaymentMethodWithElementsData({
@ElementsConverter() required Elements elements,
}) = _CreatePaymentMethodWithElementsData;

factory CreatePaymentMethodWithElementsData.fromJson(
Map<String, dynamic> json) =>
_$CreatePaymentMethodWithElementsDataFromJson(json);
}
Loading