TransferService.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. class TransferService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * Returns a list of existing transfers sent to connected accounts. The transfers
  8. * are returned in sorted order, with the most recently created transfers appearing
  9. * 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/transfers', $params, $opts);
  21. }
  22. /**
  23. * You can see a list of the reversals belonging to a specific transfer. Note that
  24. * the 10 most recent reversals are always available by default on the transfer
  25. * object. If you need more than those 10, you can use this API method and the
  26. * <code>limit</code> and <code>starting_after</code> parameters to page through
  27. * additional reversals.
  28. *
  29. * @param string $parentId
  30. * @param null|array $params
  31. * @param null|array|\Stripe\Util\RequestOptions $opts
  32. *
  33. * @throws \Stripe\Exception\ApiErrorException if the request fails
  34. *
  35. * @return \Stripe\Collection
  36. */
  37. public function allReversals($parentId, $params = null, $opts = null)
  38. {
  39. return $this->requestCollection('get', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts);
  40. }
  41. /**
  42. * @param string $id
  43. * @param null|array $params
  44. * @param null|array|\Stripe\Util\RequestOptions $opts
  45. *
  46. * @throws \Stripe\Exception\ApiErrorException if the request fails
  47. *
  48. * @return \Stripe\Transfer
  49. */
  50. public function cancel($id, $params = null, $opts = null)
  51. {
  52. return $this->request('post', $this->buildPath('/v1/transfers/%s/cancel', $id), $params, $opts);
  53. }
  54. /**
  55. * To send funds from your Stripe account to a connected account, you create a new
  56. * transfer object. Your <a href="#balance">Stripe balance</a> must be able to
  57. * cover the transfer amount, or you’ll receive an “Insufficient Funds” error.
  58. *
  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\Transfer
  65. */
  66. public function create($params = null, $opts = null)
  67. {
  68. return $this->request('post', '/v1/transfers', $params, $opts);
  69. }
  70. /**
  71. * When you create a new reversal, you must specify a transfer to create it on.
  72. *
  73. * When reversing transfers, you can optionally reverse part of the transfer. You
  74. * can do so as many times as you wish until the entire transfer has been reversed.
  75. *
  76. * Once entirely reversed, a transfer can’t be reversed again. This method will
  77. * return an error when called on an already-reversed transfer, or when trying to
  78. * reverse more money than is left on a transfer.
  79. *
  80. * @param string $parentId
  81. * @param null|array $params
  82. * @param null|array|\Stripe\Util\RequestOptions $opts
  83. *
  84. * @throws \Stripe\Exception\ApiErrorException if the request fails
  85. *
  86. * @return \Stripe\TransferReversal
  87. */
  88. public function createReversal($parentId, $params = null, $opts = null)
  89. {
  90. return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals', $parentId), $params, $opts);
  91. }
  92. /**
  93. * Retrieves the details of an existing transfer. Supply the unique transfer ID
  94. * from either a transfer creation request or the transfer list, and Stripe will
  95. * return the corresponding transfer information.
  96. *
  97. * @param string $id
  98. * @param null|array $params
  99. * @param null|array|\Stripe\Util\RequestOptions $opts
  100. *
  101. * @throws \Stripe\Exception\ApiErrorException if the request fails
  102. *
  103. * @return \Stripe\Transfer
  104. */
  105. public function retrieve($id, $params = null, $opts = null)
  106. {
  107. return $this->request('get', $this->buildPath('/v1/transfers/%s', $id), $params, $opts);
  108. }
  109. /**
  110. * By default, you can see the 10 most recent reversals stored directly on the
  111. * transfer object, but you can also retrieve details about a specific reversal
  112. * stored on the transfer.
  113. *
  114. * @param string $parentId
  115. * @param string $id
  116. * @param null|array $params
  117. * @param null|array|\Stripe\Util\RequestOptions $opts
  118. *
  119. * @throws \Stripe\Exception\ApiErrorException if the request fails
  120. *
  121. * @return \Stripe\TransferReversal
  122. */
  123. public function retrieveReversal($parentId, $id, $params = null, $opts = null)
  124. {
  125. return $this->request('get', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts);
  126. }
  127. /**
  128. * Updates the specified transfer by setting the values of the parameters passed.
  129. * Any parameters not provided will be left unchanged.
  130. *
  131. * This request accepts only metadata as an argument.
  132. *
  133. * @param string $id
  134. * @param null|array $params
  135. * @param null|array|\Stripe\Util\RequestOptions $opts
  136. *
  137. * @throws \Stripe\Exception\ApiErrorException if the request fails
  138. *
  139. * @return \Stripe\Transfer
  140. */
  141. public function update($id, $params = null, $opts = null)
  142. {
  143. return $this->request('post', $this->buildPath('/v1/transfers/%s', $id), $params, $opts);
  144. }
  145. /**
  146. * Updates the specified reversal by setting the values of the parameters passed.
  147. * Any parameters not provided will be left unchanged.
  148. *
  149. * This request only accepts metadata and description as arguments.
  150. *
  151. * @param string $parentId
  152. * @param string $id
  153. * @param null|array $params
  154. * @param null|array|\Stripe\Util\RequestOptions $opts
  155. *
  156. * @throws \Stripe\Exception\ApiErrorException if the request fails
  157. *
  158. * @return \Stripe\TransferReversal
  159. */
  160. public function updateReversal($parentId, $id, $params = null, $opts = null)
  161. {
  162. return $this->request('post', $this->buildPath('/v1/transfers/%s/reversals/%s', $parentId, $id), $params, $opts);
  163. }
  164. }