Class: Stripe::Identity::VerificationSession

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/identity/verification_session.rb

Overview

A VerificationSession guides you through the process of collecting and verifying the identities of your users. It contains details about the type of verification, such as what [verification check](docs.stripe.com/docs/identity/verification-checks) to perform. Only create one VerificationSession for each verification in your system.

A VerificationSession transitions through [multiple statuses](docs.stripe.com/docs/identity/how-sessions-work) throughout its lifetime as it progresses through the verification flow. The VerificationSession contains the user’s verified data after verification checks are complete.

Related guide: [The Verification Sessions API](docs.stripe.com/identity/verification-sessions)

Defined Under Namespace

Classes: LastError, Options, ProvidedDetails, Redaction, RelatedPerson, VerifiedOutputs

Constant Summary collapse

OBJECT_NAME =
"identity.verification_session"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#client_reference_idObject (readonly)

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.



253
254
255
# File 'lib/stripe/resources/identity/verification_session.rb', line 253

def client_reference_id
  @client_reference_id
end

#client_secretObject (readonly)

The short-lived client secret used by Stripe.js to [show a verification modal](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](docs.stripe.com/identity/verification-sessions#client-secret) to learn more.



255
256
257
# File 'lib/stripe/resources/identity/verification_session.rb', line 255

def client_secret
  @client_secret
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



257
258
259
# File 'lib/stripe/resources/identity/verification_session.rb', line 257

def created
  @created
end

#idObject (readonly)

Unique identifier for the object.



259
260
261
# File 'lib/stripe/resources/identity/verification_session.rb', line 259

def id
  @id
end

#last_errorObject (readonly)

If present, this property tells you the last error encountered when processing the verification.



261
262
263
# File 'lib/stripe/resources/identity/verification_session.rb', line 261

def last_error
  @last_error
end

#last_verification_reportObject (readonly)

ID of the most recent VerificationReport. [Learn more about accessing detailed verification results.](docs.stripe.com/identity/verification-sessions#results)



263
264
265
# File 'lib/stripe/resources/identity/verification_session.rb', line 263

def last_verification_report
  @last_verification_report
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



265
266
267
# File 'lib/stripe/resources/identity/verification_session.rb', line 265

def livemode
  @livemode
end

#metadataObject (readonly)

Set of [key-value pairs](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.



267
268
269
# File 'lib/stripe/resources/identity/verification_session.rb', line 267

def 
  
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



269
270
271
# File 'lib/stripe/resources/identity/verification_session.rb', line 269

def object
  @object
end

#optionsObject (readonly)

A set of options for the session’s verification checks.



271
272
273
# File 'lib/stripe/resources/identity/verification_session.rb', line 271

def options
  @options
end

#provided_detailsObject (readonly)

Details provided about the user being verified. These details may be shown to the user.



273
274
275
# File 'lib/stripe/resources/identity/verification_session.rb', line 273

def provided_details
  @provided_details
end

#redactionObject (readonly)

Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.



275
276
277
# File 'lib/stripe/resources/identity/verification_session.rb', line 275

def redaction
  @redaction
end

Customer ID



277
278
279
# File 'lib/stripe/resources/identity/verification_session.rb', line 277

def related_customer
  @related_customer
end

The ID of the Account representing a customer.



279
280
281
# File 'lib/stripe/resources/identity/verification_session.rb', line 279

def 
  
end

Attribute for field related_person



281
282
283
# File 'lib/stripe/resources/identity/verification_session.rb', line 281

def related_person
  @related_person
end

#statusObject (readonly)

Status of this VerificationSession. [Learn more about the lifecycle of sessions](docs.stripe.com/identity/how-sessions-work).



283
284
285
# File 'lib/stripe/resources/identity/verification_session.rb', line 283

def status
  @status
end

#typeObject (readonly)

The type of [verification check](docs.stripe.com/identity/verification-checks) to be performed.



285
286
287
# File 'lib/stripe/resources/identity/verification_session.rb', line 285

def type
  @type
end

#urlObject (readonly)

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](docs.stripe.com/identity/verify-identity-documents?platform=web&type=redirect) to learn how to redirect users to Stripe.



287
288
289
# File 'lib/stripe/resources/identity/verification_session.rb', line 287

def url
  @url
end

#verification_flowObject (readonly)

The configuration token of a verification flow from the dashboard.



289
290
291
# File 'lib/stripe/resources/identity/verification_session.rb', line 289

def verification_flow
  @verification_flow
end

#verified_outputsObject (readonly)

The user’s verified data.



291
292
293
# File 'lib/stripe/resources/identity/verification_session.rb', line 291

def verified_outputs
  @verified_outputs
end

Class Method Details

.cancel(session, params = {}, opts = {}) ⇒ Object

A VerificationSession object can be canceled when it is in requires_input [status](docs.stripe.com/docs/identity/how-sessions-work).

Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](docs.stripe.com/docs/identity/verification-sessions#cancel).



308
309
310
311
312
313
314
315
# File 'lib/stripe/resources/identity/verification_session.rb', line 308

def self.cancel(session, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

.create(params = {}, opts = {}) ⇒ Object

Creates a VerificationSession object.

After the VerificationSession is created, display a verification modal using the session client_secret or send your users to the session’s url.

If your API key is in test mode, verification checks won’t actually process, though everything else will occur as if in live mode.

Related guide: [Verify your users’ identity documents](docs.stripe.com/docs/identity/verify-identity-documents)



324
325
326
327
328
329
330
331
# File 'lib/stripe/resources/identity/verification_session.rb', line 324

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/identity/verification_sessions",
    params: params,
    opts: opts
  )
end

.field_remappingsObject



423
424
425
# File 'lib/stripe/resources/identity/verification_session.rb', line 423

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



412
413
414
415
416
417
418
419
420
421
# File 'lib/stripe/resources/identity/verification_session.rb', line 412

def self.inner_class_types
  @inner_class_types = {
    last_error: LastError,
    options: Options,
    provided_details: ProvidedDetails,
    redaction: Redaction,
    related_person: RelatedPerson,
    verified_outputs: VerifiedOutputs,
  }
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of VerificationSessions



334
335
336
337
338
339
340
341
# File 'lib/stripe/resources/identity/verification_session.rb', line 334

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/identity/verification_sessions",
    params: params,
    opts: opts
  )
end

.object_nameObject



23
24
25
# File 'lib/stripe/resources/identity/verification_session.rb', line 23

def self.object_name
  "identity.verification_session"
end

.redact(session, params = {}, opts = {}) ⇒ Object

Redact a VerificationSession to remove all collected information from Stripe. This will redact the VerificationSession and all objects related to it, including VerificationReports, Events, request logs, etc.

A VerificationSession object can be redacted when it is in requires_input or verified [status](docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action state will automatically cancel it.

The redaction process may take up to four days. When the redaction process is in progress, the VerificationSession’s redaction.status field will be set to processing; when the process is finished, it will change to redacted and an identity.verification_session.redacted event will be emitted.

Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the fields that contain personal data will be replaced by the string [redacted] or a similar placeholder. The metadata field will also be erased. Redacted objects cannot be updated or used for any purpose.

[Learn more](docs.stripe.com/docs/identity/verification-sessions#redact).



390
391
392
393
394
395
396
397
# File 'lib/stripe/resources/identity/verification_session.rb', line 390

def self.redact(session, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

.update(session, params = {}, opts = {}) ⇒ Object

Updates a VerificationSession object.

When the session status is requires_input, you can use this method to update the verification check and options.



403
404
405
406
407
408
409
410
# File 'lib/stripe/resources/identity/verification_session.rb', line 403

def self.update(session, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/identity/verification_sessions/%<session>s", { session: CGI.escape(session) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#cancel(params = {}, opts = {}) ⇒ Object

A VerificationSession object can be canceled when it is in requires_input [status](docs.stripe.com/docs/identity/how-sessions-work).

Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](docs.stripe.com/docs/identity/verification-sessions#cancel).



296
297
298
299
300
301
302
303
# File 'lib/stripe/resources/identity/verification_session.rb', line 296

def cancel(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/identity/verification_sessions/%<session>s/cancel", { session: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#redact(params = {}, opts = {}) ⇒ Object

Redact a VerificationSession to remove all collected information from Stripe. This will redact the VerificationSession and all objects related to it, including VerificationReports, Events, request logs, etc.

A VerificationSession object can be redacted when it is in requires_input or verified [status](docs.stripe.com/docs/identity/how-sessions-work). Redacting a VerificationSession in requires_action state will automatically cancel it.

The redaction process may take up to four days. When the redaction process is in progress, the VerificationSession’s redaction.status field will be set to processing; when the process is finished, it will change to redacted and an identity.verification_session.redacted event will be emitted.

Redaction is irreversible. Redacted objects are still accessible in the Stripe API, but all the fields that contain personal data will be replaced by the string [redacted] or a similar placeholder. The metadata field will also be erased. Redacted objects cannot be updated or used for any purpose.

[Learn more](docs.stripe.com/docs/identity/verification-sessions#redact).



362
363
364
365
366
367
368
369
# File 'lib/stripe/resources/identity/verification_session.rb', line 362

def redact(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/identity/verification_sessions/%<session>s/redact", { session: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end