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