• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-python / 10567939360

26 Aug 2024 10:02PM UTC coverage: 96.388% (+0.001%) from 96.387%
10567939360

Pull #1380

github

web-flow
Merge 1a7a18201 into 4b36e4111
Pull Request #1380: Update generated code for beta

1343 of 2037 branches covered (65.93%)

Branch coverage included in aggregate %.

42 of 42 new or added lines in 10 files covered. (100.0%)

180 existing lines in 7 files now uncovered.

84818 of 87353 relevant lines covered (97.1%)

0.97 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.68
/stripe/_setup_attempt.py
1
# -*- coding: utf-8 -*-
2
# File generated from our OpenAPI spec
3
from stripe._expandable_field import ExpandableField
1✔
4
from stripe._list_object import ListObject
1✔
5
from stripe._listable_api_resource import ListableAPIResource
1✔
6
from stripe._request_options import RequestOptions
1✔
7
from stripe._stripe_object import StripeObject
1✔
8
from typing import ClassVar, List, Optional, Union
1✔
9
from typing_extensions import (
1✔
10
    Literal,
11
    NotRequired,
12
    TypedDict,
13
    Unpack,
14
    TYPE_CHECKING,
15
)
16

17
if TYPE_CHECKING:
1!
18
    from stripe._account import Account
×
19
    from stripe._application import Application
×
20
    from stripe._bank_account import BankAccount
×
21
    from stripe._card import Card as CardResource
×
22
    from stripe._customer import Customer
×
23
    from stripe._mandate import Mandate
×
24
    from stripe._payment_intent import PaymentIntent
×
25
    from stripe._payment_method import PaymentMethod
×
26
    from stripe._setup_intent import SetupIntent
×
27
    from stripe._source import Source
×
28

29

30
class SetupAttempt(ListableAPIResource["SetupAttempt"]):
1✔
31
    """
32
    A SetupAttempt describes one attempted confirmation of a SetupIntent,
33
    whether that confirmation is successful or unsuccessful. You can use
34
    SetupAttempts to inspect details of a specific attempt at setting up a
35
    payment method using a SetupIntent.
36
    """
37

38
    OBJECT_NAME: ClassVar[Literal["setup_attempt"]] = "setup_attempt"
1✔
39

40
    class PaymentMethodDetails(StripeObject):
1✔
41
        class AcssDebit(StripeObject):
1✔
42
            pass
1✔
43

44
        class AmazonPay(StripeObject):
1✔
45
            pass
1✔
46

47
        class AuBecsDebit(StripeObject):
1✔
48
            pass
1✔
49

50
        class BacsDebit(StripeObject):
1✔
51
            pass
1✔
52

53
        class Bancontact(StripeObject):
1✔
54
            bank_code: Optional[str]
1✔
55
            """
1✔
56
            Bank code of bank associated with the bank account.
57
            """
58
            bank_name: Optional[str]
1✔
59
            """
1✔
60
            Name of the bank associated with the bank account.
61
            """
62
            bic: Optional[str]
1✔
63
            """
1✔
64
            Bank Identifier Code of the bank associated with the bank account.
65
            """
66
            generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]]
1✔
67
            """
1✔
68
            The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
69
            """
70
            generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]]
1✔
71
            """
1✔
72
            The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
73
            """
74
            iban_last4: Optional[str]
1✔
75
            """
1✔
76
            Last four characters of the IBAN.
77
            """
78
            preferred_language: Optional[Literal["de", "en", "fr", "nl"]]
1✔
79
            """
1✔
80
            Preferred language of the Bancontact authorization page that the customer is redirected to.
81
            Can be one of `en`, `de`, `fr`, or `nl`
82
            """
83
            verified_name: Optional[str]
1✔
84
            """
1✔
85
            Owner's verified full name. Values are verified or provided by Bancontact directly
86
            (if supported) at the time of authorization or settlement. They cannot be set or mutated.
87
            """
88

89
        class Boleto(StripeObject):
1✔
90
            pass
1✔
91

92
        class Card(StripeObject):
1✔
93
            class Checks(StripeObject):
1✔
94
                address_line1_check: Optional[str]
1✔
95
                """
1✔
96
                If a address line1 was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
97
                """
