Debian Codegraph @

stripe/identity/_verification_session.py

raw
1 # -*- coding: utf-8 -*-
2 # File generated from our OpenAPI spec
3 from stripe._createable_api_resource import CreateableAPIResource
4 from stripe._expandable_field import ExpandableField
5 from stripe._list_object import ListObject
6 from stripe._listable_api_resource import ListableAPIResource
7 from stripe._stripe_object import StripeObject
8 from stripe._updateable_api_resource import UpdateableAPIResource
9 from stripe._util import class_method_variant, sanitize_id
10 from typing import ClassVar, Dict, List, Optional, cast, overload
11 from typing_extensions import Literal, Unpack, TYPE_CHECKING
12
13 if TYPE_CHECKING:
14 from stripe.identity._verification_report import VerificationReport
15 from stripe.params.identity._verification_session_cancel_params import (
16 VerificationSessionCancelParams,
17 )
18 from stripe.params.identity._verification_session_create_params import (
19 VerificationSessionCreateParams,
20 )
21 from stripe.params.identity._verification_session_list_params import (
22 VerificationSessionListParams,
23 )
24 from stripe.params.identity._verification_session_modify_params import (
25 VerificationSessionModifyParams,
26 )
27 from stripe.params.identity._verification_session_redact_params import (
28 VerificationSessionRedactParams,
29 )
30 from stripe.params.identity._verification_session_retrieve_params import (
31 VerificationSessionRetrieveParams,
32 )
33
34
35 class VerificationSession(
36 CreateableAPIResource["VerificationSession"],
37 ListableAPIResource["VerificationSession"],
38 UpdateableAPIResource["VerificationSession"],
39 ):
40 """
41 A VerificationSession guides you through the process of collecting and verifying the identities
42 of your users. It contains details about the type of verification, such as what [verification
43 check](https://docs.stripe.com/docs/identity/verification-checks) to perform. Only create one VerificationSession for
44 each verification in your system.
45
46 A VerificationSession transitions through [multiple
47 statuses](https://docs.stripe.com/docs/identity/how-sessions-work) throughout its lifetime as it progresses through
48 the verification flow. The VerificationSession contains the user's verified data after
49 verification checks are complete.
50
51 Related guide: [The Verification Sessions API](https://docs.stripe.com/identity/verification-sessions)
52 """
53
54 OBJECT_NAME: ClassVar[Literal["identity.verification_session"]] = (
55 "identity.verification_session"
56 )
57
58 class LastError(StripeObject):
59 code: Optional[
60 Literal[
61 "abandoned",
62 "consent_declined",
63 "country_not_supported",
64 "device_not_supported",
65 "document_expired",
66 "document_type_not_supported",
67 "document_unverified_other",
68 "email_unverified_other",
69 "email_verification_declined",
70 "id_number_insufficient_document_data",
71 "id_number_mismatch",
72 "id_number_unverified_other",
73 "phone_unverified_other",
74 "phone_verification_declined",
75 "selfie_document_missing_photo",
76 "selfie_face_mismatch",
77 "selfie_manipulated",
78 "selfie_unverified_other",
79 "under_supported_age",
80 ]
81 ]
82 """
83 A short machine-readable string giving the reason for the verification or user-session failure.
84 """
85 reason: Optional[str]
86 """
87 A message that explains the reason for verification or user-session failure.
88 """
89
90 class Options(StripeObject):
91 class Document(StripeObject):
92 allowed_types: Optional[
93 List[Literal["driving_license", "id_card", "passport"]]
94 ]
95 """
96 Array of strings of allowed identity document types. If the provided identity document isn't one of the allowed types, the verification check will fail with a document_type_not_allowed error code.
97 """
98 require_id_number: Optional[bool]
99 """
100 Collect an ID number and perform an [ID number check](https://docs.stripe.com/identity/verification-checks?type=id-number) with the document's extracted name and date of birth.
101 """
102 require_live_capture: Optional[bool]
103 """
104 Disable image uploads, identity document images have to be captured using the device's camera.
105 """
106 require_matching_selfie: Optional[bool]
107 """
108 Capture a face image and perform a [selfie check](https://docs.stripe.com/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://docs.stripe.com/identity/selfie).
109 """
110
111 class Email(StripeObject):
112 require_verification: Optional[bool]
113 """
114 Request one time password verification of `provided_details.email`.
115 """
116
117 class IdNumber(StripeObject):
118 pass
119
120 class Matching(StripeObject):
121 dob: Optional[Literal["none", "similar"]]
122 """
123 Strictness of the DOB matching policy to apply.
124 """
125 name: Optional[Literal["none", "similar"]]
126 """
127 Strictness of the name matching policy to apply.
128 """
129
130 class Phone(StripeObject):
131 require_verification: Optional[bool]
132 """
133 Request one time password verification of `provided_details.phone`.
134 """
135
136 document: Optional[Document]
137 email: Optional[Email]
138 id_number: Optional[IdNumber]
139 matching: Optional[Matching]
140 phone: Optional[Phone]
141 _inner_class_types = {
142 "document": Document,
143 "email": Email,
144 "id_number": IdNumber,
145 "matching": Matching,
146 "phone": Phone,
147 }
148
149 class ProvidedDetails(StripeObject):
150 email: Optional[str]
151 """
152 Email of user being verified
153 """
154 phone: Optional[str]
155 """
156 Phone number of user being verified
157 """
158
159 class Redaction(StripeObject):
160 status: Literal["processing", "redacted"]
161 """
162 Indicates whether this object and its related objects have been redacted or not.
163 """
164
165 class RelatedPerson(StripeObject):
166 account: str
167 """
168 Token referencing the associated Account of the related Person resource.
169 """
170 person: str
171 """
172 Token referencing the related Person resource.
173 """
174
175 class VerifiedOutputs(StripeObject):
176 class Address(StripeObject):
177 city: Optional[str]
178 """
179 City, district, suburb, town, or village.
180 """
181 country: Optional[str]
182 """
183 Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
184 """
185 line1: Optional[str]
186 """
187 Address line 1, such as the street, PO Box, or company name.
188 """
189 line2: Optional[str]
190 """
191 Address line 2, such as the apartment, suite, unit, or building.
192 """
193 postal_code: Optional[str]
194 """
195 ZIP or postal code.
196 """
197 state: Optional[str]
198 """
199 State, county, province, or region ([ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2)).
200 """
201
202 class Dob(StripeObject):
203 day: Optional[int]
204 """
205 Numerical day between 1 and 31.
206 """
207 month: Optional[int]
208 """
209 Numerical month between 1 and 12.
210 """
211 year: Optional[int]
212 """
213 The four-digit year.
214 """
215
216 address: Optional[Address]
217 """
218 The user's verified address.
219 """
220 dob: Optional[Dob]
221 """
222 The user's verified date of birth.
223 """
224 email: Optional[str]
225 """
226 The user's verified email address
227 """
228 first_name: Optional[str]
229 """
230 The user's verified first name.
231 """
232 id_number: Optional[str]
233 """
234 The user's verified id number.
235 """
236 id_number_type: Optional[Literal["br_cpf", "sg_nric", "us_ssn"]]
237 """
238 The user's verified id number type.
239 """
240 last_name: Optional[str]
241 """
242 The user's verified last name.
243 """
244 phone: Optional[str]
245 """
246 The user's verified phone number
247 """
248 sex: Optional[Literal["[redacted]", "female", "male", "unknown"]]
249 """
250 The user's verified sex.
251 """
252 unparsed_place_of_birth: Optional[str]
253 """
254 The user's verified place of birth as it appears in the document.
255 """
256 unparsed_sex: Optional[str]
257 """
258 The user's verified sex as it appears in the document.
259 """
260 _inner_class_types = {"address": Address, "dob": Dob}
261
262 client_reference_id: Optional[str]
263 """
264 A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems.
265 """
266 client_secret: Optional[str]
267 """
268 The short-lived client secret used by Stripe.js to [show a verification modal](https://docs.stripe.com/js/identity/modal) inside your app. This client secret expires after 24 hours and can only be used once. Don't store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on [passing the client secret to the frontend](https://docs.stripe.com/identity/verification-sessions#client-secret) to learn more.
269 """
270 created: int
271 """
272 Time at which the object was created. Measured in seconds since the Unix epoch.
273 """
274 id: str
275 """
276 Unique identifier for the object.
277 """
278 last_error: Optional[LastError]
279 """
280 If present, this property tells you the last error encountered when processing the verification.
281 """
282 last_verification_report: Optional[ExpandableField["VerificationReport"]]
283 """
284 ID of the most recent VerificationReport. [Learn more about accessing detailed verification results.](https://docs.stripe.com/identity/verification-sessions#results)
285 """
286 livemode: bool
287 """
288 Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
289 """
290 metadata: Dict[str, str]
291 """
292 Set of [key-value pairs](https://docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
293 """
294 object: Literal["identity.verification_session"]
295 """
296 String representing the object's type. Objects of the same type share the same value.
297 """
298 options: Optional[Options]
299 """
300 A set of options for the session's verification checks.
301 """
302 provided_details: Optional[ProvidedDetails]
303 """
304 Details provided about the user being verified. These details may be shown to the user.
305 """
306 redaction: Optional[Redaction]
307 """
308 Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
309 """
310 related_customer: Optional[str]
311 """
312 Customer ID
313 """
314 related_customer_account: Optional[str]
315 """
316 The ID of the Account representing a customer.
317 """
318 related_person: Optional[RelatedPerson]
319 status: Literal["canceled", "processing", "requires_input", "verified"]
320 """
321 Status of this VerificationSession. [Learn more about the lifecycle of sessions](https://docs.stripe.com/identity/how-sessions-work).
322 """
323 type: Literal["document", "id_number", "verification_flow"]
324 """
325 The type of [verification check](https://docs.stripe.com/identity/verification-checks) to be performed.
326 """
327 url: Optional[str]
328 """
329 The short-lived URL that you use to redirect a user to Stripe to submit their identity information. This URL expires after 48 hours and can only be used once. Don't store it, log it, send it in emails or expose it to anyone other than the user. Refer to our docs on [verifying identity documents](https://docs.stripe.com/identity/verify-identity-documents?platform=web&type=redirect) to learn how to redirect users to Stripe.
330 """
331 verification_flow: Optional[str]
332 """
333 The configuration token of a verification flow from the dashboard.
334 """
335 verified_outputs: Optional[VerifiedOutputs]
336 """
337 The user's verified data.
338 """
339
340 @classmethod
341 def _cls_cancel(
342 cls, session: str, **params: Unpack["VerificationSessionCancelParams"]
343 ) -> "VerificationSession":
344 """
345 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
346
347 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
348 """
349 return cast(
350 "VerificationSession",
351 cls._static_request(
352 "post",
353 "/v1/identity/verification_sessions/{session}/cancel".format(
354 session=sanitize_id(session)
355 ),
356 params=params,
357 ),
358 )
359
360 @overload
361 @staticmethod
362 def cancel(
363 session: str, **params: Unpack["VerificationSessionCancelParams"]
364 ) -> "VerificationSession":
365 """
366 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
367
368 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
369 """
370 ...
371
372 @overload
373 def cancel(
374 self, **params: Unpack["VerificationSessionCancelParams"]
375 ) -> "VerificationSession":
376 """
377 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
378
379 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
380 """
381 ...
382
383 @class_method_variant("_cls_cancel")
384 def cancel( # pyright: ignore[reportGeneralTypeIssues]
385 self, **params: Unpack["VerificationSessionCancelParams"]
386 ) -> "VerificationSession":
387 """
388 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
389
390 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
391 """
392 return cast(
393 "VerificationSession",
394 self._request(
395 "post",
396 "/v1/identity/verification_sessions/{session}/cancel".format(
397 session=sanitize_id(self.get("id"))
398 ),
399 params=params,
400 ),
401 )
402
403 @classmethod
404 async def _cls_cancel_async(
405 cls, session: str, **params: Unpack["VerificationSessionCancelParams"]
406 ) -> "VerificationSession":
407 """
408 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
409
410 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
411 """
412 return cast(
413 "VerificationSession",
414 await cls._static_request_async(
415 "post",
416 "/v1/identity/verification_sessions/{session}/cancel".format(
417 session=sanitize_id(session)
418 ),
419 params=params,
420 ),
421 )
422
423 @overload
424 @staticmethod
425 async def cancel_async(
426 session: str, **params: Unpack["VerificationSessionCancelParams"]
427 ) -> "VerificationSession":
428 """
429 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
430
431 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
432 """
433 ...
434
435 @overload
436 async def cancel_async(
437 self, **params: Unpack["VerificationSessionCancelParams"]
438 ) -> "VerificationSession":
439 """
440 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
441
442 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
443 """
444 ...
445
446 @class_method_variant("_cls_cancel_async")
447 async def cancel_async( # pyright: ignore[reportGeneralTypeIssues]
448 self, **params: Unpack["VerificationSessionCancelParams"]
449 ) -> "VerificationSession":
450 """
451 A VerificationSession object can be canceled when it is in requires_input [status](https://docs.stripe.com/docs/identity/how-sessions-work).
452
453 Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#cancel).
454 """
455 return cast(
456 "VerificationSession",
457 await self._request_async(
458 "post",
459 "/v1/identity/verification_sessions/{session}/cancel".format(
460 session=sanitize_id(self.get("id"))
461 ),
462 params=params,
463 ),
464 )
465
466 @classmethod
467 def create(
468 cls, **params: Unpack["VerificationSessionCreateParams"]
469 ) -> "VerificationSession":
470 """
471 Creates a VerificationSession object.
472
473 After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
474
475 If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
476
477 Related guide: [Verify your users' identity documents](https://docs.stripe.com/docs/identity/verify-identity-documents)
478 """
479 return cast(
480 "VerificationSession",
481 cls._static_request(
482 "post",
483 cls.class_url(),
484 params=params,
485 ),
486 )
487
488 @classmethod
489 async def create_async(
490 cls, **params: Unpack["VerificationSessionCreateParams"]
491 ) -> "VerificationSession":
492 """
493 Creates a VerificationSession object.
494
495 After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
496
497 If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
498
499 Related guide: [Verify your users' identity documents](https://docs.stripe.com/docs/identity/verify-identity-documents)
500 """
501 return cast(
502 "VerificationSession",
503 await cls._static_request_async(
504 "post",
505 cls.class_url(),
506 params=params,
507 ),
508 )
509
510 @classmethod
511 def list(
512 cls, **params: Unpack["VerificationSessionListParams"]
513 ) -> ListObject["VerificationSession"]:
514 """
515 Returns a list of VerificationSessions
516 """
517 result = cls._static_request(
518 "get",
519 cls.class_url(),
520 params=params,
521 )
522 if not isinstance(result, ListObject):
523 raise TypeError(
524 "Expected list object from API, got %s"
525 % (type(result).__name__)
526 )
527
528 return result
529
530 @classmethod
531 async def list_async(
532 cls, **params: Unpack["VerificationSessionListParams"]
533 ) -> ListObject["VerificationSession"]:
534 """
535 Returns a list of VerificationSessions
536 """
537 result = await cls._static_request_async(
538 "get",
539 cls.class_url(),
540 params=params,
541 )
542 if not isinstance(result, ListObject):
543 raise TypeError(
544 "Expected list object from API, got %s"
545 % (type(result).__name__)
546 )
547
548 return result
549
550 @classmethod
551 def modify(
552 cls, id: str, **params: Unpack["VerificationSessionModifyParams"]
553 ) -> "VerificationSession":
554 """
555 Updates a VerificationSession object.
556
557 When the session status is requires_input, you can use this method to update the
558 verification check and options.
559 """
560 url = "%s/%s" % (cls.class_url(), sanitize_id(id))
561 return cast(
562 "VerificationSession",
563 cls._static_request(
564 "post",
565 url,
566 params=params,
567 ),
568 )
569
570 @classmethod
571 async def modify_async(
572 cls, id: str, **params: Unpack["VerificationSessionModifyParams"]
573 ) -> "VerificationSession":
574 """
575 Updates a VerificationSession object.
576
577 When the session status is requires_input, you can use this method to update the
578 verification check and options.
579 """
580 url = "%s/%s" % (cls.class_url(), sanitize_id(id))
581 return cast(
582 "VerificationSession",
583 await cls._static_request_async(
584 "post",
585 url,
586 params=params,
587 ),
588 )
589
590 @classmethod
591 def _cls_redact(
592 cls, session: str, **params: Unpack["VerificationSessionRedactParams"]
593 ) -> "VerificationSession":
594 """
595 Redact a VerificationSession to remove all collected information from Stripe. This will redact
596 the VerificationSession and all objects related to it, including VerificationReports, Events,
597 request logs, etc.
598
599 A VerificationSession object can be redacted when it is in requires_input or verified
600 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
601 state will automatically cancel it.
602
603 The redaction process may take up to four days. When the redaction process is in progress, the
604 VerificationSession's redaction.status field will be set to processing; when the process is
605 finished, it will change to redacted and an identity.verification_session.redacted event
606 will be emitted.
607
608 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
609 fields that contain personal data will be replaced by the string [redacted] or a similar
610 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
611 used for any purpose.
612
613 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
614 """
615 return cast(
616 "VerificationSession",
617 cls._static_request(
618 "post",
619 "/v1/identity/verification_sessions/{session}/redact".format(
620 session=sanitize_id(session)
621 ),
622 params=params,
623 ),
624 )
625
626 @overload
627 @staticmethod
628 def redact(
629 session: str, **params: Unpack["VerificationSessionRedactParams"]
630 ) -> "VerificationSession":
631 """
632 Redact a VerificationSession to remove all collected information from Stripe. This will redact
633 the VerificationSession and all objects related to it, including VerificationReports, Events,
634 request logs, etc.
635
636 A VerificationSession object can be redacted when it is in requires_input or verified
637 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
638 state will automatically cancel it.
639
640 The redaction process may take up to four days. When the redaction process is in progress, the
641 VerificationSession's redaction.status field will be set to processing; when the process is
642 finished, it will change to redacted and an identity.verification_session.redacted event
643 will be emitted.
644
645 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
646 fields that contain personal data will be replaced by the string [redacted] or a similar
647 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
648 used for any purpose.
649
650 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
651 """
652 ...
653
654 @overload
655 def redact(
656 self, **params: Unpack["VerificationSessionRedactParams"]
657 ) -> "VerificationSession":
658 """
659 Redact a VerificationSession to remove all collected information from Stripe. This will redact
660 the VerificationSession and all objects related to it, including VerificationReports, Events,
661 request logs, etc.
662
663 A VerificationSession object can be redacted when it is in requires_input or verified
664 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
665 state will automatically cancel it.
666
667 The redaction process may take up to four days. When the redaction process is in progress, the
668 VerificationSession's redaction.status field will be set to processing; when the process is
669 finished, it will change to redacted and an identity.verification_session.redacted event
670 will be emitted.
671
672 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
673 fields that contain personal data will be replaced by the string [redacted] or a similar
674 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
675 used for any purpose.
676
677 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
678 """
679 ...
680
681 @class_method_variant("_cls_redact")
682 def redact( # pyright: ignore[reportGeneralTypeIssues]
683 self, **params: Unpack["VerificationSessionRedactParams"]
684 ) -> "VerificationSession":
685 """
686 Redact a VerificationSession to remove all collected information from Stripe. This will redact
687 the VerificationSession and all objects related to it, including VerificationReports, Events,
688 request logs, etc.
689
690 A VerificationSession object can be redacted when it is in requires_input or verified
691 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
692 state will automatically cancel it.
693
694 The redaction process may take up to four days. When the redaction process is in progress, the
695 VerificationSession's redaction.status field will be set to processing; when the process is
696 finished, it will change to redacted and an identity.verification_session.redacted event
697 will be emitted.
698
699 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
700 fields that contain personal data will be replaced by the string [redacted] or a similar
701 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
702 used for any purpose.
703
704 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
705 """
706 return cast(
707 "VerificationSession",
708 self._request(
709 "post",
710 "/v1/identity/verification_sessions/{session}/redact".format(
711 session=sanitize_id(self.get("id"))
712 ),
713 params=params,
714 ),
715 )
716
717 @classmethod
718 async def _cls_redact_async(
719 cls, session: str, **params: Unpack["VerificationSessionRedactParams"]
720 ) -> "VerificationSession":
721 """
722 Redact a VerificationSession to remove all collected information from Stripe. This will redact
723 the VerificationSession and all objects related to it, including VerificationReports, Events,
724 request logs, etc.
725
726 A VerificationSession object can be redacted when it is in requires_input or verified
727 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
728 state will automatically cancel it.
729
730 The redaction process may take up to four days. When the redaction process is in progress, the
731 VerificationSession's redaction.status field will be set to processing; when the process is
732 finished, it will change to redacted and an identity.verification_session.redacted event
733 will be emitted.
734
735 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
736 fields that contain personal data will be replaced by the string [redacted] or a similar
737 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
738 used for any purpose.
739
740 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
741 """
742 return cast(
743 "VerificationSession",
744 await cls._static_request_async(
745 "post",
746 "/v1/identity/verification_sessions/{session}/redact".format(
747 session=sanitize_id(session)
748 ),
749 params=params,
750 ),
751 )
752
753 @overload
754 @staticmethod
755 async def redact_async(
756 session: str, **params: Unpack["VerificationSessionRedactParams"]
757 ) -> "VerificationSession":
758 """
759 Redact a VerificationSession to remove all collected information from Stripe. This will redact
760 the VerificationSession and all objects related to it, including VerificationReports, Events,
761 request logs, etc.
762
763 A VerificationSession object can be redacted when it is in requires_input or verified
764 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
765 state will automatically cancel it.
766
767 The redaction process may take up to four days. When the redaction process is in progress, the
768 VerificationSession's redaction.status field will be set to processing; when the process is
769 finished, it will change to redacted and an identity.verification_session.redacted event
770 will be emitted.
771
772 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
773 fields that contain personal data will be replaced by the string [redacted] or a similar
774 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
775 used for any purpose.
776
777 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
778 """
779 ...
780
781 @overload
782 async def redact_async(
783 self, **params: Unpack["VerificationSessionRedactParams"]
784 ) -> "VerificationSession":
785 """
786 Redact a VerificationSession to remove all collected information from Stripe. This will redact
787 the VerificationSession and all objects related to it, including VerificationReports, Events,
788 request logs, etc.
789
790 A VerificationSession object can be redacted when it is in requires_input or verified
791 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
792 state will automatically cancel it.
793
794 The redaction process may take up to four days. When the redaction process is in progress, the
795 VerificationSession's redaction.status field will be set to processing; when the process is
796 finished, it will change to redacted and an identity.verification_session.redacted event
797 will be emitted.
798
799 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
800 fields that contain personal data will be replaced by the string [redacted] or a similar
801 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
802 used for any purpose.
803
804 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
805 """
806 ...
807
808 @class_method_variant("_cls_redact_async")
809 async def redact_async( # pyright: ignore[reportGeneralTypeIssues]
810 self, **params: Unpack["VerificationSessionRedactParams"]
811 ) -> "VerificationSession":
812 """
813 Redact a VerificationSession to remove all collected information from Stripe. This will redact
814 the VerificationSession and all objects related to it, including VerificationReports, Events,
815 request logs, etc.
816
817 A VerificationSession object can be redacted when it is in requires_input or verified
818 [status](https://docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
819 state will automatically cancel it.
820
821 The redaction process may take up to four days. When the redaction process is in progress, the
822 VerificationSession's redaction.status field will be set to processing; when the process is
823 finished, it will change to redacted and an identity.verification_session.redacted event
824 will be emitted.
825
826 Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
827 fields that contain personal data will be replaced by the string [redacted] or a similar
828 placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
829 used for any purpose.
830
831 [Learn more](https://docs.stripe.com/docs/identity/verification-sessions#redact).
832 """
833 return cast(
834 "VerificationSession",
835 await self._request_async(
836 "post",
837 "/v1/identity/verification_sessions/{session}/redact".format(
838 session=sanitize_id(self.get("id"))
839 ),
840 params=params,
841 ),
842 )
843
844 @classmethod
845 def retrieve(
846 cls, id: str, **params: Unpack["VerificationSessionRetrieveParams"]
847 ) -> "VerificationSession":
848 """
849 Retrieves the details of a VerificationSession that was previously created.
850
851 When the session status is requires_input, you can use this method to retrieve a valid
852 client_secret or url to allow re-submission.
853 """
854 instance = cls(id, **params)
855 instance.refresh()
856 return instance
857
858 @classmethod
859 async def retrieve_async(
860 cls, id: str, **params: Unpack["VerificationSessionRetrieveParams"]
861 ) -> "VerificationSession":
862 """
863 Retrieves the details of a VerificationSession that was previously created.
864
865 When the session status is requires_input, you can use this method to retrieve a valid
866 client_secret or url to allow re-submission.
867 """
868 instance = cls(id, **params)
869 await instance.refresh_async()
870 return instance
871
872 _inner_class_types = {
873 "last_error": LastError,
874 "options": Options,
875 "provided_details": ProvidedDetails,
876 "redaction": Redaction,
877 "related_person": RelatedPerson,
878 "verified_outputs": VerifiedOutputs,
879 }