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, RetrieveParams, 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(id, 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(id, 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.
133 134 135 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 133 def api_version @api_version end |
#application ⇒ Object (readonly)
The ID of the associated Connect application.
136 137 138 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 136 def application @application end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
139 140 141 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 139 def created @created end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
169 170 171 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 169 def deleted @deleted end |
#description ⇒ Object (readonly)
An optional description of what the webhook is used for.
142 143 144 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 142 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.
145 146 147 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 145 def enabled_events @enabled_events end |
#id ⇒ Object (readonly)
Unique identifier for the object.
148 149 150 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 148 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.
151 152 153 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 151 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.
154 155 156 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 154 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
157 158 159 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 157 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.
160 161 162 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 160 def secret @secret end |
#status ⇒ Object (readonly)
The status of the webhook. It can be ‘enabled` or `disabled`.
163 164 165 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 163 def status @status end |
#url ⇒ Object (readonly)
The URL of the webhook endpoint.
166 167 168 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 166 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.
172 173 174 175 176 177 178 179 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 172 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/webhook_endpoints", params: params, opts: opts ) end |
.delete(id, params = {}, opts = {}) ⇒ Object
You can also delete webhook endpoints via the [webhook endpoint management](dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
182 183 184 185 186 187 188 189 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 182 def self.delete(id, params = {}, opts = {}) request_stripe_object( method: :delete, path: format("/v1/webhook_endpoints/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your webhook endpoints.
202 203 204 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 202 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(id, params = {}, opts = {}) ⇒ Object
Updates the webhook endpoint. You may edit the url, the list of enabled_events, and the status of your endpoint.
207 208 209 210 211 212 213 214 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 207 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/webhook_endpoints/%<id>s", { id: CGI.escape(id) }), 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.
192 193 194 195 196 197 198 199 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 192 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 |