EphemeralKey.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * @property string $id Unique identifier for the object.
  6. * @property string $object String representing the object's type. Objects of the same type share the same value.
  7. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  8. * @property int $expires Time at which the key will expire. Measured in seconds since the Unix epoch.
  9. * @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.
  10. * @property string $secret The key's secret. You can use this value to make authorized requests to the Stripe API.
  11. * @property array $associated_objects
  12. */
  13. class EphemeralKey extends ApiResource
  14. {
  15. const OBJECT_NAME = 'ephemeral_key';
  16. use ApiOperations\Create {
  17. create as protected _create;
  18. }
  19. use ApiOperations\Delete;
  20. /**
  21. * @param null|array $params
  22. * @param null|array|string $opts
  23. *
  24. * @throws \Stripe\Exception\InvalidArgumentException if stripe_version is missing
  25. * @throws \Stripe\Exception\ApiErrorException if the request fails
  26. *
  27. * @return \Stripe\EphemeralKey the created key
  28. */
  29. public static function create($params = null, $opts = null)
  30. {
  31. if (!$opts || !isset($opts['stripe_version'])) {
  32. throw new Exception\InvalidArgumentException('stripe_version must be specified to create an ephemeral key');
  33. }
  34. return self::_create($params, $opts);
  35. }
  36. }