From e25d3c6f52be38016e3b50f4bc1a80c8ee258222 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 22:11:31 +0000 Subject: [PATCH] Update OpenAPI for d29eb27b49336fa1b19ebb816744833c776bb3e2 --- embedded/openapi/spec3.beta.sdk.json | 1662 +++++++++++++++++++++++--- 1 file changed, 1502 insertions(+), 160 deletions(-) diff --git a/embedded/openapi/spec3.beta.sdk.json b/embedded/openapi/spec3.beta.sdk.json index 01004fec..80159337 100644 --- a/embedded/openapi/spec3.beta.sdk.json +++ b/embedded/openapi/spec3.beta.sdk.json @@ -4023,6 +4023,332 @@ "type": "object", "x-expandableFields": [] }, + "billing.meter": { + "description": "A billing meter is a resource that allows you to track usage of a particular event. For example, you might create a billing meter to track the number of API calls made by a particular user. You can then use the billing meter to charge the user for the number of API calls they make.", + "properties": { + "created": { + "description": "Time at which the object was created. Measured in seconds since the Unix epoch.", + "format": "unix-time", + "type": "integer" + }, + "customer_mapping": { + "$ref": "#/components/schemas/billing_meter_resource_customer_mapping_settings" + }, + "default_aggregation": { + "$ref": "#/components/schemas/billing_meter_resource_aggregation_settings" + }, + "display_name": { + "description": "The meter's name.", + "maxLength": 5000, + "type": "string" + }, + "event_name": { + "description": "The name of the usage event to record usage for. Corresponds with the `event_name` field on usage events.", + "maxLength": 5000, + "type": "string" + }, + "event_time_window": { + "description": "The time window to pre-aggregate usage events for, if any.", + "enum": [ + "day", + "hour" + ], + "nullable": true, + "type": "string" + }, + "id": { + "description": "Unique identifier for the object.", + "maxLength": 5000, + "type": "string" + }, + "livemode": { + "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.", + "type": "boolean" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value.", + "enum": [ + "billing.meter" + ], + "type": "string" + }, + "status": { + "description": "The meter's status.", + "enum": [ + "active", + "inactive" + ], + "type": "string" + }, + "status_transitions": { + "$ref": "#/components/schemas/billing_meter_resource_billing_meter_status_transitions" + }, + "updated": { + "description": "Time at which the object was last updated. Measured in seconds since the Unix epoch.", + "format": "unix-time", + "type": "integer" + }, + "value_settings": { + "$ref": "#/components/schemas/billing_meter_resource_billing_meter_value" + } + }, + "required": [ + "created", + "customer_mapping", + "default_aggregation", + "display_name", + "event_name", + "event_time_window", + "id", + "livemode", + "object", + "status", + "status_transitions", + "updated", + "value_settings" + ], + "title": "BillingMeter", + "type": "object", + "x-expandableFields": [ + "customer_mapping", + "default_aggregation", + "status_transitions", + "value_settings" + ], + "x-resourceId": "billing.meter", + "x-stripeOperations": [ + { + "method_name": "list", + "method_on": "service", + "method_type": "list", + "operation": "get", + "path": "/v1/billing/meters" + }, + { + "method_name": "retrieve", + "method_on": "service", + "method_type": "retrieve", + "operation": "get", + "path": "/v1/billing/meters/{id}" + }, + { + "method_name": "create", + "method_on": "service", + "method_type": "create", + "operation": "post", + "path": "/v1/billing/meters" + }, + { + "method_name": "update", + "method_on": "service", + "method_type": "update", + "operation": "post", + "path": "/v1/billing/meters/{id}" + }, + { + "method_name": "deactivate", + "method_on": "service", + "method_type": "custom", + "operation": "post", + "path": "/v1/billing/meters/{id}/deactivate" + }, + { + "method_name": "reactivate", + "method_on": "service", + "method_type": "custom", + "operation": "post", + "path": "/v1/billing/meters/{id}/reactivate" + } + ], + "x-stripeResource": { + "class_name": "Meter", + "has_collection_class": true, + "in_package": "Billing" + } + }, + "billing.meter_event": { + "description": "A billing meter event represents a customer's usage of a product. Meter events are used to bill a customer based on their usage.\nMeter events are associated with billing meters, which define the shape of the event's payload and how those events are aggregated for billing.", + "properties": { + "created": { + "description": "Time at which the object was created. Measured in seconds since the Unix epoch.", + "format": "unix-time", + "type": "integer" + }, + "event_name": { + "description": "The name of the meter event. Corresponds with the `event_name` field on a meter.", + "maxLength": 100, + "type": "string" + }, + "identifier": { + "description": "A unique identifier for the event.", + "maxLength": 5000, + "type": "string" + }, + "livemode": { + "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.", + "type": "boolean" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value.", + "enum": [ + "billing.meter_event" + ], + "type": "string" + }, + "payload": { + "additionalProperties": { + "maxLength": 100, + "type": "string" + }, + "description": "The payload of the event.", + "type": "object" + }, + "timestamp": { + "description": "The timestamp passed in when creating the event. Measured in seconds since the Unix epoch.", + "format": "unix-time", + "type": "integer" + } + }, + "required": [ + "created", + "event_name", + "identifier", + "livemode", + "object", + "payload", + "timestamp" + ], + "title": "BillingMeterEvent", + "type": "object", + "x-expandableFields": [], + "x-resourceId": "billing.meter_event", + "x-stripeOperations": [ + { + "method_name": "create", + "method_on": "service", + "method_type": "create", + "operation": "post", + "path": "/v1/billing/meter_events" + } + ], + "x-stripeResource": { + "class_name": "MeterEvent", + "in_package": "Billing" + } + }, + "billing.meter_event_adjustment": { + "description": "A billing meter event adjustment represents the status of a meter event adjustment.", + "properties": { + "livemode": { + "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.", + "type": "boolean" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value.", + "enum": [ + "billing.meter_event_adjustment" + ], + "type": "string" + }, + "status": { + "description": "The meter event adjustment's status.", + "enum": [ + "complete", + "pending" + ], + "type": "string" + } + }, + "required": [ + "livemode", + "object", + "status" + ], + "title": "BillingMeterEventAdjustment", + "type": "object", + "x-expandableFields": [], + "x-resourceId": "billing.meter_event_adjustment", + "x-stripeOperations": [ + { + "method_name": "create", + "method_on": "service", + "method_type": "create", + "operation": "post", + "path": "/v1/billing/meter_event_adjustments" + } + ], + "x-stripeResource": { + "class_name": "MeterEventAdjustment", + "in_package": "Billing" + } + }, + "billing.meter_event_summary": { + "description": "A billing meter event summary represents an aggregated view of a customer's billing meter events within a specified timeframe. It indicates how much\nusage was accrued by a customer for that period.", + "properties": { + "aggregated_value": { + "description": "Aggregated value of all the events within start_time (inclusive) and end_time (inclusive). The aggregation strategy is defined on meter via `default_aggregation``.", + "type": "number" + }, + "end_time": { + "description": "End timestamp for this usage summary (inclusive).", + "format": "unix-time", + "type": "integer" + }, + "id": { + "description": "Unique identifier for the object.", + "maxLength": 5000, + "type": "string" + }, + "livemode": { + "description": "Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.", + "type": "boolean" + }, + "meter": { + "description": "The meter associated with this usage summary.", + "maxLength": 5000, + "type": "string" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value.", + "enum": [ + "billing.meter_event_summary" + ], + "type": "string" + }, + "start_time": { + "description": "Start timestamp for this usage summary (inclusive).", + "format": "unix-time", + "type": "integer" + } + }, + "required": [ + "aggregated_value", + "end_time", + "id", + "livemode", + "meter", + "object", + "start_time" + ], + "title": "BillingMeterEventSummary", + "type": "object", + "x-expandableFields": [], + "x-resourceId": "billing.meter_event_summary", + "x-stripeOperations": [ + { + "method_name": "list", + "method_on": "service", + "method_type": "list", + "operation": "get", + "path": "/v1/billing/meters/{id}/event_summaries" + } + ], + "x-stripeResource": { + "class_name": "MeterEventSummary", + "has_collection_class": true, + "in_package": "Billing" + } + }, "billing_details": { "description": "", "properties": { @@ -4066,6 +4392,82 @@ "address" ] }, + "billing_meter_resource_aggregation_settings": { + "description": "", + "properties": { + "formula": { + "description": "Specifies how events are aggregated.", + "enum": [ + "count", + "sum" + ], + "type": "string" + } + }, + "required": [ + "formula" + ], + "title": "BillingMeterResourceAggregationSettings", + "type": "object", + "x-expandableFields": [] + }, + "billing_meter_resource_billing_meter_status_transitions": { + "description": "", + "properties": { + "deactivated_at": { + "description": "The time the meter was deactivated, if any. Measured in seconds since Unix epoch.", + "format": "unix-time", + "nullable": true, + "type": "integer" + } + }, + "required": [ + "deactivated_at" + ], + "title": "BillingMeterResourceBillingMeterStatusTransitions", + "type": "object", + "x-expandableFields": [] + }, + "billing_meter_resource_billing_meter_value": { + "description": "", + "properties": { + "event_payload_key": { + "description": "The key in the usage event payload to use as the value for this meter.", + "maxLength": 5000, + "type": "string" + } + }, + "required": [ + "event_payload_key" + ], + "title": "BillingMeterResourceBillingMeterValue", + "type": "object", + "x-expandableFields": [] + }, + "billing_meter_resource_customer_mapping_settings": { + "description": "", + "properties": { + "event_payload_key": { + "description": "The key in the usage event payload to use for mapping the event to a customer.", + "maxLength": 5000, + "type": "string" + }, + "type": { + "description": "The method for mapping a meter event to a customer.", + "enum": [ + "by_id" + ], + "type": "string" + } + }, + "required": [ + "event_payload_key", + "type" + ], + "title": "BillingMeterResourceCustomerMappingSettings", + "type": "object", + "x-expandableFields": [] + }, "billing_portal.configuration": { "description": "A portal configuration describes the functionality and behavior of a portal session.", "properties": { @@ -45006,6 +45408,12 @@ "nullable": true, "type": "object" }, + "meter": { + "description": "The meter tracking the usage of a metered price", + "maxLength": 5000, + "nullable": true, + "type": "string" + }, "nickname": { "description": "A brief description of the plan, hidden from customers.", "maxLength": 5000, @@ -51319,6 +51727,12 @@ "description": "The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months.", "type": "integer" }, + "meter": { + "description": "The meter tracking the usage of a metered price", + "maxLength": 5000, + "nullable": true, + "type": "string" + }, "trial_period_days": { "description": "Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).", "nullable": true, @@ -78132,7 +78546,900 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/balance_transaction" + "$ref": "#/components/schemas/balance_transaction" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + } + }, + "/v1/billing/margins": { + "get": { + "description": "

Retrieve a list of your margins.

", + "operationId": "GetBillingMargins", + "parameters": [ + { + "description": "Only return margins that are active or inactive, i.e., pass false to list all inactive margins.", + "in": "query", + "name": "active", + "required": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + { + "description": "A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.", + "in": "query", + "name": "ending_before", + "required": false, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + }, + { + "description": "Specifies which fields in the response should be expanded.", + "explode": true, + "in": "query", + "name": "expand", + "required": false, + "schema": { + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "style": "deepObject" + }, + { + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.", + "in": "query", + "name": "limit", + "required": false, + "schema": { + "type": "integer" + }, + "style": "form" + }, + { + "description": "A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.", + "in": "query", + "name": "starting_after", + "required": false, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": {}, + "schema": { + "additionalProperties": false, + "properties": {}, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "description": "", + "properties": { + "data": { + "description": "Details about each object.", + "items": { + "$ref": "#/components/schemas/margin" + }, + "type": "array" + }, + "has_more": { + "description": "True if this list has another page of items after this one that can be fetched.", + "type": "boolean" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value. Always has the value `list`.", + "enum": [ + "list" + ], + "type": "string" + }, + "url": { + "description": "The URL where this list can be accessed.", + "maxLength": 5000, + "pattern": "^/v1/billing/margins", + "type": "string" + } + }, + "required": [ + "data", + "has_more", + "object", + "url" + ], + "title": "MarginList", + "type": "object", + "x-expandableFields": [ + "data" + ] + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + }, + "post": { + "description": "

Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.

", + "operationId": "PostBillingMargins", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": { + "expand": { + "explode": true, + "style": "deepObject" + }, + "metadata": { + "explode": true, + "style": "deepObject" + } + }, + "schema": { + "additionalProperties": false, + "properties": { + "active": { + "description": "Whether the margin can be applied to invoices, invoice items, or invoice line items or not. Defaults to `true`.", + "type": "boolean" + }, + "expand": { + "description": "Specifies which fields in the response should be expanded.", + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "metadata": { + "additionalProperties": { + "type": "string" + }, + "description": "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`.", + "type": "object" + }, + "name": { + "description": "Name of the margin, which is displayed to customers, such as on invoices.", + "maxLength": 5000, + "type": "string" + }, + "percent_off": { + "description": "Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied.", + "type": "number" + } + }, + "required": [ + "percent_off" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/margin" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + } + }, + "/v1/billing/margins/{margin}": { + "get": { + "description": "

Retrieve a margin object with the given ID.

", + "operationId": "GetBillingMarginsMargin", + "parameters": [ + { + "description": "Specifies which fields in the response should be expanded.", + "explode": true, + "in": "query", + "name": "expand", + "required": false, + "schema": { + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "style": "deepObject" + }, + { + "in": "path", + "name": "margin", + "required": true, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": {}, + "schema": { + "additionalProperties": false, + "properties": {}, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/margin" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + }, + "post": { + "description": "

Update the specified margin object. Certain fields of the margin object are not editable.

", + "operationId": "PostBillingMarginsMargin", + "parameters": [ + { + "in": "path", + "name": "margin", + "required": true, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": { + "expand": { + "explode": true, + "style": "deepObject" + }, + "metadata": { + "explode": true, + "style": "deepObject" + } + }, + "schema": { + "additionalProperties": false, + "properties": { + "active": { + "description": "Whether the margin can be applied to invoices, invoice items, or invoice line items or not.", + "type": "boolean" + }, + "expand": { + "description": "Specifies which fields in the response should be expanded.", + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "metadata": { + "additionalProperties": { + "type": "string" + }, + "description": "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`.", + "type": "object" + }, + "name": { + "description": "Name of the margin, which is displayed to customers, such as on invoices.", + "maxLength": 5000, + "type": "string" + } + }, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/margin" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + } + }, + "/v1/billing/meter_event_adjustments": { + "post": { + "description": "

Creates a billing meter event adjustment

", + "operationId": "PostBillingMeterEventAdjustments", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": { + "cancel": { + "explode": true, + "style": "deepObject" + }, + "expand": { + "explode": true, + "style": "deepObject" + } + }, + "schema": { + "additionalProperties": false, + "properties": { + "cancel": { + "description": "Specifies which event to cancel.", + "properties": { + "identifier": { + "description": "Unique identifier for the event.", + "maxLength": 100, + "type": "string" + } + }, + "required": [ + "identifier" + ], + "title": "event_adjustment_cancel_settings_param", + "type": "object" + }, + "expand": { + "description": "Specifies which fields in the response should be expanded.", + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "type": { + "description": "Specifies whether to cancel a single event or a range of events for a time period.", + "enum": [ + "cancel" + ], + "type": "string" + } + }, + "required": [ + "cancel" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/billing.meter_event_adjustment" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + } + }, + "/v1/billing/meter_events": { + "post": { + "description": "

Creates a billing meter event

", + "operationId": "PostBillingMeterEvents", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": { + "expand": { + "explode": true, + "style": "deepObject" + }, + "payload": { + "explode": true, + "style": "deepObject" + } + }, + "schema": { + "additionalProperties": false, + "properties": { + "event_name": { + "description": "The name of the meter event. Corresponds with the `event_name` field on a meter.", + "maxLength": 100, + "type": "string" + }, + "expand": { + "description": "Specifies which fields in the response should be expanded.", + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "identifier": { + "description": "A unique identifier for the event. If not provided, one will be generated.", + "maxLength": 100, + "type": "string" + }, + "payload": { + "additionalProperties": { + "type": "string" + }, + "description": "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.", + "type": "object" + }, + "timestamp": { + "description": "The time of the event. Measured in seconds since the Unix epoch.", + "format": "unix-time", + "type": "integer" + } + }, + "required": [ + "event_name", + "payload", + "timestamp" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/billing.meter_event" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + } + }, + "/v1/billing/meters": { + "get": { + "description": "

Retrieve a list of billing meters.

", + "operationId": "GetBillingMeters", + "parameters": [ + { + "description": "A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.", + "in": "query", + "name": "ending_before", + "required": false, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + }, + { + "description": "Specifies which fields in the response should be expanded.", + "explode": true, + "in": "query", + "name": "expand", + "required": false, + "schema": { + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "style": "deepObject" + }, + { + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.", + "in": "query", + "name": "limit", + "required": false, + "schema": { + "type": "integer" + }, + "style": "form" + }, + { + "description": "A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.", + "in": "query", + "name": "starting_after", + "required": false, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + }, + { + "description": "Filter results to only include meters with the given status.", + "in": "query", + "name": "status", + "required": false, + "schema": { + "enum": [ + "active", + "inactive" + ], + "type": "string" + }, + "style": "form" + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": {}, + "schema": { + "additionalProperties": false, + "properties": {}, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "description": "", + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/billing.meter" + }, + "type": "array" + }, + "has_more": { + "description": "True if this list has another page of items after this one that can be fetched.", + "type": "boolean" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value. Always has the value `list`.", + "enum": [ + "list" + ], + "type": "string" + }, + "url": { + "description": "The URL where this list can be accessed.", + "maxLength": 5000, + "pattern": "^/v1/billing/meters", + "type": "string" + } + }, + "required": [ + "data", + "has_more", + "object", + "url" + ], + "title": "BillingMeterResourceBillingMeterList", + "type": "object", + "x-expandableFields": [ + "data" + ] + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + }, + "post": { + "description": "

Creates a billing meter

", + "operationId": "PostBillingMeters", + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": { + "customer_mapping": { + "explode": true, + "style": "deepObject" + }, + "default_aggregation": { + "explode": true, + "style": "deepObject" + }, + "expand": { + "explode": true, + "style": "deepObject" + }, + "value_settings": { + "explode": true, + "style": "deepObject" + } + }, + "schema": { + "additionalProperties": false, + "properties": { + "customer_mapping": { + "description": "Fields that specify how to map a meter event to a customer.", + "properties": { + "event_payload_key": { + "description": "The key in the usage event payload to use for mapping the event to a customer.", + "maxLength": 100, + "type": "string" + }, + "type": { + "description": "The method for mapping a meter event to a customer. Must be `by_id`.", + "enum": [ + "by_id" + ], + "type": "string" + } + }, + "required": [ + "event_payload_key", + "type" + ], + "title": "customer_mapping_param", + "type": "object" + }, + "default_aggregation": { + "description": "The default settings to aggregate a meter's events with.", + "properties": { + "formula": { + "description": "Specifies how events are aggregated. Allowed values are `count` to count the number of events, `sum` to sum each event's value, or `last` to use the last event's value.", + "enum": [ + "count", + "sum" + ], + "type": "string" + } + }, + "required": [ + "formula" + ], + "title": "aggregation_settings_param", + "type": "object" + }, + "display_name": { + "description": "The meter's name.", + "maxLength": 250, + "type": "string" + }, + "event_name": { + "description": "The name of the usage event to record usage for. Corresponds with the `event_name` field on usage events.", + "maxLength": 100, + "type": "string" + }, + "event_time_window": { + "description": "The time window to pre-aggregate usage events for, if any.", + "enum": [ + "day", + "hour" + ], + "type": "string" + }, + "expand": { + "description": "Specifies which fields in the response should be expanded.", + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "value_settings": { + "description": "Fields that specify how to calculate a usage event's value.", + "properties": { + "event_payload_key": { + "description": "The key in the usage event payload to use as the value for this meter. For example, if the event payload contains usage on a `bytes_used` field, then set the event_payload_key to \"bytes_used\".", + "maxLength": 100, + "type": "string" + } + }, + "required": [ + "event_payload_key" + ], + "title": "meter_value_settings_param", + "type": "object" + } + }, + "required": [ + "default_aggregation", + "display_name", + "event_name" + ], + "type": "object" + } + } + }, + "required": true + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/billing.meter" + } + } + }, + "description": "Successful response." + }, + "default": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "Error response." + } + } + } + }, + "/v1/billing/meters/{id}": { + "get": { + "description": "

Retrieves a billing meter given an ID

", + "operationId": "GetBillingMetersId", + "parameters": [ + { + "description": "Specifies which fields in the response should be expanded.", + "explode": true, + "in": "query", + "name": "expand", + "required": false, + "schema": { + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + }, + "style": "deepObject" + }, + { + "description": "Unique identifier for the object.", + "in": "path", + "name": "id", + "required": true, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "simple" + } + ], + "requestBody": { + "content": { + "application/x-www-form-urlencoded": { + "encoding": {}, + "schema": { + "additionalProperties": false, + "properties": {}, + "type": "object" + } + } + }, + "required": false + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/billing.meter" } } }, @@ -78149,78 +79456,49 @@ "description": "Error response." } } - } - }, - "/v1/billing/margins": { - "get": { - "description": "

Retrieve a list of your margins.

", - "operationId": "GetBillingMargins", + }, + "post": { + "description": "

Updates a billing meter

", + "operationId": "PostBillingMetersId", "parameters": [ { - "description": "Only return margins that are active or inactive, i.e., pass false to list all inactive margins.", - "in": "query", - "name": "active", - "required": false, - "schema": { - "type": "boolean" - }, - "style": "form" - }, - { - "description": "A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.", - "in": "query", - "name": "ending_before", - "required": false, - "schema": { - "maxLength": 5000, - "type": "string" - }, - "style": "form" - }, - { - "description": "Specifies which fields in the response should be expanded.", - "explode": true, - "in": "query", - "name": "expand", - "required": false, - "schema": { - "items": { - "maxLength": 5000, - "type": "string" - }, - "type": "array" - }, - "style": "deepObject" - }, - { - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.", - "in": "query", - "name": "limit", - "required": false, - "schema": { - "type": "integer" - }, - "style": "form" - }, - { - "description": "A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.", - "in": "query", - "name": "starting_after", - "required": false, + "description": "Unique identifier for the object.", + "in": "path", + "name": "id", + "required": true, "schema": { "maxLength": 5000, "type": "string" }, - "style": "form" + "style": "simple" } ], "requestBody": { "content": { "application/x-www-form-urlencoded": { - "encoding": {}, + "encoding": { + "expand": { + "explode": true, + "style": "deepObject" + } + }, "schema": { "additionalProperties": false, - "properties": {}, + "properties": { + "display_name": { + "description": "The meter's name.", + "maxLength": 250, + "type": "string" + }, + "expand": { + "description": "Specifies which fields in the response should be expanded.", + "items": { + "maxLength": 5000, + "type": "string" + }, + "type": "array" + } + }, "type": "object" } } @@ -78232,44 +79510,7 @@ "content": { "application/json": { "schema": { - "description": "", - "properties": { - "data": { - "description": "Details about each object.", - "items": { - "$ref": "#/components/schemas/margin" - }, - "type": "array" - }, - "has_more": { - "description": "True if this list has another page of items after this one that can be fetched.", - "type": "boolean" - }, - "object": { - "description": "String representing the object's type. Objects of the same type share the same value. Always has the value `list`.", - "enum": [ - "list" - ], - "type": "string" - }, - "url": { - "description": "The URL where this list can be accessed.", - "maxLength": 5000, - "pattern": "^/v1/billing/margins", - "type": "string" - } - }, - "required": [ - "data", - "has_more", - "object", - "url" - ], - "title": "MarginList", - "type": "object", - "x-expandableFields": [ - "data" - ] + "$ref": "#/components/schemas/billing.meter" } } }, @@ -78286,10 +79527,25 @@ "description": "Error response." } } - }, + } + }, + "/v1/billing/meters/{id}/deactivate": { "post": { - "description": "

Create a margin object to be used with invoices, invoice items, and invoice line items for a customer to represent a partner discount.A margin has a percent_off which is the percent that will be taken off the subtotal after all items and other discounts and promotions) of any invoices for a customer. Calculation of prorations do not include any partner margins applied on the original invoice item.

", - "operationId": "PostBillingMargins", + "description": "

Deactivates a billing meter

", + "operationId": "PostBillingMetersIdDeactivate", + "parameters": [ + { + "description": "Unique identifier for the object.", + "in": "path", + "name": "id", + "required": true, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "simple" + } + ], "requestBody": { "content": { "application/x-www-form-urlencoded": { @@ -78297,19 +79553,11 @@ "expand": { "explode": true, "style": "deepObject" - }, - "metadata": { - "explode": true, - "style": "deepObject" } }, "schema": { "additionalProperties": false, "properties": { - "active": { - "description": "Whether the margin can be applied to invoices, invoice items, or invoice line items or not. Defaults to `true`.", - "type": "boolean" - }, "expand": { "description": "Specifies which fields in the response should be expanded.", "items": { @@ -78317,39 +79565,20 @@ "type": "string" }, "type": "array" - }, - "metadata": { - "additionalProperties": { - "type": "string" - }, - "description": "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`.", - "type": "object" - }, - "name": { - "description": "Name of the margin, which is displayed to customers, such as on invoices.", - "maxLength": 5000, - "type": "string" - }, - "percent_off": { - "description": "Percent that will be taken off the subtotal before tax (after all other discounts and promotions) of any invoice to which the margin is applied.", - "type": "number" } }, - "required": [ - "percent_off" - ], "type": "object" } } }, - "required": true + "required": false }, "responses": { "200": { "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/margin" + "$ref": "#/components/schemas/billing.meter" } } }, @@ -78368,11 +79597,44 @@ } } }, - "/v1/billing/margins/{margin}": { + "/v1/billing/meters/{id}/event_summaries": { "get": { - "description": "

Retrieve a margin object with the given ID.

", - "operationId": "GetBillingMarginsMargin", + "description": "

Retrieve a list of billing meter event summaries.

", + "operationId": "GetBillingMetersIdEventSummaries", "parameters": [ + { + "description": "The customer for which to fetch event summaries.", + "in": "query", + "name": "customer", + "required": true, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + }, + { + "description": "The timestamp from when to stop aggregating usage events (exclusive).", + "in": "query", + "name": "end_time", + "required": true, + "schema": { + "format": "unix-time", + "type": "integer" + }, + "style": "form" + }, + { + "description": "A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.", + "in": "query", + "name": "ending_before", + "required": false, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + }, { "description": "Specifies which fields in the response should be expanded.", "explode": true, @@ -78389,14 +79651,60 @@ "style": "deepObject" }, { + "description": "Unique identifier for the object.", "in": "path", - "name": "margin", + "name": "id", "required": true, "schema": { "maxLength": 5000, "type": "string" }, "style": "simple" + }, + { + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.", + "in": "query", + "name": "limit", + "required": false, + "schema": { + "type": "integer" + }, + "style": "form" + }, + { + "description": "The timestamp from when to start aggregating usage events (inclusive).", + "in": "query", + "name": "start_time", + "required": true, + "schema": { + "format": "unix-time", + "type": "integer" + }, + "style": "form" + }, + { + "description": "A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.", + "in": "query", + "name": "starting_after", + "required": false, + "schema": { + "maxLength": 5000, + "type": "string" + }, + "style": "form" + }, + { + "description": "Specifies what granularity to use when generating event summaries. If not specified, a single event summary would be returned for the specified time range.", + "in": "query", + "name": "value_grouping_window", + "required": false, + "schema": { + "enum": [ + "hour" + ], + "type": "string" + }, + "style": "form" } ], "requestBody": { @@ -78417,7 +79725,43 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/margin" + "description": "", + "properties": { + "data": { + "items": { + "$ref": "#/components/schemas/billing.meter_event_summary" + }, + "type": "array" + }, + "has_more": { + "description": "True if this list has another page of items after this one that can be fetched.", + "type": "boolean" + }, + "object": { + "description": "String representing the object's type. Objects of the same type share the same value. Always has the value `list`.", + "enum": [ + "list" + ], + "type": "string" + }, + "url": { + "description": "The URL where this list can be accessed.", + "maxLength": 5000, + "pattern": "^/v1/billing/meters/[^/]+/event_summaries", + "type": "string" + } + }, + "required": [ + "data", + "has_more", + "object", + "url" + ], + "title": "BillingMeterResourceBillingMeterEventSummaryList", + "type": "object", + "x-expandableFields": [ + "data" + ] } } }, @@ -78434,14 +79778,17 @@ "description": "Error response." } } - }, + } + }, + "/v1/billing/meters/{id}/reactivate": { "post": { - "description": "

Update the specified margin object. Certain fields of the margin object are not editable.

", - "operationId": "PostBillingMarginsMargin", + "description": "

Reactivates a billing meter

", + "operationId": "PostBillingMetersIdReactivate", "parameters": [ { + "description": "Unique identifier for the object.", "in": "path", - "name": "margin", + "name": "id", "required": true, "schema": { "maxLength": 5000, @@ -78457,19 +79804,11 @@ "expand": { "explode": true, "style": "deepObject" - }, - "metadata": { - "explode": true, - "style": "deepObject" } }, "schema": { "additionalProperties": false, "properties": { - "active": { - "description": "Whether the margin can be applied to invoices, invoice items, or invoice line items or not.", - "type": "boolean" - }, "expand": { "description": "Specifies which fields in the response should be expanded.", "items": { @@ -78477,18 +79816,6 @@ "type": "string" }, "type": "array" - }, - "metadata": { - "additionalProperties": { - "type": "string" - }, - "description": "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`.", - "type": "object" - }, - "name": { - "description": "Name of the margin, which is displayed to customers, such as on invoices.", - "maxLength": 5000, - "type": "string" } }, "type": "object" @@ -78502,7 +79829,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/margin" + "$ref": "#/components/schemas/billing.meter" } } }, @@ -151633,6 +152960,11 @@ ], "description": "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`." }, + "meter": { + "description": "The meter tracking the usage of a metered price", + "maxLength": 5000, + "type": "string" + }, "nickname": { "description": "A brief description of the plan, hidden from customers.", "maxLength": 5000, @@ -152182,6 +153514,11 @@ ], "type": "string" }, + "meter": { + "description": "Filter by the price's meter.", + "maxLength": 5000, + "type": "string" + }, "usage_type": { "description": "Filter by the usage type for this price. Can be either `metered` or `licensed`.", "enum": [ @@ -152583,6 +153920,11 @@ "description": "The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).", "type": "integer" }, + "meter": { + "description": "The meter tracking the usage of a metered price", + "maxLength": 5000, + "type": "string" + }, "trial_period_days": { "description": "Default number of trial days when subscribing a customer to this price using [`trial_from_plan=true`](https://stripe.com/docs/api#create_subscription-trial_from_plan).", "type": "integer"