98
                address_postal_code_check: Optional[str]
1✔
99
                """
1✔
100
                If a address postal code was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
101
                """
102
                cvc_check: Optional[str]
1✔
103
                """
1✔
104
                If a CVC was provided, results of the check, one of `pass`, `fail`, `unavailable`, or `unchecked`.
105
                """
106

107
            class ThreeDSecure(StripeObject):
1✔
108
                authentication_flow: Optional[
1✔
109
                    Literal["challenge", "frictionless"]
110
                ]
111
                """
1✔
112
                For authenticated transactions: how the customer was authenticated by
113
                the issuing bank.
114
                """
115
                electronic_commerce_indicator: Optional[
1✔
116
                    Literal["01", "02", "05", "06", "07"]
117
                ]
118
                """
1✔
119
                The Electronic Commerce Indicator (ECI). A protocol-level field
120
                indicating what degree of authentication was performed.
121
                """
122
                result: Optional[
1✔
123
                    Literal[
124
                        "attempt_acknowledged",
125
                        "authenticated",
126
                        "exempted",
127
                        "failed",
128
                        "not_supported",
129
                        "processing_error",
130
                    ]
131
                ]
132
                """
1✔
133
                Indicates the outcome of 3D Secure authentication.
134
                """
135
                result_reason: Optional[
1✔
136
                    Literal[
137
                        "abandoned",
138
                        "bypassed",
139
                        "canceled",
140
                        "card_not_enrolled",
141
                        "network_not_supported",
142
                        "protocol_error",
143
                        "rejected",
144
                    ]
145
                ]
146
                """
1✔
147
                Additional information about why 3D Secure succeeded or failed based
148
                on the `result`.
149
                """
150
                transaction_id: Optional[str]
1✔
151
                """
1✔
152
                The 3D Secure 1 XID or 3D Secure 2 Directory Server Transaction ID
153
                (dsTransId) for this payment.
154
                """
155
                version: Optional[Literal["1.0.2", "2.1.0", "2.2.0"]]
1✔
156
                """
1✔
157
                The version of 3D Secure that was used.
158
                """
159

160
            class Wallet(StripeObject):
1✔
161
                class ApplePay(StripeObject):
1✔
162
                    pass
1✔
163

164
                class GooglePay(StripeObject):
1✔
165
                    pass
1✔
166

167
                apple_pay: Optional[ApplePay]
1✔
168
                google_pay: Optional[GooglePay]
1✔
169
                type: Literal["apple_pay", "google_pay", "link"]
1✔
170
                """
1✔
171
                The type of the card wallet, one of `apple_pay`, `google_pay`, or `link`. An additional hash is included on the Wallet subhash with a name matching this value. It contains additional information specific to the card wallet type.
172
                """
173
                _inner_class_types = {
1✔
174
                    "apple_pay": ApplePay,
175
                    "google_pay": GooglePay,
176
                }
177

178
            brand: Optional[str]
1✔
179
            """
1✔
180
            Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
181
            """
182
            checks: Optional[Checks]
1✔
183
            """
1✔
184
            Check results by Card networks on Card address and CVC at the time of authorization
185
            """
186
            country: Optional[str]
1✔
187
            """
1✔
188
            Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
189
            """
190
            description: Optional[str]
1✔
191
            """
1✔
192
            A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.)
193
            """
194
            exp_month: Optional[int]
1✔
195
            """
1✔
196
            Two-digit number representing the card's expiration month.
197
            """
198
            exp_year: Optional[int]
1✔
199
            """
1✔
200
            Four-digit number representing the card's expiration year.
201
            """
202
            fingerprint: Optional[str]
1✔
203
            """
1✔
204
            Uniquely identifies this particular card number. You can use this attribute to check whether two customers who've signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
205

206
            *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.*
207
            """
208
            funding: Optional[str]
1✔
209
            """
1✔
210
            Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
211
            """
212
            iin: Optional[str]
1✔
213
            """
1✔
214
            Issuer identification number of the card. (For internal use only and not typically available in standard API requests.)
215
            """
216
            issuer: Optional[str]
1✔
217
            """
1✔
218
            The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.)
219
            """
220
            last4: Optional[str]
1✔
221
            """
1✔
222
            The last four digits of the card.
223
            """
