ApplicationFeeService.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 ApplicationFeeService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of application fees you’ve previously collected. The application
  12. * fees are returned in sorted order, with the most recent fees appearing first.
  13. *
  14. * @param null|array $params
  15. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  16. *
  17. * @throws \Stripe\Exception\ApiErrorException if the request fails
  18. *
  19. * @return \Stripe\Collection<\Stripe\ApplicationFee>
  20. */
  21. public function all($params = null, $opts = null)
  22. {
  23. return $this->requestCollection('get', '/v1/application_fees', $params, $opts);
  24. }
  25. /**
  26. * You can see a list of the refunds belonging to a specific application fee. Note
  27. * that the 10 most recent refunds are always available by default on the
  28. * application fee object. If you need more than those 10, you can use this API
  29. * method and the <code>limit</code> and <code>starting_after</code> parameters to
  30. * page through additional refunds.
  31. *
  32. * @param string $parentId
  33. * @param null|array $params
  34. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  35. *
  36. * @throws \Stripe\Exception\ApiErrorException if the request fails
  37. *
  38. * @return \Stripe\Collection<\Stripe\ApplicationFeeRefund>
  39. */
  40. public function allRefunds($parentId, $params = null, $opts = null)
  41. {
  42. return $this->requestCollection('get', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts);
  43. }
  44. /**
  45. * Refunds an application fee that has previously been collected but not yet
  46. * refunded. Funds will be refunded to the Stripe account from which the fee was
  47. * originally collected.
  48. *
  49. * You can optionally refund only part of an application fee. You can do so
  50. * multiple times, until the entire fee has been refunded.
  51. *
  52. * Once entirely refunded, an application fee can’t be refunded again. This method
  53. * will raise an error when called on an already-refunded application fee, or when
  54. * trying to refund more money than is left on an application fee.
  55. *
  56. * @param string $parentId
  57. * @param null|array $params
  58. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  59. *
  60. * @throws \Stripe\Exception\ApiErrorException if the request fails
  61. *
  62. * @return \Stripe\ApplicationFeeRefund
  63. */
  64. public function createRefund($parentId, $params = null, $opts = null)
  65. {
  66. return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds', $parentId), $params, $opts);
  67. }
  68. /**
  69. * Retrieves the details of an application fee that your account has collected. The
  70. * same information is returned when refunding the application fee.
  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\ApplicationFee
  79. */
  80. public function retrieve($id, $params = null, $opts = null)
  81. {
  82. return $this->request('get', $this->buildPath('/v1/application_fees/%s', $id), $params, $opts);
  83. }
  84. /**
  85. * By default, you can see the 10 most recent refunds stored directly on the
  86. * application fee object, but you can also retrieve details about a specific
  87. * refund stored on the application fee.
  88. *
  89. * @param string $parentId
  90. * @param string $id
  91. * @param null|array $params
  92. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  93. *
  94. * @throws \Stripe\Exception\ApiErrorException if the request fails
  95. *
  96. * @return \Stripe\ApplicationFeeRefund
  97. */
  98. public function retrieveRefund($parentId, $id, $params = null, $opts = null)
  99. {
  100. return $this->request('get', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts);
  101. }
  102. /**
  103. * Updates the specified application fee refund by setting the values of the
  104. * parameters passed. Any parameters not provided will be left unchanged.
  105. *
  106. * This request only accepts metadata as an argument.
  107. *
  108. * @param string $parentId
  109. * @param string $id
  110. * @param null|array $params
  111. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  112. *
  113. * @throws \Stripe\Exception\ApiErrorException if the request fails
  114. *
  115. * @return \Stripe\ApplicationFeeRefund
  116. */
  117. public function updateRefund($parentId, $id, $params = null, $opts = null)
  118. {
  119. return $this->request('post', $this->buildPath('/v1/application_fees/%s/refunds/%s', $parentId, $id), $params, $opts);
  120. }
  121. }