ApplicationFeeService.php 4.6 KB

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