224
            network: Optional[str]
1✔
225
            """
1✔
226
            Identifies which network this charge was processed on. Can be `amex`, `cartes_bancaires`, `diners`, `discover`, `eftpos_au`, `interac`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`.
227
            """
228
            three_d_secure: Optional[ThreeDSecure]
1✔
229
            """
1✔
230
            Populated if this authorization used 3D Secure authentication.
231
            """
232
            wallet: Optional[Wallet]
1✔
233
            """
1✔
234
            If this Card is part of a card wallet, this contains the details of the card wallet.
235
            """
236
            _inner_class_types = {
1✔
237
                "checks": Checks,
238
                "three_d_secure": ThreeDSecure,
239
                "wallet": Wallet,
240
            }
241

242
        class CardPresent(StripeObject):
1✔
243
            class Offline(StripeObject):
1✔
244
                stored_at: Optional[int]
1✔
245
                """
1✔
246
                Time at which the payment was collected while offline
247
                """
248
                type: Optional[Literal["deferred"]]
1✔
249
                """
1✔
250
                The method used to process this payment method offline. Only deferred is allowed.
251
                """
252

253
            generated_card: Optional[ExpandableField["PaymentMethod"]]
1✔
254
            """
1✔
255
            The ID of the Card PaymentMethod which was generated by this SetupAttempt.
256
            """
257
            offline: Optional[Offline]
1✔
258
            """
1✔
259
            Details about payments collected offline.
260
            """
261
            _inner_class_types = {"offline": Offline}
1✔
262

263
        class Cashapp(StripeObject):
1✔
264
            pass
1✔
265

266
        class Ideal(StripeObject):
1✔
267
            bank: Optional[
1✔
268
                Literal[
269
                    "abn_amro",
270
                    "asn_bank",
271
                    "bunq",
272
                    "handelsbanken",
273
                    "ing",
274
                    "knab",
275
                    "moneyou",
276
                    "n26",
277
                    "nn",
278
                    "rabobank",
279
                    "regiobank",
280
                    "revolut",
281
                    "sns_bank",
282
                    "triodos_bank",
283
                    "van_lanschot",
284
                    "yoursafe",
285
                ]
286
            ]
287
            """
1✔
288
            The customer's bank. Can be one of `abn_amro`, `asn_bank`, `bunq`, `handelsbanken`, `ing`, `knab`, `moneyou`, `n26`, `nn`, `rabobank`, `regiobank`, `revolut`, `sns_bank`, `triodos_bank`, `van_lanschot`, or `yoursafe`.
289
            """
290
            bic: Optional[
1✔
291
                Literal[
292
                    "ABNANL2A",
293
                    "ASNBNL21",
294
                    "BITSNL2A",
295
                    "BUNQNL2A",
296
                    "FVLBNL22",
297
                    "HANDNL2A",
298
                    "INGBNL2A",
299
                    "KNABNL2H",
300
                    "MOYONL21",
301
                    "NNBANL2G",
302
                    "NTSBDEB1",
303
                    "RABONL2U",
304
                    "RBRBNL21",
305
                    "REVOIE23",
306
                    "REVOLT21",
307
                    "SNSBNL2A",
308
                    "TRIONL2U",
309
                ]
310
            ]
311
            """
1✔
312
            The Bank Identifier Code of the customer's bank.
313
            """
314
            generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]]
1✔
315
            """
1✔
316
            The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
317
            """
318
            generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]]
1✔
319
            """
1✔
320
            The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
321
            """
322
            iban_last4: Optional[str]
1✔
323
            """
1✔
324
            Last four characters of the IBAN.
325
            """
326
            verified_name: Optional[str]
1✔
327
            """
1✔
328
            Owner's verified full name. Values are verified or provided by iDEAL directly
329
            (if supported) at the time of authorization or settlement. They cannot be set or mutated.
330
            """
331

332
        class Klarna(StripeObject):
1✔
333
            pass
1✔
334

335
        class Link(StripeObject):
1✔
336
            pass
1✔
337

338
        class Paypal(StripeObject):
1✔
339
            pass
1✔
340

341
        class Payto(StripeObject):
1✔
342
            pass
1✔
343

344
        class RevolutPay(StripeObject):
1✔
345
            pass
