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 via the API to be notified about events that happen in your Stripe account or connected accounts.
Most users configure webhooks from the dashboard, which provides a user interface for registering and testing your webhook endpoints.
Related guide: Setting up webhooks
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
If the object exists in live mode, the value is
true. -
#metadata ⇒ Object
readonly
Set of key-value pairs 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.
-
#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 page of the Stripe dashboard.
- .field_remappings ⇒ Object
- .inner_class_types ⇒ Object
-
.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 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
#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #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.
24 25 26 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 24 def api_version @api_version end |
#application ⇒ Object (readonly)
The ID of the associated Connect application.
26 27 28 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 26 def application @application end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
28 29 30 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 28 def created @created end |
#deleted ⇒ Object (readonly)
Always true for a deleted object
30 31 32 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 30 def deleted @deleted end |
#description ⇒ Object (readonly)
An optional description of what the webhook is used for.
32 33 34 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 32 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.
34 35 36 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 34 def enabled_events @enabled_events end |
#id ⇒ Object (readonly)
Unique identifier for the object.
36 37 38 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 36 def id @id end |
#livemode ⇒ Object (readonly)
If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.
38 39 40 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 38 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
40 41 42 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 40 def end |
#object ⇒ Object (readonly)
String representing the object's type. Objects of the same type share the same value.
42 43 44 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 42 def object @object end |
#secret ⇒ Object (readonly)
The endpoint's secret, used to generate webhook signatures. Only returned at creation.
44 45 46 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 44 def secret @secret end |
#status ⇒ Object (readonly)
The status of the webhook. It can be enabled or disabled.
46 47 48 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 46 def status @status end |
#url ⇒ Object (readonly)
The URL of the webhook endpoint.
48 49 50 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 48 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 section of the Dashboard.
51 52 53 54 55 56 57 58 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 51 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 page of the Stripe dashboard.
61 62 63 64 65 66 67 68 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 61 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 |
.field_remappings ⇒ Object
99 100 101 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 99 def self.field_remappings @field_remappings = {} end |
.inner_class_types ⇒ Object
95 96 97 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 95 def self.inner_class_types @inner_class_types = {} end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your webhook endpoints.
81 82 83 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 81 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.
86 87 88 89 90 91 92 93 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 86 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 page of the Stripe dashboard.
71 72 73 74 75 76 77 78 |
# File 'lib/stripe/resources/webhook_endpoint.rb', line 71 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 |