Class: Stripe::WebhookEndpoint
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::WebhookEndpoint
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Delete, APIOperations::Save
- Defined in:
- lib/stripe/resources/webhook_endpoint.rb
Overview
You can configure [webhook endpoints](docs.stripe.com/webhooks/) via the API to be notified about events that happen in your Stripe account or connected accounts.
Most users configure webhooks from [the dashboard](dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.
Related guide: [Setting up webhooks](docs.stripe.com/webhooks/configure)
Defined Under Namespace
Classes: CreateParams, DeleteParams, ListParams, UpdateParams
Constant Summary collapse
- OBJECT_NAME =
"webhook_endpoint"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
The API version events are rendered as for this webhook endpoint.
-
#application ⇒ Object
readonly
The ID of the associated Connect application.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#deleted ⇒ Object
readonly
Always true for a deleted object.
-
#description ⇒ Object
readonly
An optional description of what the webhook is used for.
-
#enabled_events ⇒ Object
readonly
The list of events to enable for this endpoint.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#secret ⇒ Object
readonly
The endpoint’s secret, used to generate [webhook signatures](docs.stripe.com/webhooks/signatures).
-
#status ⇒ Object
readonly
The status of the webhook.
-
#url ⇒ Object
readonly
The URL of the webhook endpoint.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
A webhook endpoint must have a url and a list of enabled_events.
-
.delete(webhook_endpoint, params = {}, opts = {}) ⇒ Object
You can also delete webhook endpoints via the [webhook endpoint management](dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your webhook endpoints.
- .object_name ⇒ Object
-
.update(webhook_endpoint, params = {}, opts = {}) ⇒ Object
Updates the webhook endpoint.
Instance Method Summary collapse
-
#delete(params = {}, opts = {}) ⇒ Object
You can also delete webhook endpoints via the [webhook endpoint management](dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods included from APIOperations::Delete
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#api_version ⇒ Object (readonly)
The API version events are rendered as for this webhook endpoint.
110 111 112 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 110 def api_version @api_version end |
#application ⇒ Object (readonly)
The ID of the associated Connect application.
112 113 114 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 112 def application @application end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
114 115 116 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 114 def created @created end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
134 135 136 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 134 def deleted @deleted end |
#description ⇒ Object (readonly)
An optional description of what the webhook is used for.
116 117 118 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 116 def description @description end |
#enabled_events ⇒ Object (readonly)
The list of events to enable for this endpoint. ‘[’*‘]` indicates that all events are enabled, except those that require explicit selection.
118 119 120 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 118 def enabled_events @enabled_events end |
#id ⇒ Object (readonly)
Unique identifier for the object.
120 121 122 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 120 def id @id end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
122 123 124 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 122 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
124 125 126 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 124 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
126 127 128 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 126 def object @object end |
#secret ⇒ Object (readonly)
The endpoint’s secret, used to generate [webhook signatures](docs.stripe.com/webhooks/signatures). Only returned at creation.
128 129 130 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 128 def secret @secret end |
#status ⇒ Object (readonly)
The status of the webhook. It can be ‘enabled` or `disabled`.
130 131 132 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 130 def status @status end |
#url ⇒ Object (readonly)
The URL of the webhook endpoint.
132 133 134 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 132 def url @url end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
A webhook endpoint must have a url and a list of enabled_events. You may optionally specify the Boolean connect parameter. If set to true, then a Connect webhook endpoint that notifies the specified url about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified url only about events from your account is created. You can also create webhook endpoints in the [webhooks settings](dashboard.stripe.com/account/webhooks) section of the Dashboard.
137 138 139 140 141 142 143 144 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 137 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/webhook_endpoints", params: params, opts: opts ) end |
.delete(webhook_endpoint, params = {}, opts = {}) ⇒ Object
You can also delete webhook endpoints via the [webhook endpoint management](dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
147 148 149 150 151 152 153 154 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 147 def self.delete(webhook_endpoint, params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/webhook_endpoints/%<webhook_endpoint>s", { webhook_endpoint: CGI.escape(webhook_endpoint) }), params: params, opts: opts ) end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your webhook endpoints.
167 168 169 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 167 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/webhook_endpoints", params: params, opts: opts) end |
.object_name ⇒ Object
19 20 21 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 19 def self.object_name "webhook_endpoint" end |
.update(webhook_endpoint, params = {}, opts = {}) ⇒ Object
Updates the webhook endpoint. You may edit the url, the list of enabled_events, and the status of your endpoint.
172 173 174 175 176 177 178 179 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 172 def self.update(webhook_endpoint, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/webhook_endpoints/%<webhook_endpoint>s", { webhook_endpoint: CGI.escape(webhook_endpoint) }), params: params, opts: opts ) end |
Instance Method Details
#delete(params = {}, opts = {}) ⇒ Object
You can also delete webhook endpoints via the [webhook endpoint management](dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
157 158 159 160 161 162 163 164 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 157 def delete(params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/webhook_endpoints/%<webhook_endpoint>s", { webhook_endpoint: CGI.escape(self["id"]) }), params: params, opts: opts ) end |