1✔
346

347
        class SepaDebit(StripeObject):
1✔
348
            pass
1✔
349

350
        class Sofort(StripeObject):
1✔
351
            bank_code: Optional[str]
1✔
352
            """
1✔
353
            Bank code of bank associated with the bank account.
354
            """
355
            bank_name: Optional[str]
1✔
356
            """
1✔
357
            Name of the bank associated with the bank account.
358
            """
359
            bic: Optional[str]
1✔
360
            """
1✔
361
            Bank Identifier Code of the bank associated with the bank account.
362
            """
363
            generated_sepa_debit: Optional[ExpandableField["PaymentMethod"]]
1✔
364
            """
1✔
365
            The ID of the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
366
            """
367
            generated_sepa_debit_mandate: Optional[ExpandableField["Mandate"]]
1✔
368
            """
1✔
369
            The mandate for the SEPA Direct Debit PaymentMethod which was generated by this SetupAttempt.
370
            """
371
            iban_last4: Optional[str]
1✔
372
            """
1✔
373
            Last four characters of the IBAN.
374
            """
375
            preferred_language: Optional[Literal["de", "en", "fr", "nl"]]
1✔
376
            """
1✔
377
            Preferred language of the Sofort authorization page that the customer is redirected to.
378
            Can be one of `en`, `de`, `fr`, or `nl`
379
            """
380
            verified_name: Optional[str]
1✔
381
            """
1✔
382
            Owner's verified full name. Values are verified or provided by Sofort directly
383
            (if supported) at the time of authorization or settlement. They cannot be set or mutated.
384
            """
385

386
        class UsBankAccount(StripeObject):
1✔
387
            pass
1✔
388

389
        acss_debit: Optional[AcssDebit]
1✔
390
        amazon_pay: Optional[AmazonPay]
1✔
391
        au_becs_debit: Optional[AuBecsDebit]
1✔
392
        bacs_debit: Optional[BacsDebit]
1✔
393
        bancontact: Optional[Bancontact]
1✔
394
        boleto: Optional[Boleto]
1✔
395
        card: Optional[Card]
1✔
396
        card_present: Optional[CardPresent]
1✔
397
        cashapp: Optional[Cashapp]
1✔
398
        ideal: Optional[Ideal]
1✔
399
        klarna: Optional[Klarna]
1✔
400
        link: Optional[Link]
1✔
401
        paypal: Optional[Paypal]
1✔
402
        payto: Optional[Payto]
1✔
403
        revolut_pay: Optional[RevolutPay]
1✔
404
        sepa_debit: Optional[SepaDebit]
1✔
405
        sofort: Optional[Sofort]
1✔
406
        type: str
1✔
407
        """
1✔
408
        The type of the payment method used in the SetupIntent (e.g., `card`). An additional hash is included on `payment_method_details` with a name matching this value. It contains confirmation-specific information for the payment method.
409
        """
410
        us_bank_account: Optional[UsBankAccount]
1✔
411
        _inner_class_types = {
1✔
412
            "acss_debit": AcssDebit,
413
            "amazon_pay": AmazonPay,
414
            "au_becs_debit": AuBecsDebit,
415
            "bacs_debit": BacsDebit,
416
            "bancontact": Bancontact,
417
            "boleto": Boleto,
418
            "card": Card,
419
            "card_present": CardPresent,
420
            "cashapp": Cashapp,
421
            "ideal": Ideal,
422
            "klarna": Klarna,
423
            "link": Link,
424
            "paypal": Paypal,
425
            "payto": Payto,
426
            "revolut_pay": RevolutPay,
427
            "sepa_debit": SepaDebit,
428
            "sofort": Sofort,
429
            "us_bank_account": UsBankAccount,
430
        }
431

432
    class SetupError(StripeObject):
1✔
433
        charge: Optional[str]
1✔
434
        """
1✔
435
        For card errors, the ID of the failed charge.
436
        """
