WebhookEndpointService.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 WebhookEndpointService extends \Stripe\Service\AbstractService
  9. {
  10. /**
  11. * Returns a list of your webhook endpoints.
  12. *
  13. * @param null|array $params
  14. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  15. *
  16. * @throws \Stripe\Exception\ApiErrorException if the request fails
  17. *
  18. * @return \Stripe\Collection<\Stripe\WebhookEndpoint>
  19. */
  20. public function all($params = null, $opts = null)
  21. {
  22. return $this->requestCollection('get', '/v1/webhook_endpoints', $params, $opts);
  23. }
  24. /**
  25. * A webhook endpoint must have a <code>url</code> and a list of
  26. * <code>enabled_events</code>. You may optionally specify the Boolean
  27. * <code>connect</code> parameter. If set to true, then a Connect webhook endpoint
  28. * that notifies the specified <code>url</code> about events from all connected
  29. * accounts is created; otherwise an account webhook endpoint that notifies the
  30. * specified <code>url</code> only about events from your account is created. You
  31. * can also create webhook endpoints in the <a
  32. * href="https://dashboard.stripe.com/account/webhooks">webhooks settings</a>
  33. * section of the Dashboard.
  34. *
  35. * @param null|array $params
  36. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  37. *
  38. * @throws \Stripe\Exception\ApiErrorException if the request fails
  39. *
  40. * @return \Stripe\WebhookEndpoint
  41. */
  42. public function create($params = null, $opts = null)
  43. {
  44. return $this->request('post', '/v1/webhook_endpoints', $params, $opts);
  45. }
  46. /**
  47. * You can also delete webhook endpoints via the <a
  48. * href="https://dashboard.stripe.com/account/webhooks">webhook endpoint
  49. * management</a> page of the Stripe dashboard.
  50. *
  51. * @param string $id
  52. * @param null|array $params
  53. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  54. *
  55. * @throws \Stripe\Exception\ApiErrorException if the request fails
  56. *
  57. * @return \Stripe\WebhookEndpoint
  58. */
  59. public function delete($id, $params = null, $opts = null)
  60. {
  61. return $this->request('delete', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts);
  62. }
  63. /**
  64. * Retrieves the webhook endpoint with the given ID.
  65. *
  66. * @param string $id
  67. * @param null|array $params
  68. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  69. *
  70. * @throws \Stripe\Exception\ApiErrorException if the request fails
  71. *
  72. * @return \Stripe\WebhookEndpoint
  73. */
  74. public function retrieve($id, $params = null, $opts = null)
  75. {
  76. return $this->request('get', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts);
  77. }
  78. /**
  79. * Updates the webhook endpoint. You may edit the <code>url</code>, the list of
  80. * <code>enabled_events</code>, and the status of your endpoint.
  81. *
  82. * @param string $id
  83. * @param null|array $params
  84. * @param null|RequestOptionsArray|\Stripe\Util\RequestOptions $opts
  85. *
  86. * @throws \Stripe\Exception\ApiErrorException if the request fails
  87. *
  88. * @return \Stripe\WebhookEndpoint
  89. */
  90. public function update($id, $params = null, $opts = null)
  91. {
  92. return $this->request('post', $this->buildPath('/v1/webhook_endpoints/%s', $id), $params, $opts);
  93. }
  94. }