TaxId.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe;
  4. /**
  5. * You can add one or multiple tax IDs to a <a href="https://stripe.com/docs/api/customers">customer</a> or account.
  6. * Customer and account tax IDs get displayed on related invoices and credit notes.
  7. *
  8. * Related guides: <a href="https://stripe.com/docs/billing/taxes/tax-ids">Customer tax identification numbers</a>, <a href="https://stripe.com/docs/invoicing/connect#account-tax-ids">Account tax IDs</a>
  9. *
  10. * @property string $id Unique identifier for the object.
  11. * @property string $object String representing the object's type. Objects of the same type share the same value.
  12. * @property null|string $country Two-letter ISO code representing the country of the tax ID.
  13. * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
  14. * @property null|string|\Stripe\Customer $customer ID of the customer.
  15. * @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.
  16. * @property null|\Stripe\StripeObject $owner The account or customer the tax ID belongs to.
  17. * @property string $type Type of the tax ID, one of <code>ad_nrt</code>, <code>ae_trn</code>, <code>ar_cuit</code>, <code>au_abn</code>, <code>au_arn</code>, <code>bg_uic</code>, <code>bh_vat</code>, <code>bo_tin</code>, <code>br_cnpj</code>, <code>br_cpf</code>, <code>ca_bn</code>, <code>ca_gst_hst</code>, <code>ca_pst_bc</code>, <code>ca_pst_mb</code>, <code>ca_pst_sk</code>, <code>ca_qst</code>, <code>ch_uid</code>, <code>ch_vat</code>, <code>cl_tin</code>, <code>cn_tin</code>, <code>co_nit</code>, <code>cr_tin</code>, <code>de_stn</code>, <code>do_rcn</code>, <code>ec_ruc</code>, <code>eg_tin</code>, <code>es_cif</code>, <code>eu_oss_vat</code>, <code>eu_vat</code>, <code>gb_vat</code>, <code>ge_vat</code>, <code>hk_br</code>, <code>hu_tin</code>, <code>id_npwp</code>, <code>il_vat</code>, <code>in_gst</code>, <code>is_vat</code>, <code>jp_cn</code>, <code>jp_rn</code>, <code>jp_trn</code>, <code>ke_pin</code>, <code>kr_brn</code>, <code>kz_bin</code>, <code>li_uid</code>, <code>mx_rfc</code>, <code>my_frp</code>, <code>my_itn</code>, <code>my_sst</code>, <code>ng_tin</code>, <code>no_vat</code>, <code>no_voec</code>, <code>nz_gst</code>, <code>om_vat</code>, <code>pe_ruc</code>, <code>ph_tin</code>, <code>ro_tin</code>, <code>rs_pib</code>, <code>ru_inn</code>, <code>ru_kpp</code>, <code>sa_vat</code>, <code>sg_gst</code>, <code>sg_uen</code>, <code>si_tin</code>, <code>sv_nit</code>, <code>th_vat</code>, <code>tr_tin</code>, <code>tw_vat</code>, <code>ua_vat</code>, <code>us_ein</code>, <code>uy_ruc</code>, <code>ve_rif</code>, <code>vn_tin</code>, or <code>za_vat</code>. Note that some legacy tax IDs have type <code>unknown</code>
  18. * @property string $value Value of the tax ID.
  19. * @property null|\Stripe\StripeObject $verification Tax ID verification information.
  20. */
  21. class TaxId extends ApiResource
  22. {
  23. const OBJECT_NAME = 'tax_id';
  24. const TYPE_AD_NRT = 'ad_nrt';
  25. const TYPE_AE_TRN = 'ae_trn';
  26. const TYPE_AR_CUIT = 'ar_cuit';
  27. const TYPE_AU_ABN = 'au_abn';
  28. const TYPE_AU_ARN = 'au_arn';
  29. const TYPE_BG_UIC = 'bg_uic';
  30. const TYPE_BH_VAT = 'bh_vat';
  31. const TYPE_BO_TIN = 'bo_tin';
  32. const TYPE_BR_CNPJ = 'br_cnpj';
  33. const TYPE_BR_CPF = 'br_cpf';
  34. const TYPE_CA_BN = 'ca_bn';
  35. const TYPE_CA_GST_HST = 'ca_gst_hst';
  36. const TYPE_CA_PST_BC = 'ca_pst_bc';
  37. const TYPE_CA_PST_MB = 'ca_pst_mb';
  38. const TYPE_CA_PST_SK = 'ca_pst_sk';
  39. const TYPE_CA_QST = 'ca_qst';
  40. const TYPE_CH_UID = 'ch_uid';
  41. const TYPE_CH_VAT = 'ch_vat';
  42. const TYPE_CL_TIN = 'cl_tin';
  43. const TYPE_CN_TIN = 'cn_tin';
  44. const TYPE_CO_NIT = 'co_nit';
  45. const TYPE_CR_TIN = 'cr_tin';
  46. const TYPE_DE_STN = 'de_stn';
  47. const TYPE_DO_RCN = 'do_rcn';
  48. const TYPE_EC_RUC = 'ec_ruc';
  49. const TYPE_EG_TIN = 'eg_tin';
  50. const TYPE_ES_CIF = 'es_cif';
  51. const TYPE_EU_OSS_VAT = 'eu_oss_vat';
  52. const TYPE_EU_VAT = 'eu_vat';
  53. const TYPE_GB_VAT = 'gb_vat';
  54. const TYPE_GE_VAT = 'ge_vat';
  55. const TYPE_HK_BR = 'hk_br';
  56. const TYPE_HU_TIN = 'hu_tin';
  57. const TYPE_ID_NPWP = 'id_npwp';
  58. const TYPE_IL_VAT = 'il_vat';
  59. const TYPE_IN_GST = 'in_gst';
  60. const TYPE_IS_VAT = 'is_vat';
  61. const TYPE_JP_CN = 'jp_cn';
  62. const TYPE_JP_RN = 'jp_rn';
  63. const TYPE_JP_TRN = 'jp_trn';
  64. const TYPE_KE_PIN = 'ke_pin';
  65. const TYPE_KR_BRN = 'kr_brn';
  66. const TYPE_KZ_BIN = 'kz_bin';
  67. const TYPE_LI_UID = 'li_uid';
  68. const TYPE_MX_RFC = 'mx_rfc';
  69. const TYPE_MY_FRP = 'my_frp';
  70. const TYPE_MY_ITN = 'my_itn';
  71. const TYPE_MY_SST = 'my_sst';
  72. const TYPE_NG_TIN = 'ng_tin';
  73. const TYPE_NO_VAT = 'no_vat';
  74. const TYPE_NO_VOEC = 'no_voec';
  75. const TYPE_NZ_GST = 'nz_gst';
  76. const TYPE_OM_VAT = 'om_vat';
  77. const TYPE_PE_RUC = 'pe_ruc';
  78. const TYPE_PH_TIN = 'ph_tin';
  79. const TYPE_RO_TIN = 'ro_tin';
  80. const TYPE_RS_PIB = 'rs_pib';
  81. const TYPE_RU_INN = 'ru_inn';
  82. const TYPE_RU_KPP = 'ru_kpp';
  83. const TYPE_SA_VAT = 'sa_vat';
  84. const TYPE_SG_GST = 'sg_gst';
  85. const TYPE_SG_UEN = 'sg_uen';
  86. const TYPE_SI_TIN = 'si_tin';
  87. const TYPE_SV_NIT = 'sv_nit';
  88. const TYPE_TH_VAT = 'th_vat';
  89. const TYPE_TR_TIN = 'tr_tin';
  90. const TYPE_TW_VAT = 'tw_vat';
  91. const TYPE_UA_VAT = 'ua_vat';
  92. const TYPE_UNKNOWN = 'unknown';
  93. const TYPE_US_EIN = 'us_ein';
  94. const TYPE_UY_RUC = 'uy_ruc';
  95. const TYPE_VE_RIF = 've_rif';
  96. const TYPE_VN_TIN = 'vn_tin';
  97. const TYPE_ZA_VAT = 'za_vat';
  98. /**
  99. * Creates a new account or customer <code>tax_id</code> object.
  100. *
  101. * @param null|array $params
  102. * @param null|array|string $options
  103. *
  104. * @throws \Stripe\Exception\ApiErrorException if the request fails
  105. *
  106. * @return \Stripe\TaxId the created resource
  107. */
  108. public static function create($params = null, $options = null)
  109. {
  110. self::_validateParams($params);
  111. $url = static::classUrl();
  112. list($response, $opts) = static::_staticRequest('post', $url, $params, $options);
  113. $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts);
  114. $obj->setLastResponse($response);
  115. return $obj;
  116. }
  117. /**
  118. * Deletes an existing account or customer <code>tax_id</code> object.
  119. *
  120. * @param null|array $params
  121. * @param null|array|string $opts
  122. *
  123. * @throws \Stripe\Exception\ApiErrorException if the request fails
  124. *
  125. * @return \Stripe\TaxId the deleted resource
  126. */
  127. public function delete($params = null, $opts = null)
  128. {
  129. self::_validateParams($params);
  130. $url = $this->instanceUrl();
  131. list($response, $opts) = $this->_request('delete', $url, $params, $opts);
  132. $this->refreshFrom($response, $opts);
  133. return $this;
  134. }
  135. /**
  136. * Returns a list of tax IDs.
  137. *
  138. * @param null|array $params
  139. * @param null|array|string $opts
  140. *
  141. * @throws \Stripe\Exception\ApiErrorException if the request fails
  142. *
  143. * @return \Stripe\Collection<\Stripe\TaxId> of ApiResources
  144. */
  145. public static function all($params = null, $opts = null)
  146. {
  147. $url = static::classUrl();
  148. return static::_requestPage($url, \Stripe\Collection::class, $params, $opts);
  149. }
  150. /**
  151. * Retrieves an account or customer <code>tax_id</code> object.
  152. *
  153. * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key
  154. * @param null|array|string $opts
  155. *
  156. * @throws \Stripe\Exception\ApiErrorException if the request fails
  157. *
  158. * @return \Stripe\TaxId
  159. */
  160. public static function retrieve($id, $opts = null)
  161. {
  162. $opts = \Stripe\Util\RequestOptions::parse($opts);
  163. $instance = new static($id, $opts);
  164. $instance->refresh();
  165. return $instance;
  166. }
  167. const VERIFICATION_STATUS_PENDING = 'pending';
  168. const VERIFICATION_STATUS_UNAVAILABLE = 'unavailable';
  169. const VERIFICATION_STATUS_UNVERIFIED = 'unverified';
  170. const VERIFICATION_STATUS_VERIFIED = 'verified';
  171. }