RefundService.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. class RefundService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * Returns a list of all refunds you’ve previously created. The refunds are
  8. * returned in sorted order, with the most recent refunds appearing first. For
  9. * convenience, the 10 most recent refunds are always available by default on the
  10. * charge object.
  11. *
  12. * @param null|array $params
  13. * @param null|array|\Stripe\Util\RequestOptions $opts
  14. *
  15. * @throws \Stripe\Exception\ApiErrorException if the request fails
  16. *
  17. * @return \Stripe\Collection
  18. */
  19. public function all($params = null, $opts = null)
  20. {
  21. return $this->requestCollection('get', '/v1/refunds', $params, $opts);
  22. }
  23. /**
  24. * Create a refund.
  25. *
  26. * @param null|array $params
  27. * @param null|array|\Stripe\Util\RequestOptions $opts
  28. *
  29. * @throws \Stripe\Exception\ApiErrorException if the request fails
  30. *
  31. * @return \Stripe\Refund
  32. */
  33. public function create($params = null, $opts = null)
  34. {
  35. return $this->request('post', '/v1/refunds', $params, $opts);
  36. }
  37. /**
  38. * Retrieves the details of an existing refund.
  39. *
  40. * @param string $id
  41. * @param null|array $params
  42. * @param null|array|\Stripe\Util\RequestOptions $opts
  43. *
  44. * @throws \Stripe\Exception\ApiErrorException if the request fails
  45. *
  46. * @return \Stripe\Refund
  47. */
  48. public function retrieve($id, $params = null, $opts = null)
  49. {
  50. return $this->request('get', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
  51. }
  52. /**
  53. * Updates the specified refund by setting the values of the parameters passed. Any
  54. * parameters not provided will be left unchanged.
  55. *
  56. * This request only accepts <code>metadata</code> as an argument.
  57. *
  58. * @param string $id
  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\Refund
  65. */
  66. public function update($id, $params = null, $opts = null)
  67. {
  68. return $this->request('post', $this->buildPath('/v1/refunds/%s', $id), $params, $opts);
  69. }
  70. }