SourceService.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. // File generated from our OpenAPI spec
  3. namespace Stripe\Service;
  4. class SourceService extends \Stripe\Service\AbstractService
  5. {
  6. /**
  7. * @param string $id
  8. * @param null|array $params
  9. * @param null|array|\Stripe\Util\RequestOptions $opts
  10. *
  11. * @throws \Stripe\Exception\ApiErrorException if the request fails
  12. *
  13. * @return \Stripe\Source
  14. */
  15. public function allTransactions($id, $params = null, $opts = null)
  16. {
  17. return $this->request('get', $this->buildPath('/v1/sources/%s/source_transactions', $id), $params, $opts);
  18. }
  19. /**
  20. * Creates a new source object.
  21. *
  22. * @param null|array $params
  23. * @param null|array|\Stripe\Util\RequestOptions $opts
  24. *
  25. * @throws \Stripe\Exception\ApiErrorException if the request fails
  26. *
  27. * @return \Stripe\Source
  28. */
  29. public function create($params = null, $opts = null)
  30. {
  31. return $this->request('post', '/v1/sources', $params, $opts);
  32. }
  33. /**
  34. * Delete a specified source for a given customer.
  35. *
  36. * @param string $parentId
  37. * @param string $id
  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\Source
  44. */
  45. public function detach($parentId, $id, $params = null, $opts = null)
  46. {
  47. return $this->request('delete', $this->buildPath('/v1/customers/%s/sources/%s', $parentId, $id), $params, $opts);
  48. }
  49. /**
  50. * Retrieves an existing source object. Supply the unique source ID from a source
  51. * creation request and Stripe will return the corresponding up-to-date source
  52. * object 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\Source
  61. */
  62. public function retrieve($id, $params = null, $opts = null)
  63. {
  64. return $this->request('get', $this->buildPath('/v1/sources/%s', $id), $params, $opts);
  65. }
  66. /**
  67. * Updates the specified source by setting the values of the parameters passed. Any
  68. * parameters not provided will be left unchanged.
  69. *
  70. * This request accepts the <code>metadata</code> and <code>owner</code> as
  71. * arguments. It is also possible to update type specific information for selected
  72. * payment methods. Please refer to our <a href="/docs/sources">payment method
  73. * guides</a> for more detail.
  74. *
  75. * @param string $id
  76. * @param null|array $params
  77. * @param null|array|\Stripe\Util\RequestOptions $opts
  78. *
  79. * @throws \Stripe\Exception\ApiErrorException if the request fails
  80. *
  81. * @return \Stripe\Source
  82. */
  83. public function update($id, $params = null, $opts = null)
  84. {
  85. return $this->request('post', $this->buildPath('/v1/sources/%s', $id), $params, $opts);
  86. }
  87. /**
  88. * Verify a given source.
  89. *
  90. * @param string $id
  91. * @param null|array $params
  92. * @param null|array|\Stripe\Util\RequestOptions $opts
  93. *
  94. * @throws \Stripe\Exception\ApiErrorException if the request fails
  95. *
  96. * @return \Stripe\Source
  97. */
  98. public function verify($id, $params = null, $opts = null)
  99. {
  100. return $this->request('post', $this->buildPath('/v1/sources/%s/verify', $id), $params, $opts);
  101. }
  102. }