437
        code: Optional[
1✔
438
            Literal[
439
                "account_closed",
440
                "account_country_invalid_address",
441
                "account_error_country_change_requires_additional_steps",
442
                "account_information_mismatch",
443
                "account_invalid",
444
                "account_number_invalid",
445
                "acss_debit_session_incomplete",
446
                "alipay_upgrade_required",
447
                "amount_too_large",
448
                "amount_too_small",
449
                "api_key_expired",
450
                "application_fees_not_allowed",
451
                "authentication_required",
452
                "balance_insufficient",
453
                "balance_invalid_parameter",
454
                "bank_account_bad_routing_numbers",
455
                "bank_account_declined",
456
                "bank_account_exists",
457
                "bank_account_restricted",
458
                "bank_account_unusable",
459
                "bank_account_unverified",
460
                "bank_account_verification_failed",
461
                "billing_invalid_mandate",
462
                "bitcoin_upgrade_required",
463
                "capture_charge_authorization_expired",
464
                "capture_unauthorized_payment",
465
                "card_decline_rate_limit_exceeded",
466
                "card_declined",
467
                "cardholder_phone_number_required",
468
                "charge_already_captured",
469
                "charge_already_refunded",
470
                "charge_disputed",
471
                "charge_exceeds_source_limit",
472
                "charge_exceeds_transaction_limit",
473
                "charge_expired_for_capture",
474
                "charge_invalid_parameter",
475
                "charge_not_refundable",
476
                "clearing_code_unsupported",
477
                "country_code_invalid",
478
                "country_unsupported",
479
                "coupon_expired",
480
                "customer_max_payment_methods",
481
                "customer_max_subscriptions",
482
                "customer_tax_location_invalid",
483
                "debit_not_authorized",
484
                "email_invalid",
485
                "expired_card",
486
                "financial_connections_account_inactive",
487
                "financial_connections_institution_unavailable",
488
                "financial_connections_no_successful_transaction_refresh",
489
                "forwarding_api_inactive",
490
                "forwarding_api_invalid_parameter",
491
                "forwarding_api_upstream_connection_error",
492
                "forwarding_api_upstream_connection_timeout",
493
                "gift_card_balance_insufficient",
494
                "gift_card_code_exists",
495
                "gift_card_inactive",
496
                "idempotency_key_in_use",
497
                "incorrect_address",
498
                "incorrect_cvc",
499
                "incorrect_number",
500
                "incorrect_zip",
501
                "instant_payouts_config_disabled",
502
                "instant_payouts_currency_disabled",
503
                "instant_payouts_limit_exceeded",
504
                "instant_payouts_unsupported",
505
                "insufficient_funds",
506
                "intent_invalid_state",
507
                "intent_verification_method_missing",
508
                "invalid_card_type",
509
                "invalid_characters",
510
                "invalid_charge_amount",
511
                "invalid_cvc",
512
                "invalid_expiry_month",
513
                "invalid_expiry_year",
514
                "invalid_mandate_reference_prefix_format",
515
                "invalid_number",
516
                "invalid_source_usage",
517
                "invalid_tax_location",
518
                "invoice_no_customer_line_items",
519
                "invoice_no_payment_method_types",
520
                "invoice_no_subscription_line_items",
521
                "invoice_not_editable",
522
                "invoice_on_behalf_of_not_editable",
523
                "invoice_payment_intent_requires_action",
524
                "invoice_upcoming_none",
525
                "livemode_mismatch",
526
                "lock_timeout",
527
                "missing",
528
                "no_account",
529
                "not_allowed_on_standard_account",
530
                "out_of_inventory",
531
                "ownership_declaration_not_allowed",
532
                "parameter_invalid_empty",
533
                "parameter_invalid_integer",
534
                "parameter_invalid_string_blank",
535
                "parameter_invalid_string_empty",
536
                "parameter_missing",
537
                "parameter_unknown",
538
                "parameters_exclusive",
539
                "payment_intent_action_required",
540
                "payment_intent_authentication_failure",
541
                "payment_intent_incompatible_payment_method",
542
                "payment_intent_invalid_parameter",
543
                "payment_intent_konbini_rejected_confirmation_number",
544
                "payment_intent_mandate_invalid",
545
                "payment_intent_payment_attempt_expired",
546
                "payment_intent_payment_attempt_failed",
547
                "payment_intent_unexpected_state",
548
                "payment_method_bank_account_already_verified",
549
                "payment_method_bank_account_blocked",
550
                "payment_method_billing_details_address_missing",
551
                "payment_method_configuration_failures",
552
                "payment_method_currency_mismatch",
553
                "payment_method_customer_decline",
554
                "payment_method_invalid_parameter",
555
                "payment_method_invalid_parameter_testmode",
556
                "payment_method_microdeposit_failed",
557
                "payment_method_microdeposit_verification_amounts_invalid",
558
                "payment_method_microdeposit_verification_amounts_mismatch",
559
                "payment_method_microdeposit_verification_attempts_exceeded",
560
                "payment_method_microdeposit_verification_descriptor_code_mismatch",
561
                "payment_method_microdeposit_verification_timeout",
562
                "payment_method_not_available",
563
                "payment_method_provider_decline",
564
                "payment_method_provider_timeout",
565
                "payment_method_unactivated",
566
                "payment_method_unexpected_state",
567
                "payment_method_unsupported_type",
568
                "payout_reconciliation_not_ready",
569
                "payouts_limit_exceeded",
570
                "payouts_not_allowed",
571
                "platform_account_required",
572
                "platform_api_key_expired",
573
                "postal_code_invalid",
574
                "processing_error",
575
                "product_inactive",
576
                "progressive_onboarding_limit_exceeded",
577
                "rate_limit",
578
                "refer_to_customer",
579
                "refund_disputed_payment",
580
                "resource_already_exists",
581
                "resource_missing",
582
                "return_intent_already_processed",
583
                "routing_number_invalid",
584
                "secret_key_required",
585
                "sensitive_data_access_expired",
586
                "sepa_unsupported_account",
587
                "setup_attempt_failed",
588
                "setup_intent_authentication_failure",
589
                "setup_intent_invalid_parameter",
590
                "setup_intent_mandate_invalid",
591
                "setup_intent_setup_attempt_expired",
592
                "setup_intent_unexpected_state",
593
                "shipping_address_invalid",
594
                "shipping_calculation_failed",
595
                "sku_inactive",
596
                "state_unsupported",
597
                "status_transition_invalid",
598
                "stripe_tax_inactive",
599
                "tax_id_invalid",
600
                "taxes_calculation_failed",
601
                "terminal_location_country_unsupported",
602
                "terminal_reader_busy",
603
                "terminal_reader_hardware_fault",
604
                "terminal_reader_invalid_location_for_payment",
605
                "terminal_reader_offline",
606
                "terminal_reader_timeout",
607
                "testmode_charges_only",
608
                "tls_version_unsupported",
609
                "token_already_used",
610
                "token_card_network_invalid",
611
                "token_in_use",
612
                "transfer_source_balance_parameters_mismatch",
613
                "transfers_not_allowed",
614
                "url_invalid",
615
            ]
616
        ]
