Token.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Issuing;
  4. /**
  5. * An issuing token object is created when an issued card is added to a digital wallet. As a <a href="https://stripe.com/docs/issuing">card issuer</a>, you can <a href="https://stripe.com/docs/issuing/controls/token-management">view and manage these tokens</a> through Stripe.
  6. *
  7. * @property string $id Unique identifier for the object.
  8. * @property string $object String representing the object's type. Objects of the same type share the same value.
  9. * @property string|\Stripe\Issuing\Card $card Card associated with this token.
  10. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  11. * @property null|string $device_fingerprint The hashed ID derived from the device ID from the card network associated with the token.
  12. * @property null|string $last4 The last four digits of the token.
  13. * @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.
  14. * @property string $network The token service provider / card network associated with the token.
  15. * @property null|\Stripe\StripeObject $network_data
  16. * @property int $network_updated_at Time at which the token was last updated by the card network. Measured in seconds since the Unix epoch.
  17. * @property string $status The usage state of the token.
  18. * @property null|string $wallet_provider The digital wallet for this token, if one was used.
  19. */
  20. class Token extends \Stripe\ApiResource
  21. {
  22. const OBJECT_NAME = 'issuing.token';
  23. use \Stripe\ApiOperations\Update;
  24. const NETWORK_MASTERCARD = 'mastercard';
  25. const NETWORK_VISA = 'visa';
  26. const STATUS_ACTIVE = 'active';
  27. const STATUS_DELETED = 'deleted';
  28. const STATUS_REQUESTED = 'requested';
  29. const STATUS_SUSPENDED = 'suspended';
  30. const WALLET_PROVIDER_APPLE_PAY = 'apple_pay';
  31. const WALLET_PROVIDER_GOOGLE_PAY = 'google_pay';
  32. const WALLET_PROVIDER_SAMSUNG_PAY = 'samsung_pay';
  33. /**
  34. * Lists all Issuing <code>Token</code> objects for a given card.
  35. *
  36. * @param null|array $params
  37. * @param null|array|string $opts
  38. *
  39. * @throws \Stripe\Exception\ApiErrorException if the request fails
  40. *
  41. * @return \Stripe\Collection<\Stripe\Issuing\Token> of ApiResources
  42. */
  43. public static function all($params = null, $opts = null)
  44. {
  45. $url = static::classUrl();
  46. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  47. }
  48. /**
  49. * Retrieves an Issuing <code>Token</code> object.
  50. *
  51. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  52. * @param null|array|string $opts
  53. *
  54. * @throws \Stripe\Exception\ApiErrorException if the request fails
  55. *
  56. * @return \Stripe\Issuing\Token
  57. */
  58. public static function retrieve($id, $opts = null)
  59. {
  60. $opts = \Stripe\Util\RequestOptions::parse($opts);
  61. $instance = new static($id, $opts);
  62. $instance->refresh();
  63. return $instance;
  64. }
  65. /**
  66. * Attempts to update the specified Issuing <code>Token</code> object to the status
  67. * specified.
  68. *
  69. * @param string $id the ID of the resource to update
  70. * @param null|array $params
  71. * @param null|array|string $opts
  72. *
  73. * @throws \Stripe\Exception\ApiErrorException if the request fails
  74. *
  75. * @return \Stripe\Issuing\Token the updated resource
  76. */
  77. public static function update($id, $params = null, $opts = null)
  78. {
  79. self::_validateParams($params);
  80. $url = static::resourceUrl($id);
  81. list($response, $opts) = static::_staticRequest('post', $url, $params, $opts);
  82. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  83. $obj->setLastResponse($response);
  84. return $obj;
  85. }
  86. }