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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  import "encoding/json"
    10  
    11  // A short machine-readable string giving the reason for the verification failure.
    12  type IdentityVerificationReportDocumentErrorCode string
    13  
    14  // List of values that IdentityVerificationReportDocumentErrorCode can take
    15  const (
    16  	IdentityVerificationReportDocumentErrorCodeDocumentExpired          IdentityVerificationReportDocumentErrorCode = "document_expired"
    17  	IdentityVerificationReportDocumentErrorCodeDocumentTypeNotSupported IdentityVerificationReportDocumentErrorCode = "document_type_not_supported"
    18  	IdentityVerificationReportDocumentErrorCodeDocumentUnverifiedOther  IdentityVerificationReportDocumentErrorCode = "document_unverified_other"
    19  )
    20  
    21  // Status of this `document` check.
    22  type IdentityVerificationReportDocumentStatus string
    23  
    24  // List of values that IdentityVerificationReportDocumentStatus can take
    25  const (
    26  	IdentityVerificationReportDocumentStatusUnverified IdentityVerificationReportDocumentStatus = "unverified"
    27  	IdentityVerificationReportDocumentStatusVerified   IdentityVerificationReportDocumentStatus = "verified"
    28  )
    29  
    30  // Type of the document.
    31  type IdentityVerificationReportDocumentType string
    32  
    33  // List of values that IdentityVerificationReportDocumentType can take
    34  const (
    35  	IdentityVerificationReportDocumentTypeDrivingLicense IdentityVerificationReportDocumentType = "driving_license"
    36  	IdentityVerificationReportDocumentTypeIDCard         IdentityVerificationReportDocumentType = "id_card"
    37  	IdentityVerificationReportDocumentTypePassport       IdentityVerificationReportDocumentType = "passport"
    38  )
    39  
    40  // A short machine-readable string giving the reason for the verification failure.
    41  type IdentityVerificationReportEmailErrorCode string
    42  
    43  // List of values that IdentityVerificationReportEmailErrorCode can take
    44  const (
    45  	IdentityVerificationReportEmailErrorCodeEmailUnverifiedOther      IdentityVerificationReportEmailErrorCode = "email_unverified_other"
    46  	IdentityVerificationReportEmailErrorCodeEmailVerificationDeclined IdentityVerificationReportEmailErrorCode = "email_verification_declined"
    47  )
    48  
    49  // Status of this `email` check.
    50  type IdentityVerificationReportEmailStatus string
    51  
    52  // List of values that IdentityVerificationReportEmailStatus can take
    53  const (
    54  	IdentityVerificationReportEmailStatusUnverified IdentityVerificationReportEmailStatus = "unverified"
    55  	IdentityVerificationReportEmailStatusVerified   IdentityVerificationReportEmailStatus = "verified"
    56  )
    57  
    58  // A short machine-readable string giving the reason for the verification failure.
    59  type IdentityVerificationReportIDNumberErrorCode string
    60  
    61  // List of values that IdentityVerificationReportIDNumberErrorCode can take
    62  const (
    63  	IdentityVerificationReportIDNumberErrorCodeIDNumberInsufficientDocumentData IdentityVerificationReportIDNumberErrorCode = "id_number_insufficient_document_data"
    64  	IdentityVerificationReportIDNumberErrorCodeIDNumberMismatch                 IdentityVerificationReportIDNumberErrorCode = "id_number_mismatch"
    65  	IdentityVerificationReportIDNumberErrorCodeIDNumberUnverifiedOther          IdentityVerificationReportIDNumberErrorCode = "id_number_unverified_other"
    66  )
    67  
    68  // Type of ID number.
    69  type IdentityVerificationReportIDNumberIDNumberType string
    70  
    71  // List of values that IdentityVerificationReportIDNumberIDNumberType can take
    72  const (
    73  	IdentityVerificationReportIDNumberIDNumberTypeBRCPF  IdentityVerificationReportIDNumberIDNumberType = "br_cpf"
    74  	IdentityVerificationReportIDNumberIDNumberTypeSGNRIC IdentityVerificationReportIDNumberIDNumberType = "sg_nric"
    75  	IdentityVerificationReportIDNumberIDNumberTypeUSSSN  IdentityVerificationReportIDNumberIDNumberType = "us_ssn"
    76  )
    77  
    78  // Status of this `id_number` check.
    79  type IdentityVerificationReportIDNumberStatus string
    80  
    81  // List of values that IdentityVerificationReportIDNumberStatus can take
    82  const (
    83  	IdentityVerificationReportIDNumberStatusUnverified IdentityVerificationReportIDNumberStatus = "unverified"
    84  	IdentityVerificationReportIDNumberStatusVerified   IdentityVerificationReportIDNumberStatus = "verified"
    85  )
    86  
    87  // 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.
    88  type IdentityVerificationReportOptionsDocumentAllowedType string
    89  
    90  // List of values that IdentityVerificationReportOptionsDocumentAllowedType can take
    91  const (
    92  	IdentityVerificationReportOptionsDocumentAllowedTypeDrivingLicense IdentityVerificationReportOptionsDocumentAllowedType = "driving_license"
    93  	IdentityVerificationReportOptionsDocumentAllowedTypeIDCard         IdentityVerificationReportOptionsDocumentAllowedType = "id_card"
    94  	IdentityVerificationReportOptionsDocumentAllowedTypePassport       IdentityVerificationReportOptionsDocumentAllowedType = "passport"
    95  )
    96  
    97  // A short machine-readable string giving the reason for the verification failure.
    98  type IdentityVerificationReportPhoneErrorCode string
    99  
   100  // List of values that IdentityVerificationReportPhoneErrorCode can take
   101  const (
   102  	IdentityVerificationReportPhoneErrorCodePhoneUnverifiedOther      IdentityVerificationReportPhoneErrorCode = "phone_unverified_other"
   103  	IdentityVerificationReportPhoneErrorCodePhoneVerificationDeclined IdentityVerificationReportPhoneErrorCode = "phone_verification_declined"
   104  )
   105  
   106  // Status of this `phone` check.
   107  type IdentityVerificationReportPhoneStatus string
   108  
   109  // List of values that IdentityVerificationReportPhoneStatus can take
   110  const (
   111  	IdentityVerificationReportPhoneStatusUnverified IdentityVerificationReportPhoneStatus = "unverified"
   112  	IdentityVerificationReportPhoneStatusVerified   IdentityVerificationReportPhoneStatus = "verified"
   113  )
   114  
   115  // A short machine-readable string giving the reason for the verification failure.
   116  type IdentityVerificationReportSelfieErrorCode string
   117  
   118  // List of values that IdentityVerificationReportSelfieErrorCode can take
   119  const (
   120  	IdentityVerificationReportSelfieErrorCodeSelfieDocumentMissingPhoto IdentityVerificationReportSelfieErrorCode = "selfie_document_missing_photo"
   121  	IdentityVerificationReportSelfieErrorCodeSelfieFaceMismatch         IdentityVerificationReportSelfieErrorCode = "selfie_face_mismatch"
   122  	IdentityVerificationReportSelfieErrorCodeSelfieManipulated          IdentityVerificationReportSelfieErrorCode = "selfie_manipulated"
   123  	IdentityVerificationReportSelfieErrorCodeSelfieUnverifiedOther      IdentityVerificationReportSelfieErrorCode = "selfie_unverified_other"
   124  )
   125  
   126  // Status of this `selfie` check.
   127  type IdentityVerificationReportSelfieStatus string
   128  
   129  // List of values that IdentityVerificationReportSelfieStatus can take
   130  const (
   131  	IdentityVerificationReportSelfieStatusUnverified IdentityVerificationReportSelfieStatus = "unverified"
   132  	IdentityVerificationReportSelfieStatusVerified   IdentityVerificationReportSelfieStatus = "verified"
   133  )
   134  
   135  // Type of report.
   136  type IdentityVerificationReportType string
   137  
   138  // List of values that IdentityVerificationReportType can take
   139  const (
   140  	IdentityVerificationReportTypeDocument         IdentityVerificationReportType = "document"
   141  	IdentityVerificationReportTypeIDNumber         IdentityVerificationReportType = "id_number"
   142  	IdentityVerificationReportTypeVerificationFlow IdentityVerificationReportType = "verification_flow"
   143  )
   144  
   145  // List all verification reports.
   146  type IdentityVerificationReportListParams struct {
   147  	ListParams `form:"*"`
   148  	// 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.
   149  	ClientReferenceID *string `form:"client_reference_id"`
   150  	// Only return VerificationReports that were created during the given date interval.
   151  	Created *int64 `form:"created"`
   152  	// Only return VerificationReports that were created during the given date interval.
   153  	CreatedRange *RangeQueryParams `form:"created"`
   154  	// Specifies which fields in the response should be expanded.
   155  	Expand []*string `form:"expand"`
   156  	// Only return VerificationReports of this type
   157  	Type *string `form:"type"`
   158  	// Only return VerificationReports created by this VerificationSession ID. It is allowed to provide a VerificationIntent ID.
   159  	VerificationSession *string `form:"verification_session"`
   160  }
   161  
   162  // AddExpand appends a new field to expand.
   163  func (p *IdentityVerificationReportListParams) AddExpand(f string) {
   164  	p.Expand = append(p.Expand, &f)
   165  }
   166  
   167  // Retrieves an existing VerificationReport
   168  type IdentityVerificationReportParams struct {
   169  	Params `form:"*"`
   170  	// Specifies which fields in the response should be expanded.
   171  	Expand []*string `form:"expand"`
   172  }
   173  
   174  // AddExpand appends a new field to expand.
   175  func (p *IdentityVerificationReportParams) AddExpand(f string) {
   176  	p.Expand = append(p.Expand, &f)
   177  }
   178  
   179  // Date of birth as it appears in the document.
   180  type IdentityVerificationReportDocumentDOB struct {
   181  	// Numerical day between 1 and 31.
   182  	Day int64 `json:"day"`
   183  	// Numerical month between 1 and 12.
   184  	Month int64 `json:"month"`
   185  	// The four-digit year.
   186  	Year int64 `json:"year"`
   187  }
   188  
   189  // Details on the verification error. Present when status is `unverified`.
   190  type IdentityVerificationReportDocumentError struct {
   191  	// A short machine-readable string giving the reason for the verification failure.
   192  	Code IdentityVerificationReportDocumentErrorCode `json:"code"`
   193  	// A human-readable message giving the reason for the failure. These messages can be shown to your users.
   194  	Reason string `json:"reason"`
   195  }
   196  
   197  // Expiration date of the document.
   198  type IdentityVerificationReportDocumentExpirationDate struct {
   199  	// Numerical day between 1 and 31.
   200  	Day int64 `json:"day"`
   201  	// Numerical month between 1 and 12.
   202  	Month int64 `json:"month"`
   203  	// The four-digit year.
   204  	Year int64 `json:"year"`
   205  }
   206  
   207  // Issued date of the document.
   208  type IdentityVerificationReportDocumentIssuedDate struct {
   209  	// Numerical day between 1 and 31.
   210  	Day int64 `json:"day"`
   211  	// Numerical month between 1 and 12.
   212  	Month int64 `json:"month"`
   213  	// The four-digit year.
   214  	Year int64 `json:"year"`
   215  }
   216  
   217  // Result from a document check
   218  type IdentityVerificationReportDocument struct {
   219  	// Address as it appears in the document.
   220  	Address *Address `json:"address"`
   221  	// Date of birth as it appears in the document.
   222  	DOB *IdentityVerificationReportDocumentDOB `json:"dob"`
   223  	// Details on the verification error. Present when status is `unverified`.
   224  	Error *IdentityVerificationReportDocumentError `json:"error"`
   225  	// Expiration date of the document.
   226  	ExpirationDate *IdentityVerificationReportDocumentExpirationDate `json:"expiration_date"`
   227  	// Array of [File](https://stripe.com/docs/api/files) ids containing images for this document.
   228  	Files []string `json:"files"`
   229  	// First name as it appears in the document.
   230  	FirstName string `json:"first_name"`
   231  	// Issued date of the document.
   232  	IssuedDate *IdentityVerificationReportDocumentIssuedDate `json:"issued_date"`
   233  	// Issuing country of the document.
   234  	IssuingCountry string `json:"issuing_country"`
   235  	// Last name as it appears in the document.
   236  	LastName string `json:"last_name"`
   237  	// Document ID number.
   238  	Number string `json:"number"`
   239  	// Status of this `document` check.
   240  	Status IdentityVerificationReportDocumentStatus `json:"status"`
   241  	// Type of the document.
   242  	Type IdentityVerificationReportDocumentType `json:"type"`
   243  }
   244  
   245  // Details on the verification error. Present when status is `unverified`.
   246  type IdentityVerificationReportEmailError struct {
   247  	// A short machine-readable string giving the reason for the verification failure.
   248  	Code IdentityVerificationReportEmailErrorCode `json:"code"`
   249  	// A human-readable message giving the reason for the failure. These messages can be shown to your users.
   250  	Reason string `json:"reason"`
   251  }
   252  
   253  // Result from a email check
   254  type IdentityVerificationReportEmail struct {
   255  	// Email to be verified.
   256  	Email string `json:"email"`
   257  	// Details on the verification error. Present when status is `unverified`.
   258  	Error *IdentityVerificationReportEmailError `json:"error"`
   259  	// Status of this `email` check.
   260  	Status IdentityVerificationReportEmailStatus `json:"status"`
   261  }
   262  
   263  // Date of birth.
   264  type IdentityVerificationReportIDNumberDOB struct {
   265  	// Numerical day between 1 and 31.
   266  	Day int64 `json:"day"`
   267  	// Numerical month between 1 and 12.
   268  	Month int64 `json:"month"`
   269  	// The four-digit year.
   270  	Year int64 `json:"year"`
   271  }
   272  
   273  // Details on the verification error. Present when status is `unverified`.
   274  type IdentityVerificationReportIDNumberError struct {
   275  	// A short machine-readable string giving the reason for the verification failure.
   276  	Code IdentityVerificationReportIDNumberErrorCode `json:"code"`
   277  	// A human-readable message giving the reason for the failure. These messages can be shown to your users.
   278  	Reason string `json:"reason"`
   279  }
   280  
   281  // Result from an id_number check
   282  type IdentityVerificationReportIDNumber struct {
   283  	// Date of birth.
   284  	DOB *IdentityVerificationReportIDNumberDOB `json:"dob"`
   285  	// Details on the verification error. Present when status is `unverified`.
   286  	Error *IdentityVerificationReportIDNumberError `json:"error"`
   287  	// First name.
   288  	FirstName string `json:"first_name"`
   289  	// ID number. When `id_number_type` is `us_ssn`, only the last 4 digits are present.
   290  	IDNumber string `json:"id_number"`
   291  	// Type of ID number.
   292  	IDNumberType IdentityVerificationReportIDNumberIDNumberType `json:"id_number_type"`
   293  	// Last name.
   294  	LastName string `json:"last_name"`
   295  	// Status of this `id_number` check.
   296  	Status IdentityVerificationReportIDNumberStatus `json:"status"`
   297  }
   298  type IdentityVerificationReportOptionsDocument struct {
   299  	// 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.
   300  	AllowedTypes []IdentityVerificationReportOptionsDocumentAllowedType `json:"allowed_types"`
   301  	// 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.
   302  	RequireIDNumber bool `json:"require_id_number"`
   303  	// Disable image uploads, identity document images have to be captured using the device's camera.
   304  	RequireLiveCapture bool `json:"require_live_capture"`
   305  	// 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).
   306  	RequireMatchingSelfie bool `json:"require_matching_selfie"`
   307  }
   308  type IdentityVerificationReportOptionsIDNumber struct{}
   309  type IdentityVerificationReportOptions struct {
   310  	Document *IdentityVerificationReportOptionsDocument `json:"document"`
   311  	IDNumber *IdentityVerificationReportOptionsIDNumber `json:"id_number"`
   312  }
   313  
   314  // Details on the verification error. Present when status is `unverified`.
   315  type IdentityVerificationReportPhoneError struct {
   316  	// A short machine-readable string giving the reason for the verification failure.
   317  	Code IdentityVerificationReportPhoneErrorCode `json:"code"`
   318  	// A human-readable message giving the reason for the failure. These messages can be shown to your users.
   319  	Reason string `json:"reason"`
   320  }
   321  
   322  // Result from a phone check
   323  type IdentityVerificationReportPhone struct {
   324  	// Details on the verification error. Present when status is `unverified`.
   325  	Error *IdentityVerificationReportPhoneError `json:"error"`
   326  	// Phone to be verified.
   327  	Phone string `json:"phone"`
   328  	// Status of this `phone` check.
   329  	Status IdentityVerificationReportPhoneStatus `json:"status"`
   330  }
   331  
   332  // Details on the verification error. Present when status is `unverified`.
   333  type IdentityVerificationReportSelfieError struct {
   334  	// A short machine-readable string giving the reason for the verification failure.
   335  	Code IdentityVerificationReportSelfieErrorCode `json:"code"`
   336  	// A human-readable message giving the reason for the failure. These messages can be shown to your users.
   337  	Reason string `json:"reason"`
   338  }
   339  
   340  // Result from a selfie check
   341  type IdentityVerificationReportSelfie struct {
   342  	// ID of the [File](https://stripe.com/docs/api/files) holding the image of the identity document used in this check.
   343  	Document string `json:"document"`
   344  	// Details on the verification error. Present when status is `unverified`.
   345  	Error *IdentityVerificationReportSelfieError `json:"error"`
   346  	// ID of the [File](https://stripe.com/docs/api/files) holding the image of the selfie used in this check.
   347  	Selfie string `json:"selfie"`
   348  	// Status of this `selfie` check.
   349  	Status IdentityVerificationReportSelfieStatus `json:"status"`
   350  }
   351  
   352  // A VerificationReport is the result of an attempt to collect and verify data from a user.
   353  // The collection of verification checks performed is determined from the `type` and `options`
   354  // parameters used. You can find the result of each verification check performed in the
   355  // appropriate sub-resource: `document`, `id_number`, `selfie`.
   356  //
   357  // Each VerificationReport contains a copy of any data collected by the user as well as
   358  // reference IDs which can be used to access collected images through the [FileUpload](https://stripe.com/docs/api/files)
   359  // API. To configure and create VerificationReports, use the
   360  // [VerificationSession](https://stripe.com/docs/api/identity/verification_sessions) API.
   361  //
   362  // Related guides: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results).
   363  type IdentityVerificationReport struct {
   364  	APIResource
   365  	// 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.
   366  	ClientReferenceID string `json:"client_reference_id"`
   367  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   368  	Created int64 `json:"created"`
   369  	// Result from a document check
   370  	Document *IdentityVerificationReportDocument `json:"document"`
   371  	// Result from a email check
   372  	Email *IdentityVerificationReportEmail `json:"email"`
   373  	// Unique identifier for the object.
   374  	ID string `json:"id"`
   375  	// Result from an id_number check
   376  	IDNumber *IdentityVerificationReportIDNumber `json:"id_number"`
   377  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   378  	Livemode bool `json:"livemode"`
   379  	// String representing the object's type. Objects of the same type share the same value.
   380  	Object  string                             `json:"object"`
   381  	Options *IdentityVerificationReportOptions `json:"options"`
   382  	// Result from a phone check
   383  	Phone *IdentityVerificationReportPhone `json:"phone"`
   384  	// Result from a selfie check
   385  	Selfie *IdentityVerificationReportSelfie `json:"selfie"`
   386  	// Type of report.
   387  	Type IdentityVerificationReportType `json:"type"`
   388  	// The configuration token of a Verification Flow from the dashboard.
   389  	VerificationFlow string `json:"verification_flow"`
   390  	// ID of the VerificationSession that created this report.
   391  	VerificationSession string `json:"verification_session"`
   392  }
   393  
   394  // IdentityVerificationReportList is a list of VerificationReports as retrieved from a list endpoint.
   395  type IdentityVerificationReportList struct {
   396  	APIResource
   397  	ListMeta
   398  	Data []*IdentityVerificationReport `json:"data"`
   399  }
   400  
   401  // UnmarshalJSON handles deserialization of an IdentityVerificationReport.
   402  // This custom unmarshaling is needed because the resulting
   403  // property may be an id or the full struct if it was expanded.
   404  func (i *IdentityVerificationReport) UnmarshalJSON(data []byte) error {
   405  	if id, ok := ParseID(data); ok {
   406  		i.ID = id
   407  		return nil
   408  	}
   409  
   410  	type identityVerificationReport IdentityVerificationReport
   411  	var v identityVerificationReport
   412  	if err := json.Unmarshal(data, &v); err != nil {
   413  		return err
   414  	}
   415  
   416  	*i = IdentityVerificationReport(v)
   417  	return nil
   418  }