617
        """
1✔
618
        For some errors that could be handled programmatically, a short string indicating the [error code](https://stripe.com/docs/error-codes) reported.
619
        """
620
        decline_code: Optional[str]
1✔
621
        """
1✔
622
        For card errors resulting from a card issuer decline, a short string indicating the [card issuer's reason for the decline](https://stripe.com/docs/declines#issuer-declines) if they provide one.
623
        """
624
        doc_url: Optional[str]
1✔
625
        """
1✔
626
        A URL to more information about the [error code](https://stripe.com/docs/error-codes) reported.
627
        """
628
        message: Optional[str]
1✔
629
        """
1✔
630
        A human-readable message providing more details about the error. For card errors, these messages can be shown to your users.
631
        """
632
        param: Optional[str]
1✔
633
        """
1✔
634
        If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.
635
        """
636
        payment_intent: Optional["PaymentIntent"]
1✔
637
        """
1✔
638
        A PaymentIntent guides you through the process of collecting a payment from your customer.
639
        We recommend that you create exactly one PaymentIntent for each order or
640
        customer session in your system. You can reference the PaymentIntent later to
641
        see the history of payment attempts for a particular session.
642

643
        A PaymentIntent transitions through
644
        [multiple statuses](https://stripe.com/docs/payments/intents#intent-statuses)
645
        throughout its lifetime as it interfaces with Stripe.js to perform
646
        authentication flows and ultimately creates at most one successful charge.
647

648
        Related guide: [Payment Intents API](https://stripe.com/docs/payments/payment-intents)
649
        """
