WebhookEndpointService.php 3.3 KB

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