VerificationSession.php 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Identity;
  4. /**
  5. * A VerificationSession guides you through the process of collecting and verifying
  6. * the identities of your users. It contains details about the type of
  7. * verification, such as what <a
  8. * href="/docs/identity/verification-checks">verification check</a> to perform.
  9. * Only create one VerificationSession for each verification in your system.
  10. *
  11. * A VerificationSession transitions through <a
  12. * href="/docs/identity/how-sessions-work">multiple statuses</a> throughout its
  13. * lifetime as it progresses through the verification flow. The VerificationSession
  14. * contains the user's verified data after verification checks are complete.
  15. *
  16. * Related guide: <a
  17. * href="https://stripe.com/docs/identity/verification-sessions">The Verification
  18. * Sessions API</a>
  19. *
  20. * @property string $id Unique identifier for the object.
  21. * @property string $object String representing the object's type. Objects of the same type share the same value.
  22. * @property null|string $client_secret The short-lived client secret used by Stripe.js to <a href="https://stripe.com/docs/js/identity/modal">show a verification modal</a> 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 <a href="https://stripe.com/docs/identity/verification-sessions#client-secret">passing the client secret to the frontend</a> to learn more.
  23. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  24. * @property null|\Stripe\StripeObject $last_error If present, this property tells you the last error encountered when processing the verification.
  25. * @property null|string|\Stripe\Identity\VerificationReport $last_verification_report ID of the most recent VerificationReport. <a href="https://stripe.com/docs/identity/verification-sessions#results">Learn more about accessing detailed verification results.</a>
  26. * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
  27. * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  28. * @property \Stripe\StripeObject $options
  29. * @property null|\Stripe\StripeObject $redaction Redaction status of this VerificationSession. If the VerificationSession is not redacted, this field will be null.
  30. * @property string $status Status of this VerificationSession. <a href="https://stripe.com/docs/identity/how-sessions-work">Learn more about the lifecycle of sessions</a>.
  31. * @property string $type The type of <a href="https://stripe.com/docs/identity/verification-checks">verification check</a> to be performed.
  32. * @property null|string $url 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 <a href="https://stripe.com/docs/identity/verify-identity-documents?platform=web&amp;type=redirect">verifying identity documents</a> to learn how to redirect users to Stripe.
  33. * @property null|\Stripe\StripeObject $verified_outputs The user’s verified data.
  34. */
  35. class VerificationSession extends \Stripe\ApiResource
  36. {
  37. const OBJECT_NAME = 'identity.verification_session';
  38. use \Stripe\ApiOperations\All;
  39. use \Stripe\ApiOperations\Create;
  40. use \Stripe\ApiOperations\Retrieve;
  41. use \Stripe\ApiOperations\Update;
  42. const STATUS_CANCELED = 'canceled';
  43. const STATUS_PROCESSING = 'processing';
  44. const STATUS_REQUIRES_INPUT = 'requires_input';
  45. const STATUS_VERIFIED = 'verified';
  46. const TYPE_DOCUMENT = 'document';
  47. const TYPE_ID_NUMBER = 'id_number';
  48. /**
  49. * @param null|array $params
  50. * @param null|array|string $opts
  51. *
  52. * @throws \Stripe\Exception\ApiErrorException if the request fails
  53. *
  54. * @return \Stripe\Identity\VerificationSession the canceled verification session
  55. */
  56. public function cancel($params = null, $opts = null)
  57. {
  58. $url = $this->instanceUrl() . '/cancel';
  59. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  60. $this->refreshFrom($response, $opts);
  61. return $this;
  62. }
  63. /**
  64. * @param null|array $params
  65. * @param null|array|string $opts
  66. *
  67. * @throws \Stripe\Exception\ApiErrorException if the request fails
  68. *
  69. * @return \Stripe\Identity\VerificationSession the redacted verification session
  70. */
  71. public function redact($params = null, $opts = null)
  72. {
  73. $url = $this->instanceUrl() . '/redact';
  74. list($response, $opts) = $this->_request('post', $url, $params, $opts);
  75. $this->refreshFrom($response, $opts);
  76. return $this;
  77. }
  78. }