Skip to content

Commit 944b0df

Browse files
Merge pull request #36 from solid-software/update_payment_intent
Add update and confirm PaymentIntent methods
2 parents 8a76a3f + a8958f6 commit 944b0df

6 files changed

Lines changed: 352 additions & 75 deletions

File tree

lib/messages.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:json_annotation/json_annotation.dart';
22
import 'package:stripe/src/messages/converters.dart';
33
import 'package:stripe/src/messages/enums.dart';
4-
import 'package:stripe/src/messages/enums/pause_collection_behavior.dart';
54

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

@@ -19,14 +18,15 @@ part 'src/messages/data_list.dart';
1918
part 'src/messages/discount.dart';
2019
part 'src/messages/event.dart';
2120
part 'src/messages/invoice.dart';
22-
part 'src/messages/payment_intent.dart';
2321
part 'src/messages/pause_collection.dart';
22+
part 'src/messages/payment_intent.dart';
2423
part 'src/messages/payment_method.dart';
2524
part 'src/messages/portal_session.dart';
2625
part 'src/messages/price.dart';
2726
part 'src/messages/product.dart';
2827
part 'src/messages/promotion_code.dart';
2928
part 'src/messages/refund.dart';
29+
part 'src/messages/requests/confirm_payment_intent.dart';
3030
part 'src/messages/requests/create_checkout_session.dart';
3131
part 'src/messages/requests/create_customer.dart';
3232
part 'src/messages/requests/create_discount.dart';
@@ -48,6 +48,7 @@ part 'src/messages/requests/list_subscription_schedules.dart';
4848
part 'src/messages/requests/list_subscriptions.dart';
4949
part 'src/messages/requests/subscription_payment_settings.dart';
5050
part 'src/messages/requests/update_customer.dart';
51+
part 'src/messages/requests/update_payment_intent.dart';
5152
part 'src/messages/requests/update_subscription.dart';
5253
part 'src/messages/requests/update_subscription_item.dart';
5354
part 'src/messages/requests/update_subscription_schedule.dart';

lib/messages.g.dart

Lines changed: 126 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
part of '../../../messages.dart';
2+
3+
@JsonSerializable()
4+
class ConfirmPaymentIntentRequest {
5+
/// ID of the payment method (a PaymentMethod, Card, or compatible Source
6+
/// object) to attach to this PaymentIntent.
7+
final String? paymentMethod;
8+
9+
/// Email address that the receipt for the resulting payment will be sent to.
10+
/// If receipt_email is specified for a payment in live mode, a receipt will
11+
/// be sent regardless of your email settings.
12+
final String? receiptEmail;
13+
14+
/// Indicates that you intend to make future payments with this
15+
/// PaymentIntent’s payment method.
16+
///
17+
/// If you provide a Customer with the PaymentIntent, you can use this
18+
/// parameter to attach the payment method to the Customer after the
19+
/// PaymentIntent is confirmed and the customer completes any required
20+
/// actions. If you don’t provide a Customer, you can still attach the
21+
/// payment method to a Customer after the transaction completes.
22+
///
23+
/// If the payment method is card_present and isn’t a digital wallet, Stripe
24+
/// creates and attaches a generated_card payment method representing the
25+
/// card to the Customer instead.
26+
///
27+
/// When processing card payments, Stripe uses setup_future_usage to help you
28+
/// comply with regional legislation and network rules, such as SCA.
29+
///
30+
/// If you’ve already set setup_future_usage and you’re performing a request
31+
/// using a publishable key, you can only update the value from on_session to
32+
/// off_session.
33+
final SetupFutureUsage? setupFutureUsage;
34+
35+
/// ID of the ConfirmationToken used to confirm this PaymentIntent.
36+
///
37+
/// If the provided ConfirmationToken contains properties that are also being
38+
/// provided in this request, such as payment_method, then the values in
39+
/// this request will take precedence.
40+
final String? confirmationToken;
41+
42+
/// Set to true to fail the payment attempt if the PaymentIntent transitions
43+
/// into requires_action. This parameter is intended for simpler integrations
44+
/// that do not handle customer actions, like saving cards without
45+
/// authentication.
46+
final bool? errorOnRequiresAction;
47+
48+
/// ID of the mandate that’s used for this payment.
49+
final String? mandate;
50+
51+
/// Set to true to indicate that the customer isn’t in your checkout flow
52+
/// during this payment attempt and can’t authenticate. Use this parameter in
53+
/// scenarios where you collect card details and charge them later.
54+
final bool? offSession;
55+
56+
/// The URL to redirect your customer back to after they authenticate or
57+
/// cancel their payment on the payment method’s app or site. If you’d prefer
58+
/// to redirect to a mobile application, you can alternatively supply an
59+
/// application URI scheme. This parameter is only used for cards and other
60+
/// redirect-based payment methods.
61+
final String? returnUrl;
62+
63+
/// Set to true when confirming server-side and using Stripe.js, iOS, or
64+
/// Android client-side SDKs to handle the next actions.
65+
final bool? useStripeSdk;
66+
67+
ConfirmPaymentIntentRequest({
68+
this.paymentMethod,
69+
this.receiptEmail,
70+
this.setupFutureUsage,
71+
this.confirmationToken,
72+
this.errorOnRequiresAction,
73+
this.mandate,
74+
this.offSession,
75+
this.returnUrl,
76+
this.useStripeSdk,
77+
});
78+
79+
factory ConfirmPaymentIntentRequest.fromJson(Map<String, dynamic> json) =>
80+
_$ConfirmPaymentIntentRequestFromJson(json);
81+
82+
Map<String, dynamic> toJson() => _$ConfirmPaymentIntentRequestToJson(this);
83+
}

0 commit comments

Comments
 (0)