AccountService.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  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<\Stripe\Account>
  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<\Stripe\Capability>
  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<\Stripe\BankAccount|\Stripe\Card>
  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<\Stripe\Person>
  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 accounts you manage.
  139. *
  140. * Accounts created using test-mode keys can be deleted at any time. Standard
  141. * accounts created using live-mode keys cannot be deleted. Custom or Express
  142. * accounts created using live-mode keys can only be deleted once all balances are
  143. * zero.
  144. *
  145. * If you want to delete your own account, use the <a
  146. * href="https://dashboard.stripe.com/account">account information tab in your
  147. * account settings</a> instead.
  148. *
  149. * @param string $id
  150. * @param null|array $params
  151. * @param null|array|\Stripe\Util\RequestOptions $opts
  152. *
  153. * @throws \Stripe\Exception\ApiErrorException if the request fails
  154. *
  155. * @return \Stripe\Account
  156. */
  157. public function delete($id, $params = null, $opts = null)
  158. {
  159. return $this->request('delete', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
  160. }
  161. /**
  162. * Delete a specified external account for a given account.
  163. *
  164. * @param string $parentId
  165. * @param string $id
  166. * @param null|array $params
  167. * @param null|array|\Stripe\Util\RequestOptions $opts
  168. *
  169. * @throws \Stripe\Exception\ApiErrorException if the request fails
  170. *
  171. * @return \Stripe\BankAccount|\Stripe\Card
  172. */
  173. public function deleteExternalAccount($parentId, $id, $params = null, $opts = null)
  174. {
  175. return $this->request('delete', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
  176. }
  177. /**
  178. * Deletes an existing person’s relationship to the account’s legal entity. Any
  179. * person with a relationship for an account can be deleted through the API, except
  180. * if the person is the <code>account_opener</code>. If your integration is using
  181. * the <code>executive</code> parameter, you cannot delete the only verified
  182. * <code>executive</code> on file.
  183. *
  184. * @param string $parentId
  185. * @param string $id
  186. * @param null|array $params
  187. * @param null|array|\Stripe\Util\RequestOptions $opts
  188. *
  189. * @throws \Stripe\Exception\ApiErrorException if the request fails
  190. *
  191. * @return \Stripe\Person
  192. */
  193. public function deletePerson($parentId, $id, $params = null, $opts = null)
  194. {
  195. return $this->request('delete', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
  196. }
  197. /**
  198. * With <a href="/docs/connect">Connect</a>, you may flag accounts as suspicious.
  199. *
  200. * Test-mode Custom and Express accounts can be rejected at any time. Accounts
  201. * created using live-mode keys may only be rejected once all balances are zero.
  202. *
  203. * @param string $id
  204. * @param null|array $params
  205. * @param null|array|\Stripe\Util\RequestOptions $opts
  206. *
  207. * @throws \Stripe\Exception\ApiErrorException if the request fails
  208. *
  209. * @return \Stripe\Account
  210. */
  211. public function reject($id, $params = null, $opts = null)
  212. {
  213. return $this->request('post', $this->buildPath('/v1/accounts/%s/reject', $id), $params, $opts);
  214. }
  215. /**
  216. * Retrieves information about the specified Account Capability.
  217. *
  218. * @param string $parentId
  219. * @param string $id
  220. * @param null|array $params
  221. * @param null|array|\Stripe\Util\RequestOptions $opts
  222. *
  223. * @throws \Stripe\Exception\ApiErrorException if the request fails
  224. *
  225. * @return \Stripe\Capability
  226. */
  227. public function retrieveCapability($parentId, $id, $params = null, $opts = null)
  228. {
  229. return $this->request('get', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts);
  230. }
  231. /**
  232. * Retrieve a specified external account for a given account.
  233. *
  234. * @param string $parentId
  235. * @param string $id
  236. * @param null|array $params
  237. * @param null|array|\Stripe\Util\RequestOptions $opts
  238. *
  239. * @throws \Stripe\Exception\ApiErrorException if the request fails
  240. *
  241. * @return \Stripe\BankAccount|\Stripe\Card
  242. */
  243. public function retrieveExternalAccount($parentId, $id, $params = null, $opts = null)
  244. {
  245. return $this->request('get', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
  246. }
  247. /**
  248. * Retrieves an existing person.
  249. *
  250. * @param string $parentId
  251. * @param string $id
  252. * @param null|array $params
  253. * @param null|array|\Stripe\Util\RequestOptions $opts
  254. *
  255. * @throws \Stripe\Exception\ApiErrorException if the request fails
  256. *
  257. * @return \Stripe\Person
  258. */
  259. public function retrievePerson($parentId, $id, $params = null, $opts = null)
  260. {
  261. return $this->request('get', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
  262. }
  263. /**
  264. * Updates a <a href="/docs/connect/accounts">connected account</a> by setting the
  265. * values of the parameters passed. Any parameters not provided are left unchanged.
  266. * Most parameters can be changed only for Custom accounts. (These are marked
  267. * <strong>Custom Only</strong> below.) Parameters marked <strong>Custom and
  268. * Express</strong> are not supported for Standard accounts.
  269. *
  270. * To update your own account, use the <a
  271. * href="https://dashboard.stripe.com/account">Dashboard</a>. Refer to our <a
  272. * href="/docs/connect/updating-accounts">Connect</a> documentation to learn more
  273. * about updating accounts.
  274. *
  275. * @param string $id
  276. * @param null|array $params
  277. * @param null|array|\Stripe\Util\RequestOptions $opts
  278. *
  279. * @throws \Stripe\Exception\ApiErrorException if the request fails
  280. *
  281. * @return \Stripe\Account
  282. */
  283. public function update($id, $params = null, $opts = null)
  284. {
  285. return $this->request('post', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
  286. }
  287. /**
  288. * Updates an existing Account Capability.
  289. *
  290. * @param string $parentId
  291. * @param string $id
  292. * @param null|array $params
  293. * @param null|array|\Stripe\Util\RequestOptions $opts
  294. *
  295. * @throws \Stripe\Exception\ApiErrorException if the request fails
  296. *
  297. * @return \Stripe\Capability
  298. */
  299. public function updateCapability($parentId, $id, $params = null, $opts = null)
  300. {
  301. return $this->request('post', $this->buildPath('/v1/accounts/%s/capabilities/%s', $parentId, $id), $params, $opts);
  302. }
  303. /**
  304. * Updates the metadata, account holder name, account holder type of a bank account
  305. * belonging to a <a href="/docs/connect/custom-accounts">Custom account</a>, and
  306. * optionally sets it as the default for its currency. Other bank account details
  307. * are not editable by design.
  308. *
  309. * You can re-enable a disabled bank account by performing an update call without
  310. * providing any arguments or changes.
  311. *
  312. * @param string $parentId
  313. * @param string $id
  314. * @param null|array $params
  315. * @param null|array|\Stripe\Util\RequestOptions $opts
  316. *
  317. * @throws \Stripe\Exception\ApiErrorException if the request fails
  318. *
  319. * @return \Stripe\BankAccount|\Stripe\Card
  320. */
  321. public function updateExternalAccount($parentId, $id, $params = null, $opts = null)
  322. {
  323. return $this->request('post', $this->buildPath('/v1/accounts/%s/external_accounts/%s', $parentId, $id), $params, $opts);
  324. }
  325. /**
  326. * Updates an existing person.
  327. *
  328. * @param string $parentId
  329. * @param string $id
  330. * @param null|array $params
  331. * @param null|array|\Stripe\Util\RequestOptions $opts
  332. *
  333. * @throws \Stripe\Exception\ApiErrorException if the request fails
  334. *
  335. * @return \Stripe\Person
  336. */
  337. public function updatePerson($parentId, $id, $params = null, $opts = null)
  338. {
  339. return $this->request('post', $this->buildPath('/v1/accounts/%s/persons/%s', $parentId, $id), $params, $opts);
  340. }
  341. /**
  342. * Retrieves the details of an account.
  343. *
  344. * @param null|string $id
  345. * @param null|array $params
  346. * @param null|array|StripeUtilRequestOptions $opts
  347. *
  348. * @throws \Stripe\Exception\ApiErrorException if the request fails
  349. *
  350. * @return \Stripe\Account
  351. */
  352. public function retrieve($id = null, $params = null, $opts = null)
  353. {
  354. if (null === $id) {
  355. return $this->request('get', '/v1/account', $params, $opts);
  356. }
  357. return $this->request('get', $this->buildPath('/v1/accounts/%s', $id), $params, $opts);
  358. }
  359. }