TaxCode.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * <a href="https://stripe.com/docs/tax/tax-categories">Tax codes</a> classify goods and services for tax purposes.
  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 $description A detailed description of which types of products the tax code represents.
  10. * @property string $name A short name for the tax code.
  11. */
  12. class TaxCode extends ApiResource
  13. {
  14. const OBJECT_NAME = 'tax_code';
  15. /**
  16. * A list of <a href="https://stripe.com/docs/tax/tax-categories">all tax codes
  17. * available</a> to add to Products in order to allow specific tax calculations.
  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\TaxCode> 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. * Retrieves the details of an existing tax code. Supply the unique tax code ID and
  33. * Stripe will return the corresponding tax code information.
  34. *
  35. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  36. * @param null|array|string $opts
  37. *
  38. * @throws \Stripe\Exception\ApiErrorException if the request fails
  39. *
  40. * @return \Stripe\TaxCode
  41. */
  42. public static function retrieve($id, $opts = null)
  43. {
  44. $opts = \Stripe\Util\RequestOptions::parse($opts);
  45. $instance = new static($id, $opts);
  46. $instance->refresh();
  47. return $instance;
  48. }
  49. }