github.com/stripe/stripe-go/v76@v76.25.0/webhookendpoint.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
    10  type WebhookEndpointParams struct {
    11  	Params `form:"*"`
    12  	// Whether this endpoint should receive events from connected accounts (`true`), or from your account (`false`). Defaults to `false`.
    13  	Connect *bool `form:"connect"`
    14  	// An optional description of what the webhook is used for.
    15  	Description *string `form:"description"`
    16  	// Disable the webhook endpoint if set to true.
    17  	Disabled *bool `form:"disabled"`
    18  	// The list of events to enable for this endpoint. You may specify `['*']` to enable all events, except those that require explicit selection.
    19  	EnabledEvents []*string `form:"enabled_events"`
    20  	// Specifies which fields in the response should be expanded.
    21  	Expand []*string `form:"expand"`
    22  	// Set of [key-value pairs](https://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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
    23  	Metadata map[string]string `form:"metadata"`
    24  	// The URL of the webhook endpoint.
    25  	URL *string `form:"url"`
    26  	// This parameter is only available on creation.
    27  	// We recommend setting the API version that the library is pinned to. See apiversion in stripe.go
    28  	// Events sent to this endpoint will be generated with this Stripe Version instead of your account's default Stripe Version.
    29  	APIVersion *string `form:"api_version"`
    30  }
    31  
    32  // AddExpand appends a new field to expand.
    33  func (p *WebhookEndpointParams) AddExpand(f string) {
    34  	p.Expand = append(p.Expand, &f)
    35  }
    36  
    37  // AddMetadata adds a new key-value pair to the Metadata.
    38  func (p *WebhookEndpointParams) AddMetadata(key string, value string) {
    39  	if p.Metadata == nil {
    40  		p.Metadata = make(map[string]string)
    41  	}
    42  
    43  	p.Metadata[key] = value
    44  }
    45  
    46  // Returns a list of your webhook endpoints.
    47  type WebhookEndpointListParams struct {
    48  	ListParams `form:"*"`
    49  	// Specifies which fields in the response should be expanded.
    50  	Expand []*string `form:"expand"`
    51  }
    52  
    53  // AddExpand appends a new field to expand.
    54  func (p *WebhookEndpointListParams) AddExpand(f string) {
    55  	p.Expand = append(p.Expand, &f)
    56  }
    57  
    58  // You can configure [webhook endpoints](https://stripe.com/docs/webhooks/) via the API to be
    59  // notified about events that happen in your Stripe account or connected
    60  // accounts.
    61  //
    62  // Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.
    63  //
    64  // Related guide: [Setting up webhooks](https://stripe.com/docs/webhooks/configure)
    65  type WebhookEndpoint struct {
    66  	APIResource
    67  	// The API version events are rendered as for this webhook endpoint.
    68  	APIVersion string `json:"api_version"`
    69  	// The ID of the associated Connect application.
    70  	Application string `json:"application"`
    71  	// Time at which the object was created. Measured in seconds since the Unix epoch.
    72  	Created int64 `json:"created"`
    73  	Deleted bool  `json:"deleted"`
    74  	// An optional description of what the webhook is used for.
    75  	Description string `json:"description"`
    76  	// The list of events to enable for this endpoint. `['*']` indicates that all events are enabled, except those that require explicit selection.
    77  	EnabledEvents []string `json:"enabled_events"`
    78  	// Unique identifier for the object.
    79  	ID string `json:"id"`
    80  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    81  	Livemode bool `json:"livemode"`
    82  	// Set of [key-value pairs](https://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.
    83  	Metadata map[string]string `json:"metadata"`
    84  	// String representing the object's type. Objects of the same type share the same value.
    85  	Object string `json:"object"`
    86  	// The endpoint's secret, used to generate [webhook signatures](https://stripe.com/docs/webhooks/signatures). Only returned at creation.
    87  	Secret string `json:"secret"`
    88  	// The status of the webhook. It can be `enabled` or `disabled`.
    89  	Status string `json:"status"`
    90  	// The URL of the webhook endpoint.
    91  	URL string `json:"url"`
    92  }
    93  
    94  // WebhookEndpointList is a list of WebhookEndpoints as retrieved from a list endpoint.
    95  type WebhookEndpointList struct {
    96  	APIResource
    97  	ListMeta
    98  	Data []*WebhookEndpoint `json:"data"`
    99  }