AccountService.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. class AccountService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * Returns a list of accounts connected to your platform via <a
  8. * href="/docs/connect">Connect</a>. If you’re not a platform, the list is empty.
  9. *
  10. * @param null|array $params
  11. * @param null|array|\Stripe\Util\RequestOptions $opts
  12. *
  13. * @throws \Stripe\Exception\ApiErrorException if the request fails
  14. *
  15. * @return \Stripe\Collection
  16. */
  17. public function all($params = null, $opts = null)
  18. {
  19. return $this->requestCollection('get', '/v1/accounts', $params, $opts);
  20. }
  21. /**
  22. * Returns a list of capabilities associated with the account. The capabilities are
  23. * returned sorted by creation date, with the most recent capability appearing
  24. * first.
  25. *
  26. * @param string $parentId
  27. * @param null|array $params
  28. * @param null|array|\Stripe\Util\RequestOptions $opts
  29. *
  30. * @throws \Stripe\Exception\ApiErrorException if the request fails
  31. *
  32. * @return \Stripe\Collection
  33. */
  34. public function allCapabilities($parentId, $params = null, $opts = null)
  35. {
  36. return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/capabilities', $parentId), $params, $opts);
  37. }
  38. /**
  39. * List external accounts for an account.
  40. *
  41. * @param string $parentId
  42. * @param null|array $params
  43. * @param null|array|\Stripe\Util\RequestOptions $opts
  44. *
  45. * @throws \Stripe\Exception\ApiErrorException if the request fails
  46. *
  47. * @return \Stripe\Collection
  48. */
  49. public function allExternalAccounts($parentId, $params = null, $opts = null)
  50. {
  51. return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts);
  52. }
  53. /**
  54. * Returns a list of people associated with the account’s legal entity. The people
  55. * are returned sorted by creation date, with the most recent people appearing
  56. * first.
  57. *
  58. * @param string $parentId
  59. * @param null|array $params
  60. * @param null|array|\Stripe\Util\RequestOptions $opts
  61. *
  62. * @throws \Stripe\Exception\ApiErrorException if the request fails
  63. *
  64. * @return \Stripe\Collection
  65. */
  66. public function allPersons($parentId, $params = null, $opts = null)
  67. {
  68. return $this->requestCollection('get', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts);
  69. }
  70. /**
  71. * With <a href="/docs/connect">Connect</a>, you can create Stripe accounts for
  72. * your users. To do this, you’ll first need to <a
  73. * href="https://dashboard.stripe.com/account/applications/settings">register your
  74. * platform</a>.
  75. *
  76. * @param null|array $params
  77. * @param null|array|\Stripe\Util\RequestOptions $opts
  78. *
  79. * @throws \Stripe\Exception\ApiErrorException if the request fails
  80. *
  81. * @return \Stripe\Account
  82. */
  83. public function create($params = null, $opts = null)
  84. {
  85. return $this->request('post', '/v1/accounts', $params, $opts);
  86. }
  87. /**
  88. * Create an external account for a given account.
  89. *
  90. * @param string $parentId
  91. * @param null|array $params
  92. * @param null|array|\Stripe\Util\RequestOptions $opts
  93. *
  94. * @throws \Stripe\Exception\ApiErrorException if the request fails
  95. *
  96. * @return \Stripe\BankAccount|\Stripe\Card
  97. */
  98. public function createExternalAccount($parentId, $params = null, $opts = null)
  99. {
  100. return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts', $parentId), $params, $opts);
  101. }
  102. /**
  103. * Creates a single-use login link for an Express account to access their Stripe
  104. * dashboard.
  105. *
  106. * <strong>You may only create login links for <a
  107. * href="/docs/connect/express-accounts">Express accounts</a> connected to your
  108. * platform</strong>.
  109. *
  110. * @param string $parentId
  111. * @param null|array $params
  112. * @param null|array|\Stripe\Util\RequestOptions $opts
  113. *
  114. * @throws \Stripe\Exception\ApiErrorException if the request fails
  115. *
  116. * @return \Stripe\LoginLink
  117. */
  118. public function createLoginLink($parentId, $params = null, $opts = null)
  119. {
  120. return $this->request('post', $this->buildPath('/v1/accounts/%s/login_links', $parentId), $params, $opts);
  121. }
  122. /**
  123. * Creates a new person.
  124. *
  125. * @param string $parentId
  126. * @param null|array $params
  127. * @param null|array|\Stripe\Util\RequestOptions $opts
  128. *
  129. * @throws \Stripe\Exception\ApiErrorException if the request fails
  130. *
  131. * @return \Stripe\Person
  132. */
  133. public function createPerson($parentId, $params = null, $opts = null)
  134. {
  135. return $this->request('post', $this->buildPath('/v1/accounts/%s/persons', $parentId), $params, $opts);
  136. }
  137. /**
  138. * With <a href="/docs/connect">Connect</a>, you can delete Custom or Express
  139. * accounts you manage.
  140. *
  141. * Accounts created using test-mode keys can be deleted at any time. Accounts
  142. * created using live-mode keys can only be deleted once all balances are zero.
  143. *
  144. * If you want to delete your own account, use the <a
  145. * href="https://dashboard.stripe.com/account">account information tab in your
  146. * account settings</a> instead.
  147. *
  148. * @param string $id
  149. * @param null|array $params
  150. * @param null|array|\Stripe\Util\RequestOptions $opts
  151. *
  152. * @throws \Stripe\Exception\ApiErrorException if the request fails
  153. *
  154. * @return \Stripe\Account
  155. */
  156. public function delete($id, $params = null, $opts = null)
  157. {
  158. return $this->request('delete', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
  159. }
  160. /**
  161. * Delete a specified external account for a given account.
  162. *
  163. * @param string $parentId
  164. * @param string $id
  165. * @param null|array $params
  166. * @param null|array|\Stripe\Util\RequestOptions $opts
  167. *
  168. * @throws \Stripe\Exception\ApiErrorException if the request fails
  169. *
  170. * @return \Stripe\BankAccount|\Stripe\Card
  171. */
  172. public function deleteExternalAccount($parentId, $id, $params = null, $opts = null)
  173. {
  174. return $this->request('delete', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
  175. }
  176. /**
  177. * Deletes an existing person’s relationship to the account’s legal entity. Any
  178. * person with a relationship for an account can be deleted through the API, except
  179. * if the person is the <code>account_opener</code>. If your integration is using
  180. * the <code>executive</code> parameter, you cannot delete the only verified
  181. * <code>executive</code> on file.
  182. *
  183. * @param string $parentId
  184. * @param string $id
  185. * @param null|array $params
  186. * @param null|array|\Stripe\Util\RequestOptions $opts
  187. *
  188. * @throws \Stripe\Exception\ApiErrorException if the request fails
  189. *
  190. * @return \Stripe\Person
  191. */
  192. public function deletePerson($parentId, $id, $params = null, $opts = null)
  193. {
  194. return $this->request('delete', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
  195. }
  196. /**
  197. * With <a href="/docs/connect">Connect</a>, you may flag accounts as suspicious.
  198. *
  199. * Test-mode Custom and Express accounts can be rejected at any time. Accounts
  200. * created using live-mode keys may only be rejected once all balances are zero.
  201. *
  202. * @param string $id
  203. * @param null|array $params
  204. * @param null|array|\Stripe\Util\RequestOptions $opts
  205. *
  206. * @throws \Stripe\Exception\ApiErrorException if the request fails
  207. *
  208. * @return \Stripe\Account
  209. */
  210. public function reject($id, $params = null, $opts = null)
  211. {
  212. return $this->request('post', $this->buildPath('/v1/accounts/%s/reject', $id), $params, $opts);
  213. }
  214. /**
  215. * Retrieves information about the specified Account Capability.
  216. *
  217. * @param string $parentId
  218. * @param string $id
  219. * @param null|array $params
  220. * @param null|array|\Stripe\Util\RequestOptions $opts
  221. *
  222. * @throws \Stripe\Exception\ApiErrorException if the request fails
  223. *
  224. * @return \Stripe\Capability
  225. */
  226. public function retrieveCapability($parentId, $id, $params = null, $opts = null)
  227. {
  228. return $this->request('get', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts);
  229. }
  230. /**
  231. * Retrieve a specified external account for a given account.
  232. *
  233. * @param string $parentId
  234. * @param string $id
  235. * @param null|array $params
  236. * @param null|array|\Stripe\Util\RequestOptions $opts
  237. *
  238. * @throws \Stripe\Exception\ApiErrorException if the request fails
  239. *
  240. * @return \Stripe\BankAccount|\Stripe\Card
  241. */
  242. public function retrieveExternalAccount($parentId, $id, $params = null, $opts = null)
  243. {
  244. return $this->request('get', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
  245. }
  246. /**
  247. * Retrieves an existing person.
  248. *
  249. * @param string $parentId
  250. * @param string $id
  251. * @param null|array $params
  252. * @param null|array|\Stripe\Util\RequestOptions $opts
  253. *
  254. * @throws \Stripe\Exception\ApiErrorException if the request fails
  255. *
  256. * @return \Stripe\Person
  257. */
  258. public function retrievePerson($parentId, $id, $params = null, $opts = null)
  259. {
  260. return $this->request('get', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
  261. }
  262. /**
  263. * Updates a connected <a href="/docs/connect/accounts">Express or Custom
  264. * account</a> by setting the values of the parameters passed. Any parameters not
  265. * provided are left unchanged. Most parameters can be changed only for Custom
  266. * accounts. (These are marked <strong>Custom Only</strong> below.) Parameters
  267. * marked <strong>Custom and Express</strong> are supported by both account types.
  268. *
  269. * To update your own account, use the <a
  270. * href="https://dashboard.stripe.com/account">Dashboard</a>. Refer to our <a
  271. * href="/docs/connect/updating-accounts">Connect</a> documentation to learn more
  272. * about updating accounts.
  273. *
  274. * @param string $id
  275. * @param null|array $params
  276. * @param null|array|\Stripe\Util\RequestOptions $opts
  277. *
  278. * @throws \Stripe\Exception\ApiErrorException if the request fails
  279. *
  280. * @return \Stripe\Account
  281. */
  282. public function update($id, $params = null, $opts = null)
  283. {
  284. return $this->request('post', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
  285. }
  286. /**
  287. * Updates an existing Account Capability.
  288. *
  289. * @param string $parentId
  290. * @param string $id
  291. * @param null|array $params
  292. * @param null|array|\Stripe\Util\RequestOptions $opts
  293. *
  294. * @throws \Stripe\Exception\ApiErrorException if the request fails
  295. *
  296. * @return \Stripe\Capability
  297. */
  298. public function updateCapability($parentId, $id, $params = null, $opts = null)
  299. {
  300. return $this->request('post', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts);
  301. }
  302. /**
  303. * Updates the metadata, account holder name, and account holder type of a bank
  304. * account belonging to a <a href="/docs/connect/custom-accounts">Custom
  305. * account</a>, and optionally sets it as the default for its currency. Other bank
  306. * account details are not editable by design.
  307. *
  308. * You can re-enable a disabled bank account by performing an update call without
  309. * providing any arguments or changes.
  310. *
  311. * @param string $parentId
  312. * @param string $id
  313. * @param null|array $params
  314. * @param null|array|\Stripe\Util\RequestOptions $opts
  315. *
  316. * @throws \Stripe\Exception\ApiErrorException if the request fails
  317. *
  318. * @return \Stripe\BankAccount|\Stripe\Card
  319. */
  320. public function updateExternalAccount($parentId, $id, $params = null, $opts = null)
  321. {
  322. return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
  323. }
  324. /**
  325. * Updates an existing person.
  326. *
  327. * @param string $parentId
  328. * @param string $id
  329. * @param null|array $params
  330. * @param null|array|\Stripe\Util\RequestOptions $opts
  331. *
  332. * @throws \Stripe\Exception\ApiErrorException if the request fails
  333. *
  334. * @return \Stripe\Person
  335. */
  336. public function updatePerson($parentId, $id, $params = null, $opts = null)
  337. {
  338. return $this->request('post', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
  339. }
  340. /**
  341. * Retrieves the details of an account.
  342. *
  343. * @param null|string $id
  344. * @param null|array $params
  345. * @param null|array|StripeUtilRequestOptions $opts
  346. *
  347. * @throws \Stripe\Exception\ApiErrorException if the request fails
  348. *
  349. * @return \Stripe\Account
  350. */
  351. public function retrieve($id = null, $params = null, $opts = null)
  352. {
  353. if (null === $id) {
  354. return $this->request('get', '/v1/account', $params, $opts);
  355. }
  356. return $this->request('get', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
  357. }
  358. }