650
        payment_method: Optional["PaymentMethod"]
1✔
651
        """
1✔
652
        PaymentMethod objects represent your customer's payment instruments.
653
        You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to
654
        Customer objects to store instrument details for future payments.
655

656
        Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).
657
        """
658
        payment_method_type: Optional[str]
1✔
659
        """
1✔
660
        If the error is specific to the type of payment method, the payment method type that had a problem. This field is only populated for invoice-related errors.
661
        """
662
        request_log_url: Optional[str]
1✔
663
        """
1✔
664
        A URL to the request log entry in your dashboard.
665
        """
666
        setup_intent: Optional["SetupIntent"]
1✔
667
        """
1✔
668
        A SetupIntent guides you through the process of setting up and saving a customer's payment credentials for future payments.
669
        For example, you can use a SetupIntent to set up and save your customer's card without immediately collecting a payment.
670
        Later, you can use [PaymentIntents](https://stripe.com/docs/api#payment_intents) to drive the payment flow.
671

672
        Create a SetupIntent when you're ready to collect your customer's payment credentials.
673
        Don't maintain long-lived, unconfirmed SetupIntents because they might not be valid.
674
        The SetupIntent transitions through multiple [statuses](https://docs.stripe.com/payments/intents#intent-statuses) as it guides
675
        you through the setup process.
676

677
        Successful SetupIntents result in payment credentials that are optimized for future payments.
678
        For example, cardholders in [certain regions](https://stripe.com/guides/strong-customer-authentication) might need to be run through
679
        [Strong Customer Authentication](https://docs.stripe.com/strong-customer-authentication) during payment method collection
680
        to streamline later [off-session payments](https://docs.stripe.com/payments/setup-intents).
681
        If you use the SetupIntent with a [Customer](https://stripe.com/docs/api#setup_intent_object-customer),
682
        it automatically attaches the resulting payment method to that Customer after successful setup.
683
        We recommend using SetupIntents or [setup_future_usage](https://stripe.com/docs/api#payment_intent_object-setup_future_usage) on
684
        PaymentIntents to save payment methods to prevent saving invalid or unoptimized payment methods.
685

686
        By using SetupIntents, you can reduce friction for your customers, even as regulations change over time.
687

688
        Related guide: [Setup Intents API](https://docs.stripe.com/payments/setup-intents)
689
        """
690
        source: Optional[
1✔
691
            Union["Account", "BankAccount", "CardResource", "Source"]
692
        ]
693
        type: Literal[
1✔
694
            "api_error",
695
            "card_error",
696
            "idempotency_error",
697
            "invalid_request_error",
698
        ]
699
        """
1✔
700
        The type of error returned. One of `api_error`, `card_error`, `idempotency_error`, or `invalid_request_error`
701
        """
702

703
    class ListParams(RequestOptions):
1✔
704
        created: NotRequired["SetupAttempt.ListParamsCreated|int"]
1✔
705
        """
1✔
706
        A filter on the list, based on the object `created` field. The value
707
        can be a string with an integer Unix timestamp or a
708
        dictionary with a number of different query options.
709
        """
710
        ending_before: NotRequired[str]
1✔
711
        """
1✔
712
        A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
713
        """
714
        expand: NotRequired[List[str]]
1✔
715
        """
1✔
716
        Specifies which fields in the response should be expanded.
717
        """
718
        limit: NotRequired[int]
1✔
719
        """
1✔
720
        A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
721
        """
722
        setup_intent: str
1✔
723
        """
1✔
724
        Only return SetupAttempts created by the SetupIntent specified by
725
        this ID.
726
        """
727
        starting_after: NotRequired[str]
1✔
728
        """
1✔
729
        A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
730
        """
731

732
    class ListParamsCreated(TypedDict):
1✔
733
        gt: NotRequired[int]
1✔
734
        """
1✔
735
        Minimum value to filter by (exclusive)
736
        """
737
        gte: NotRequired[int]
1✔
738
        """
1✔
739
        Minimum value to filter by (inclusive)
740
        """
741
        lt: NotRequired[int]
1✔
742
        """
1✔
743
        Maximum value to filter by (exclusive)
744
        """
745
        lte: NotRequired[int]
1✔
746
        """
1✔
747
        Maximum value to filter by (inclusive)
748
        """
