PayoutService.php 4.6 KB

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