UsageRecords
[DEPRECATED] Creates and returns customer usage records and summaries for metered billing of subscription prices, including usage quantities and billing periods.
Table-Specific Information
SELECT
The provider uses the Stripe API to filter the results by the following columns and operators while the rest of the filter is executed client-side within the provider.
| Column | Supported Operators |
| SubscriptionItem | = |
| AccountId | = |
To retrieve a usage record, SubscriptionItem is required:
SELECT * FROM UsageRecords WHERE SubscriptionItem = 'si_NBswnjzMefKen7'
INSERT
To create a usage record for a subscription item, you must specify at least a SubscriptionItem value:
INSERT INTO UsageRecords (SubscriptionItem, Timestamp, Quantity) values ('si_NBswnjzMefKen7', '2023-07-14T05:36:46.000-04:00', 100)
Columns
| Name | Type | ReadOnly | References | Description |
| Id [KEY] | String | True |
The Id of the usage record. | |
| Invoice | String | True |
Invoices.Id |
The Id of the invoice. |
| Livemode | Boolean | True |
Indicates whether the object exists in live mode. Has the value true if the object exists in live mode, or the value false if the object exists in test mode. | |
| PeriodEnd | Datetime | True |
The time of the period end. | |
| PeriodStart | Datetime | True |
The time of the period start. | |
| SubscriptionItem | String | False |
The Id of the subscription item. | |
| Timestamp | Datetime | False |
The timestamp for the usage event. | |
| TotalUsage | Integer | True |
The total usage. |
Pseudocolumns
Pseudocolumn fields are used in the WHERE clause of SELECT statements and offer more granular control over the data returned from the data source.
| Name | Type | Description |
| AccountId | String |
The Id of the connected account to get usage records for. |
| Quantity | Integer |
The usage quantity for the specified date. This column supports only insert operation. |