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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // Creates a billing meter event
    10  type BillingMeterEventParams struct {
    11  	Params `form:"*"`
    12  	// The name of the meter event. Corresponds with the `event_name` field on a meter.
    13  	EventName *string `form:"event_name"`
    14  	// Specifies which fields in the response should be expanded.
    15  	Expand []*string `form:"expand"`
    16  	// A unique identifier for the event. If not provided, one will be generated. We recommend using a globally unique identifier for this. We'll enforce uniqueness within a rolling 24 hour period.
    17  	Identifier *string `form:"identifier"`
    18  	// The payload of the event. This must contain a field with the event's numerical value and a field to map the event to a customer.
    19  	Payload map[string]string `form:"payload"`
    20  	// The time of the event. Measured in seconds since the Unix epoch.
    21  	Timestamp *int64 `form:"timestamp"`
    22  }
    23  
    24  // AddExpand appends a new field to expand.
    25  func (p *BillingMeterEventParams) AddExpand(f string) {
    26  	p.Expand = append(p.Expand, &f)
    27  }
    28  
    29  // A billing meter event represents a customer's usage of a product. Meter events are used to bill a customer based on their usage.
    30  // Meter events are associated with billing meters, which define the shape of the event's payload and how those events are aggregated for billing.
    31  type BillingMeterEvent struct {
    32  	APIResource
    33  	// Time at which the object was created. Measured in seconds since the Unix epoch.
    34  	Created int64 `json:"created"`
    35  	// The name of the meter event. Corresponds with the `event_name` field on a meter.
    36  	EventName string `json:"event_name"`
    37  	// A unique identifier for the event.
    38  	Identifier string `json:"identifier"`
    39  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
    40  	Livemode bool `json:"livemode"`
    41  	// String representing the object's type. Objects of the same type share the same value.
    42  	Object string `json:"object"`
    43  	// The payload of the event.
    44  	Payload map[string]string `json:"payload"`
    45  	// The timestamp passed in when creating the event. Measured in seconds since the Unix epoch.
    46  	Timestamp int64 `json:"timestamp"`
    47  }