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 update and confirm PaymentIntent methods #36

Merged
merged 6 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 2 deletions lib/messages.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:stripe/src/messages/converters.dart';
import 'package:stripe/src/messages/enums.dart';
import 'package:stripe/src/messages/enums/pause_collection_behavior.dart';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for cleaning this up


export 'package:stripe/src/messages/enums.dart';

Expand All @@ -19,14 +18,15 @@ part 'src/messages/data_list.dart';
part 'src/messages/discount.dart';
part 'src/messages/event.dart';
part 'src/messages/invoice.dart';
part 'src/messages/payment_intent.dart';
part 'src/messages/pause_collection.dart';
part 'src/messages/payment_intent.dart';
part 'src/messages/payment_method.dart';
part 'src/messages/portal_session.dart';
part 'src/messages/price.dart';
part 'src/messages/product.dart';
part 'src/messages/promotion_code.dart';
part 'src/messages/refund.dart';
part 'src/messages/requests/confirm_payment_intent.dart';
part 'src/messages/requests/create_checkout_session.dart';
part 'src/messages/requests/create_customer.dart';
part 'src/messages/requests/create_discount.dart';
Expand All @@ -48,6 +48,7 @@ part 'src/messages/requests/list_subscription_schedules.dart';
part 'src/messages/requests/list_subscriptions.dart';
part 'src/messages/requests/subscription_payment_settings.dart';
part 'src/messages/requests/update_customer.dart';
part 'src/messages/requests/update_payment_intent.dart';
part 'src/messages/requests/update_subscription.dart';
part 'src/messages/requests/update_subscription_item.dart';
part 'src/messages/requests/update_subscription_schedule.dart';
Expand Down
169 changes: 126 additions & 43 deletions lib/messages.g.dart

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

83 changes: 83 additions & 0 deletions lib/src/messages/requests/confirm_payment_intent.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
part of '../../../messages.dart';

@JsonSerializable()
class ConfirmPaymentIntentRequest {
/// ID of the payment method (a PaymentMethod, Card, or compatible Source
/// object) to attach to this PaymentIntent.
final String? paymentMethod;

/// Email address that the receipt for the resulting payment will be sent to.
/// If receipt_email is specified for a payment in live mode, a receipt will
/// be sent regardless of your email settings.
final String? receiptEmail;

/// Indicates that you intend to make future payments with this
/// PaymentIntent’s payment method.
///
/// If you provide a Customer with the PaymentIntent, you can use this
/// parameter to attach the payment method to the Customer after the
/// PaymentIntent is confirmed and the customer completes any required
/// actions. If you don’t provide a Customer, you can still attach the
/// payment method to a Customer after the transaction completes.
///
/// If the payment method is card_present and isn’t a digital wallet, Stripe
/// creates and attaches a generated_card payment method representing the
/// card to the Customer instead.
///
/// When processing card payments, Stripe uses setup_future_usage to help you
/// comply with regional legislation and network rules, such as SCA.
///
/// If you’ve already set setup_future_usage and you’re performing a request
/// using a publishable key, you can only update the value from on_session to
/// off_session.
final SetupFutureUsage? setupFutureUsage;

/// ID of the ConfirmationToken used to confirm this PaymentIntent.
///
/// If the provided ConfirmationToken contains properties that are also being
/// provided in this request, such as payment_method, then the values in
/// this request will take precedence.
final String? confirmationToken;

/// Set to true to fail the payment attempt if the PaymentIntent transitions
/// into requires_action. This parameter is intended for simpler integrations
/// that do not handle customer actions, like saving cards without
/// authentication.
final bool? errorOnRequiresAction;

/// ID of the mandate that’s used for this payment.
final String? mandate;

/// Set to true to indicate that the customer isn’t in your checkout flow
/// during this payment attempt and can’t authenticate. Use this parameter in
/// scenarios where you collect card details and charge them later.
final bool? offSession;

/// The URL to redirect your customer back to after they authenticate or
/// cancel their payment on the payment method’s app or site. If you’d prefer
/// to redirect to a mobile application, you can alternatively supply an
/// application URI scheme. This parameter is only used for cards and other
/// redirect-based payment methods.
final String? returnUrl;

/// Set to true when confirming server-side and using Stripe.js, iOS, or
/// Android client-side SDKs to handle the next actions.
final bool? useStripeSdk;

ConfirmPaymentIntentRequest({
this.paymentMethod,
this.receiptEmail,
this.setupFutureUsage,
this.confirmationToken,
this.errorOnRequiresAction,
this.mandate,
this.offSession,
this.returnUrl,
this.useStripeSdk,
});

factory ConfirmPaymentIntentRequest.fromJson(Map<String, dynamic> json) =>
_$ConfirmPaymentIntentRequestFromJson(json);

Map<String, dynamic> toJson() => _$ConfirmPaymentIntentRequestToJson(this);
}
Loading
Loading