github.com/stripe/stripe-go/v76@v76.25.0/identity_verificationsession.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // A short machine-readable string giving the reason for the verification or user-session failure.
    10  type IdentityVerificationSessionLastErrorCode string
    11  
    12  // List of values that IdentityVerificationSessionLastErrorCode can take
    13  const (
    14  	IdentityVerificationSessionLastErrorCodeAbandoned                        IdentityVerificationSessionLastErrorCode = "abandoned"
    15  	IdentityVerificationSessionLastErrorCodeConsentDeclined                  IdentityVerificationSessionLastErrorCode = "consent_declined"
    16  	IdentityVerificationSessionLastErrorCodeCountryNotSupported              IdentityVerificationSessionLastErrorCode = "country_not_supported"
    17  	IdentityVerificationSessionLastErrorCodeDeviceNotSupported               IdentityVerificationSessionLastErrorCode = "device_not_supported"
    18  	IdentityVerificationSessionLastErrorCodeDocumentExpired                  IdentityVerificationSessionLastErrorCode = "document_expired"
    19  	IdentityVerificationSessionLastErrorCodeDocumentTypeNotSupported         IdentityVerificationSessionLastErrorCode = "document_type_not_supported"
    20  	IdentityVerificationSessionLastErrorCodeDocumentUnverifiedOther          IdentityVerificationSessionLastErrorCode = "document_unverified_other"
    21  	IdentityVerificationSessionLastErrorCodeEmailUnverifiedOther             IdentityVerificationSessionLastErrorCode = "email_unverified_other"
    22  	IdentityVerificationSessionLastErrorCodeEmailVerificationDeclined        IdentityVerificationSessionLastErrorCode = "email_verification_declined"
    23  	IdentityVerificationSessionLastErrorCodeIDNumberInsufficientDocumentData IdentityVerificationSessionLastErrorCode = "id_number_insufficient_document_data"
    24  	IdentityVerificationSessionLastErrorCodeIDNumberMismatch                 IdentityVerificationSessionLastErrorCode = "id_number_mismatch"
    25  	IdentityVerificationSessionLastErrorCodeIDNumberUnverifiedOther          IdentityVerificationSessionLastErrorCode = "id_number_unverified_other"
    26  	IdentityVerificationSessionLastErrorCodePhoneUnverifiedOther             IdentityVerificationSessionLastErrorCode = "phone_unverified_other"
    27  	IdentityVerificationSessionLastErrorCodePhoneVerificationDeclined        IdentityVerificationSessionLastErrorCode = "phone_verification_declined"
    28  	IdentityVerificationSessionLastErrorCodeSelfieDocumentMissingPhoto       IdentityVerificationSessionLastErrorCode = "selfie_document_missing_photo"
    29  	IdentityVerificationSessionLastErrorCodeSelfieFaceMismatch               IdentityVerificationSessionLastErrorCode = "selfie_face_mismatch"
    30  	IdentityVerificationSessionLastErrorCodeSelfieManipulated                IdentityVerificationSessionLastErrorCode = "selfie_manipulated"
    31  	IdentityVerificationSessionLastErrorCodeSelfieUnverifiedOther            IdentityVerificationSessionLastErrorCode = "selfie_unverified_other"
    32  	IdentityVerificationSessionLastErrorCodeUnderSupportedAge                IdentityVerificationSessionLastErrorCode = "under_supported_age"
    33  )
    34  
    35  // 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.
    36  type IdentityVerificationSessionOptionsDocumentAllowedType string
    37  
    38  // List of values that IdentityVerificationSessionOptionsDocumentAllowedType can take
    39  const (
    40  	IdentityVerificationSessionOptionsDocumentAllowedTypeDrivingLicense IdentityVerificationSessionOptionsDocumentAllowedType = "driving_license"
    41  	IdentityVerificationSessionOptionsDocumentAllowedTypeIDCard         IdentityVerificationSessionOptionsDocumentAllowedType = "id_card"
    42  	IdentityVerificationSessionOptionsDocumentAllowedTypePassport       IdentityVerificationSessionOptionsDocumentAllowedType = "passport"
    43  )
    44  
    45  // Indicates whether this object and its related objects have been redacted or not.
    46  type IdentityVerificationSessionRedactionStatus string
    47  
    48  // List of values that IdentityVerificationSessionRedactionStatus can take
    49  const (
    50  	IdentityVerificationSessionRedactionStatusProcessing IdentityVerificationSessionRedactionStatus = "processing"
    51  	IdentityVerificationSessionRedactionStatusRedacted   IdentityVerificationSessionRedactionStatus = "redacted"
    52  )
    53  
    54  // Status of this VerificationSession. [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work).
    55  type IdentityVerificationSessionStatus string
    56  
    57  // List of values that IdentityVerificationSessionStatus can take
    58  const (
    59  	IdentityVerificationSessionStatusCanceled      IdentityVerificationSessionStatus = "canceled"
    60  	IdentityVerificationSessionStatusProcessing    IdentityVerificationSessionStatus = "processing"
    61  	IdentityVerificationSessionStatusRequiresInput IdentityVerificationSessionStatus = "requires_input"
    62  	IdentityVerificationSessionStatusVerified      IdentityVerificationSessionStatus = "verified"
    63  )
    64  
    65  // The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed.
    66  type IdentityVerificationSessionType string
    67  
    68  // List of values that IdentityVerificationSessionType can take
    69  const (
    70  	IdentityVerificationSessionTypeDocument         IdentityVerificationSessionType = "document"
    71  	IdentityVerificationSessionTypeIDNumber         IdentityVerificationSessionType = "id_number"
    72  	IdentityVerificationSessionTypeVerificationFlow IdentityVerificationSessionType = "verification_flow"
    73  )
    74  
    75  // The user's verified id number type.
    76  type IdentityVerificationSessionVerifiedOutputsIDNumberType string
    77  
    78  // List of values that IdentityVerificationSessionVerifiedOutputsIDNumberType can take
    79  const (
    80  	IdentityVerificationSessionVerifiedOutputsIDNumberTypeBRCPF  IdentityVerificationSessionVerifiedOutputsIDNumberType = "br_cpf"
    81  	IdentityVerificationSessionVerifiedOutputsIDNumberTypeSGNRIC IdentityVerificationSessionVerifiedOutputsIDNumberType = "sg_nric"
    82  	IdentityVerificationSessionVerifiedOutputsIDNumberTypeUSSSN  IdentityVerificationSessionVerifiedOutputsIDNumberType = "us_ssn"
    83  )
    84  
    85  // Returns a list of VerificationSessions
    86  type IdentityVerificationSessionListParams struct {
    87  	ListParams `form:"*"`
    88  	// 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.
    89  	ClientReferenceID *string `form:"client_reference_id"`
    90  	// Only return VerificationSessions that were created during the given date interval.
    91  	Created *int64 `form:"created"`
    92  	// Only return VerificationSessions that were created during the given date interval.
    93  	CreatedRange *RangeQueryParams `form:"created"`
    94  	// Specifies which fields in the response should be expanded.
    95  	Expand []*string `form:"expand"`
    96  	// Only return VerificationSessions with this status. [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work).
    97  	Status *string `form:"status"`
    98  }
    99  
   100  // AddExpand appends a new field to expand.
   101  func (p *IdentityVerificationSessionListParams) AddExpand(f string) {
   102  	p.Expand = append(p.Expand, &f)
   103  }
   104  
   105  // Options that apply to the [document check](https://stripe.com/docs/identity/verification-checks?type=document).
   106  type IdentityVerificationSessionOptionsDocumentParams struct {
   107  	// 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.
   108  	AllowedTypes []*string `form:"allowed_types"`
   109  	// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document's extracted name and date of birth.
   110  	RequireIDNumber *bool `form:"require_id_number"`
   111  	// Disable image uploads, identity document images have to be captured using the device's camera.
   112  	RequireLiveCapture *bool `form:"require_live_capture"`
   113  	// Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://stripe.com/docs/identity/selfie).
   114  	RequireMatchingSelfie *bool `form:"require_matching_selfie"`
   115  }
   116  
   117  // Options that apply to the email check.
   118  type IdentityVerificationSessionOptionsEmailParams struct {
   119  	// Request one time password verification of `provided_details.email`.
   120  	RequireVerification *bool `form:"require_verification"`
   121  }
   122  
   123  // Options that apply to the phone check.
   124  type IdentityVerificationSessionOptionsPhoneParams struct {
   125  	// Request one time password verification of `provided_details.phone`.
   126  	RequireVerification *bool `form:"require_verification"`
   127  }
   128  
   129  // A set of options for the session's verification checks.
   130  type IdentityVerificationSessionOptionsParams struct {
   131  	// Options that apply to the [document check](https://stripe.com/docs/identity/verification-checks?type=document).
   132  	Document *IdentityVerificationSessionOptionsDocumentParams `form:"document"`
   133  	// Options that apply to the email check.
   134  	Email *IdentityVerificationSessionOptionsEmailParams `form:"email"`
   135  	// Options that apply to the phone check.
   136  	Phone *IdentityVerificationSessionOptionsPhoneParams `form:"phone"`
   137  }
   138  
   139  // Details provided about the user being verified. These details may be shown to the user.
   140  type IdentityVerificationSessionProvidedDetailsParams struct {
   141  	// Email of user being verified
   142  	Email *string `form:"email"`
   143  	// Phone number of user being verified
   144  	Phone *string `form:"phone"`
   145  }
   146  
   147  // Creates a VerificationSession object.
   148  //
   149  // After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session's url.
   150  //
   151  // If your API key is in test mode, verification checks won't actually process, though everything else will occur as if in live mode.
   152  //
   153  // Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents)
   154  type IdentityVerificationSessionParams struct {
   155  	Params `form:"*"`
   156  	// 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.
   157  	ClientReferenceID *string `form:"client_reference_id"`
   158  	// Specifies which fields in the response should be expanded.
   159  	Expand []*string `form:"expand"`
   160  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
   161  	Metadata map[string]string `form:"metadata"`
   162  	// A set of options for the session's verification checks.
   163  	Options *IdentityVerificationSessionOptionsParams `form:"options"`
   164  	// Details provided about the user being verified. These details may be shown to the user.
   165  	ProvidedDetails *IdentityVerificationSessionProvidedDetailsParams `form:"provided_details"`
   166  	// The URL that the user will be redirected to upon completing the verification flow.
   167  	ReturnURL *string `form:"return_url"`
   168  	// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed.
   169  	Type *string `form:"type"`
   170  	// The ID of a Verification Flow from the Dashboard.
   171  	VerificationFlow *string `form:"verification_flow"`
   172  }
   173  
   174  // AddExpand appends a new field to expand.
   175  func (p *IdentityVerificationSessionParams) AddExpand(f string) {
   176  	p.Expand = append(p.Expand, &f)
   177  }
   178  
   179  // AddMetadata adds a new key-value pair to the Metadata.
   180  func (p *IdentityVerificationSessionParams) AddMetadata(key string, value string) {
   181  	if p.Metadata == nil {
   182  		p.Metadata = make(map[string]string)
   183  	}
   184  
   185  	p.Metadata[key] = value
   186  }
   187  
   188  // A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work).
   189  //
   190  // Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel).
   191  type IdentityVerificationSessionCancelParams struct {
   192  	Params `form:"*"`
   193  	// Specifies which fields in the response should be expanded.
   194  	Expand []*string `form:"expand"`
   195  }
   196  
   197  // AddExpand appends a new field to expand.
   198  func (p *IdentityVerificationSessionCancelParams) AddExpand(f string) {
   199  	p.Expand = append(p.Expand, &f)
   200  }
   201  
   202  // Redact a VerificationSession to remove all collected information from Stripe. This will redact
   203  // the VerificationSession and all objects related to it, including VerificationReports, Events,
   204  // request logs, etc.
   205  //
   206  // A VerificationSession object can be redacted when it is in requires_input or verified
   207  // [status](https://stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action
   208  // state will automatically cancel it.
   209  //
   210  // The redaction process may take up to four days. When the redaction process is in progress, the
   211  // VerificationSession's redaction.status field will be set to processing; when the process is
   212  // finished, it will change to redacted and an identity.verification_session.redacted event
   213  // will be emitted.
   214  //
   215  // Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the
   216  // fields that contain personal data will be replaced by the string [redacted] or a similar
   217  // placeholder. The metadata field will also be erased. Redacted objects cannot be updated or
   218  // used for any purpose.
   219  //
   220  // [Learn more](https://stripe.com/docs/identity/verification-sessions#redact).
   221  type IdentityVerificationSessionRedactParams struct {
   222  	Params `form:"*"`
   223  	// Specifies which fields in the response should be expanded.
   224  	Expand []*string `form:"expand"`
   225  }
   226  
   227  // AddExpand appends a new field to expand.
   228  func (p *IdentityVerificationSessionRedactParams) AddExpand(f string) {
   229  	p.Expand = append(p.Expand, &f)
   230  }
   231  
   232  // If present, this property tells you the last error encountered when processing the verification.
   233  type IdentityVerificationSessionLastError struct {
   234  	// A short machine-readable string giving the reason for the verification or user-session failure.
   235  	Code IdentityVerificationSessionLastErrorCode `json:"code"`
   236  	// A message that explains the reason for verification or user-session failure.
   237  	Reason string `json:"reason"`
   238  }
   239  type IdentityVerificationSessionOptionsDocument struct {
   240  	// 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.
   241  	AllowedTypes []IdentityVerificationSessionOptionsDocumentAllowedType `json:"allowed_types"`
   242  	// Collect an ID number and perform an [ID number check](https://stripe.com/docs/identity/verification-checks?type=id-number) with the document's extracted name and date of birth.
   243  	RequireIDNumber bool `json:"require_id_number"`
   244  	// Disable image uploads, identity document images have to be captured using the device's camera.
   245  	RequireLiveCapture bool `json:"require_live_capture"`
   246  	// Capture a face image and perform a [selfie check](https://stripe.com/docs/identity/verification-checks?type=selfie) comparing a photo ID and a picture of your user's face. [Learn more](https://stripe.com/docs/identity/selfie).
   247  	RequireMatchingSelfie bool `json:"require_matching_selfie"`
   248  }
   249  type IdentityVerificationSessionOptionsEmail struct {
   250  	// Request one time password verification of `provided_details.email`.
   251  	RequireVerification bool `json:"require_verification"`
   252  }
   253  type IdentityVerificationSessionOptionsIDNumber struct{}
   254  type IdentityVerificationSessionOptionsPhone struct {
   255  	// Request one time password verification of `provided_details.phone`.
   256  	RequireVerification bool `json:"require_verification"`
   257  }
   258  
   259  // A set of options for the session's verification checks.
   260  type IdentityVerificationSessionOptions struct {
   261  	Document *IdentityVerificationSessionOptionsDocument `json:"document"`
   262  	Email    *IdentityVerificationSessionOptionsEmail    `json:"email"`
   263  	IDNumber *IdentityVerificationSessionOptionsIDNumber `json:"id_number"`
   264  	Phone    *IdentityVerificationSessionOptionsPhone    `json:"phone"`
   265  }
   266  
   267  // Details provided about the user being verified. These details may be shown to the user.
   268  type IdentityVerificationSessionProvidedDetails struct {
   269  	// Email of user being verified
   270  	Email string `json:"email"`
   271  	// Phone number of user being verified
   272  	Phone string `json:"phone"`
   273  }
   274  
   275  // Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
   276  type IdentityVerificationSessionRedaction struct {
   277  	// Indicates whether this object and its related objects have been redacted or not.
   278  	Status IdentityVerificationSessionRedactionStatus `json:"status"`
   279  }
   280  
   281  // The user's verified date of birth.
   282  type IdentityVerificationSessionVerifiedOutputsDOB struct {
   283  	// Numerical day between 1 and 31.
   284  	Day int64 `json:"day"`
   285  	// Numerical month between 1 and 12.
   286  	Month int64 `json:"month"`
   287  	// The four-digit year.
   288  	Year int64 `json:"year"`
   289  }
   290  
   291  // The user's verified data.
   292  type IdentityVerificationSessionVerifiedOutputs struct {
   293  	// The user's verified address.
   294  	Address *Address `json:"address"`
   295  	// The user's verified date of birth.
   296  	DOB *IdentityVerificationSessionVerifiedOutputsDOB `json:"dob"`
   297  	// The user's verified email address
   298  	Email string `json:"email"`
   299  	// The user's verified first name.
   300  	FirstName string `json:"first_name"`
   301  	// The user's verified id number.
   302  	IDNumber string `json:"id_number"`
   303  	// The user's verified id number type.
   304  	IDNumberType IdentityVerificationSessionVerifiedOutputsIDNumberType `json:"id_number_type"`
   305  	// The user's verified last name.
   306  	LastName string `json:"last_name"`
   307  	// The user's verified phone number
   308  	Phone string `json:"phone"`
   309  }
   310  
   311  // A VerificationSession guides you through the process of collecting and verifying the identities
   312  // of your users. It contains details about the type of verification, such as what [verification
   313  // check](https://stripe.com/docs/identity/verification-checks) to perform. Only create one VerificationSession for
   314  // each verification in your system.
   315  //
   316  // A VerificationSession transitions through [multiple
   317  // statuses](https://stripe.com/docs/identity/how-sessions-work) throughout its lifetime as it progresses through
   318  // the verification flow. The VerificationSession contains the user's verified data after
   319  // verification checks are complete.
   320  //
   321  // Related guide: [The Verification Sessions API](https://stripe.com/docs/identity/verification-sessions)
   322  type IdentityVerificationSession struct {
   323  	APIResource
   324  	// 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.
   325  	ClientReferenceID string `json:"client_reference_id"`
   326  	// The short-lived client secret used by Stripe.js to [show a verification modal](https://stripe.com/docs/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://stripe.com/docs/identity/verification-sessions#client-secret) to learn more.
   327  	ClientSecret string `json:"client_secret"`
   328  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   329  	Created int64 `json:"created"`
   330  	// Unique identifier for the object.
   331  	ID string `json:"id"`
   332  	// If present, this property tells you the last error encountered when processing the verification.
   333  	LastError *IdentityVerificationSessionLastError `json:"last_error"`
   334  	// ID of the most recent VerificationReport. [Learn more about accessing detailed verification results.](https://stripe.com/docs/identity/verification-sessions#results)
   335  	LastVerificationReport *IdentityVerificationReport `json:"last_verification_report"`
   336  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   337  	Livemode bool `json:"livemode"`
   338  	// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
   339  	Metadata map[string]string `json:"metadata"`
   340  	// String representing the object's type. Objects of the same type share the same value.
   341  	Object string `json:"object"`
   342  	// A set of options for the session's verification checks.
   343  	Options *IdentityVerificationSessionOptions `json:"options"`
   344  	// Details provided about the user being verified. These details may be shown to the user.
   345  	ProvidedDetails *IdentityVerificationSessionProvidedDetails `json:"provided_details"`
   346  	// Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
   347  	Redaction *IdentityVerificationSessionRedaction `json:"redaction"`
   348  	// Status of this VerificationSession. [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work).
   349  	Status IdentityVerificationSessionStatus `json:"status"`
   350  	// The type of [verification check](https://stripe.com/docs/identity/verification-checks) to be performed.
   351  	Type IdentityVerificationSessionType `json:"type"`
   352  	// 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://stripe.com/docs/identity/verify-identity-documents?platform=web&type=redirect) to learn how to redirect users to Stripe.
   353  	URL string `json:"url"`
   354  	// The configuration token of a Verification Flow from the dashboard.
   355  	VerificationFlow string `json:"verification_flow"`
   356  	// The user's verified data.
   357  	VerifiedOutputs *IdentityVerificationSessionVerifiedOutputs `json:"verified_outputs"`
   358  }
   359  
   360  // IdentityVerificationSessionList is a list of VerificationSessions as retrieved from a list endpoint.
   361  type IdentityVerificationSessionList struct {
   362  	APIResource
   363  	ListMeta
   364  	Data []*IdentityVerificationSession `json:"data"`
   365  }