ActiveEntitlement.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Entitlements;
  4. /**
  5. * An active entitlement describes access to a feature for a customer.
  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\Entitlements\Feature $feature The <a href="https://stripe.com/docs/api/entitlements/feature">Feature</a> that the customer is entitled to.
  10. * @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.
  11. * @property string $lookup_key A unique key you provide as your own system identifier. This may be up to 80 characters.
  12. */
  13. class ActiveEntitlement extends \Stripe\ApiResource
  14. {
  15. const OBJECT_NAME = 'entitlements.active_entitlement';
  16. /**
  17. * Retrieve a list of active entitlements for a customer.
  18. *
  19. * @param null|array $params
  20. * @param null|array|string $opts
  21. *
  22. * @throws \Stripe\Exception\ApiErrorException if the request fails
  23. *
  24. * @return \Stripe\Collection<\Stripe\Entitlements\ActiveEntitlement> of ApiResources
  25. */
  26. public static function all($params = null, $opts = null)
  27. {
  28. $url = static::classUrl();
  29. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  30. }
  31. /**
  32. * Retrieve an active entitlement.
  33. *
  34. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  35. * @param null|array|string $opts
  36. *
  37. * @throws \Stripe\Exception\ApiErrorException if the request fails
  38. *
  39. * @return \Stripe\Entitlements\ActiveEntitlement
  40. */
  41. public static function retrieve($id, $opts = null)
  42. {
  43. $opts = \Stripe\Util\RequestOptions::parse($opts);
  44. $instance = new static($id, $opts);
  45. $instance->refresh();
  46. return $instance;
  47. }
  48. }