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