PayoutService.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. /**
  5. * @phpstan-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  6. * @psalm-import-type RequestOptionsArray from \Stripe\Util\RequestOptions
  7. */
  8. class PayoutService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of existing payouts sent to third-party bank accounts or payouts
  12. * that Stripe sent to you. The payouts return in sorted order, with the most
  13. * recently created payouts appearing first.
  14. *
  15. * @param null|array $params
  16. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  17. *
  18. * @throws \Stripe\Exception\ApiErrorException if the request fails
  19. *
  20. * @return \Stripe\Collection<\Stripe\Payout>
  21. */
  22. public function all($params = null, $opts = null)
  23. {
  24. return $this->requestCollection('get', '/v1/payouts', $params, $opts);
  25. }
  26. /**
  27. * You can cancel a previously created payout if its status is
  28. * <code>pending</code>. Stripe refunds the funds to your available balance. You
  29. * can’t cancel automatic Stripe payouts.
  30. *
  31. * @param string $id
  32. * @param null|array $params
  33. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  34. *
  35. * @throws \Stripe\Exception\ApiErrorException if the request fails
  36. *
  37. * @return \Stripe\Payout
  38. */
  39. public function cancel($id, $params = null, $opts = null)
  40. {
  41. return $this->request('post', $this->buildPath('/v1/payouts/%s/cancel', $id), $params, $opts);
  42. }
  43. /**
  44. * To send funds to your own bank account, create a new payout object. Your <a
  45. * href="#balance">Stripe balance</a> must cover the payout amount. If it doesn’t,
  46. * you receive an “Insufficient Funds” error.
  47. *
  48. * If your API key is in test mode, money won’t actually be sent, though every
  49. * other action occurs as if you’re in live mode.
  50. *
  51. * If you create a manual payout on a Stripe account that uses multiple payment
  52. * source types, you need to specify the source type balance that the payout draws
  53. * from. The <a href="#balance_object">balance object</a> details available and
  54. * pending amounts by source type.
  55. *
  56. * @param null|array $params
  57. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  58. *
  59. * @throws \Stripe\Exception\ApiErrorException if the request fails
  60. *
  61. * @return \Stripe\Payout
  62. */
  63. public function create($params = null, $opts = null)
  64. {
  65. return $this->request('post', '/v1/payouts', $params, $opts);
  66. }
  67. /**
  68. * Retrieves the details of an existing payout. Supply the unique payout ID from
  69. * either a payout creation request or the payout list. Stripe returns the
  70. * corresponding payout information.
  71. *
  72. * @param string $id
  73. * @param null|array $params
  74. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  75. *
  76. * @throws \Stripe\Exception\ApiErrorException if the request fails
  77. *
  78. * @return \Stripe\Payout
  79. */
  80. public function retrieve($id, $params = null, $opts = null)
  81. {
  82. return $this->request('get', $this->buildPath('/v1/payouts/%s', $id), $params, $opts);
  83. }
  84. /**
  85. * Reverses a payout by debiting the destination bank account. At this time, you
  86. * can only reverse payouts for connected accounts to US bank accounts. If the
  87. * payout is manual and in the <code>pending</code> status, use
  88. * <code>/v1/payouts/:id/cancel</code> instead.
  89. *
  90. * By requesting a reversal through <code>/v1/payouts/:id/reverse</code>, you
  91. * confirm that the authorized signatory of the selected bank account authorizes
  92. * the debit on the bank account and that no other authorization is required.
  93. *
  94. * @param string $id
  95. * @param null|array $params
  96. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  97. *
  98. * @throws \Stripe\Exception\ApiErrorException if the request fails
  99. *
  100. * @return \Stripe\Payout
  101. */
  102. public function reverse($id, $params = null, $opts = null)
  103. {
  104. return $this->request('post', $this->buildPath('/v1/payouts/%s/reverse', $id), $params, $opts);
  105. }
  106. /**
  107. * Updates the specified payout by setting the values of the parameters you pass.
  108. * We don’t change parameters that you don’t provide. This request only accepts the
  109. * metadata as arguments.
  110. *
  111. * @param string $id
  112. * @param null|array $params
  113. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  114. *
  115. * @throws \Stripe\Exception\ApiErrorException if the request fails
  116. *
  117. * @return \Stripe\Payout
  118. */
  119. public function update($id, $params = null, $opts = null)
  120. {
  121. return $this->request('post', $this->buildPath('/v1/payouts/%s', $id), $params, $opts);
  122. }
  123. }