TopupService.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. class TopupService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * Returns a list of top-ups.
  8. *
  9. * @param null|array $params
  10. * @param null|array|\Stripe\Util\RequestOptions $opts
  11. *
  12. * @throws \Stripe\Exception\ApiErrorException if the request fails
  13. *
  14. * @return \Stripe\Collection
  15. */
  16. public function all($params = null, $opts = null)
  17. {
  18. return $this->requestCollection('get', '/v1/topups', $params, $opts);
  19. }
  20. /**
  21. * Cancels a top-up. Only pending top-ups can be canceled.
  22. *
  23. * @param string $id
  24. * @param null|array $params
  25. * @param null|array|\Stripe\Util\RequestOptions $opts
  26. *
  27. * @throws \Stripe\Exception\ApiErrorException if the request fails
  28. *
  29. * @return \Stripe\Topup
  30. */
  31. public function cancel($id, $params = null, $opts = null)
  32. {
  33. return $this->request('post', $this->buildPath('/v1/topups/%s/cancel', $id), $params, $opts);
  34. }
  35. /**
  36. * Top up the balance of an account.
  37. *
  38. * @param null|array $params
  39. * @param null|array|\Stripe\Util\RequestOptions $opts
  40. *
  41. * @throws \Stripe\Exception\ApiErrorException if the request fails
  42. *
  43. * @return \Stripe\Topup
  44. */
  45. public function create($params = null, $opts = null)
  46. {
  47. return $this->request('post', '/v1/topups', $params, $opts);
  48. }
  49. /**
  50. * Retrieves the details of a top-up that has previously been created. Supply the
  51. * unique top-up ID that was returned from your previous request, and Stripe will
  52. * return the corresponding top-up information.
  53. *
  54. * @param string $id
  55. * @param null|array $params
  56. * @param null|array|\Stripe\Util\RequestOptions $opts
  57. *
  58. * @throws \Stripe\Exception\ApiErrorException if the request fails
  59. *
  60. * @return \Stripe\Topup
  61. */
  62. public function retrieve($id, $params = null, $opts = null)
  63. {
  64. return $this->request('get', $this->buildPath('/v1/topups/%s', $id), $params, $opts);
  65. }
  66. /**
  67. * Updates the metadata of a top-up. Other top-up details are not editable by
  68. * design.
  69. *
  70. * @param string $id
  71. * @param null|array $params
  72. * @param null|array|\Stripe\Util\RequestOptions $opts
  73. *
  74. * @throws \Stripe\Exception\ApiErrorException if the request fails
  75. *
  76. * @return \Stripe\Topup
  77. */
  78. public function update($id, $params = null, $opts = null)
  79. {
  80. return $this->request('post', $this->buildPath('/v1/topups/%s', $id), $params, $opts);
  81. }
  82. }