749

750
    application: Optional[ExpandableField["Application"]]
1✔
751
    """
1✔
752
    The value of [application](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-application) on the SetupIntent at the time of this confirmation.
753
    """
754
    attach_to_self: Optional[bool]
1✔
755
    """
1✔
756
    If present, the SetupIntent's payment method will be attached to the in-context Stripe Account.
757

758
    It can only be used for this Stripe Account's own money movement flows like InboundTransfer and OutboundTransfers. It cannot be set to true when setting up a PaymentMethod for a Customer, and defaults to false when attaching a PaymentMethod to a Customer.
759
    """
760
    created: int
1✔
761
    """
1✔
762
    Time at which the object was created. Measured in seconds since the Unix epoch.
763
    """
764
    customer: Optional[ExpandableField["Customer"]]
1✔
765
    """
1✔
766
    The value of [customer](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-customer) on the SetupIntent at the time of this confirmation.
767
    """
768
    flow_directions: Optional[List[Literal["inbound", "outbound"]]]
1✔
769
    """
1✔
770
    Indicates the directions of money movement for which this payment method is intended to be used.
771

772
    Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes.
773
    """
774
    id: str
1✔
775
    """
1✔
776
    Unique identifier for the object.
777
    """
778
    livemode: bool
1✔
779
    """
1✔
780
    Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
781
    """
782
    object: Literal["setup_attempt"]
1✔
783
    """
1✔
784
    String representing the object's type. Objects of the same type share the same value.
785
    """
786
    on_behalf_of: Optional[ExpandableField["Account"]]
1✔
787
    """
1✔
788
    The value of [on_behalf_of](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-on_behalf_of) on the SetupIntent at the time of this confirmation.
789
    """
790
    payment_method: ExpandableField["PaymentMethod"]
1✔
791
    """
1✔
792
    ID of the payment method used with this SetupAttempt.
793
    """
794
    payment_method_details: PaymentMethodDetails
1✔
795
    setup_error: Optional[SetupError]
1✔
796
    """
1✔
797
    The error encountered during this attempt to confirm the SetupIntent, if any.
798
    """
799
    setup_intent: ExpandableField["SetupIntent"]
1✔
800
    """
1✔
801
    ID of the SetupIntent that this attempt belongs to.
802
    """
803
    status: str
1✔
804
    """
1✔
805
    Status of this SetupAttempt, one of `requires_confirmation`, `requires_action`, `processing`, `succeeded`, `failed`, or `abandoned`.
806
    """
807
    usage: str
1✔
808
    """
1✔
809
    The value of [usage](https://stripe.com/docs/api/setup_intents/object#setup_intent_object-usage) on the SetupIntent at the time of this confirmation, one of `off_session` or `on_session`.
810
    """
811

812
    @classmethod
1✔
813
    def list(
1✔
814
        cls, **params: Unpack["SetupAttempt.ListParams"]
815
    ) -> ListObject["SetupAttempt"]:
816
        """
817
        Returns a list of SetupAttempts that associate with a provided SetupIntent.
818
        """
819
        result = cls._static_request(
1✔
820
            "get",
821
            cls.class_url(),
822
            params=params,
823
        )
824
        if not isinstance(result, ListObject):
1!
UNCOV
825
            raise TypeError(
×
826
                "Expected list object from API, got %s"
827
                % (type(result).__name__)
828
            )
829

830
        return result
1✔
831

832
    @classmethod
1✔
833
    async def list_async(
1✔
834
        cls, **params: Unpack["SetupAttempt.ListParams"]
835
    ) -> ListObject["SetupAttempt"]:
836
        """
837
        Returns a list of SetupAttempts that associate with a provided SetupIntent.
838
        """
839
        result = await cls._static_request_async(
1✔
840
            "get",
841
            cls.class_url(),
842
            params=params,
843
        )
844
        if not isinstance(result, ListObject):
1!
UNCOV
845
            raise TypeError(
×
846
                "Expected list object from API, got %s"
847
                % (type(result).__name__)
848
            )
849

850
        return result
1✔
851

852
    _inner_class_types = {
1✔
853
        "payment_method_details": PaymentMethodDetails,
854
        "setup_error": SetupError,
855
    }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc