stripe/model/usage_record.rs
1use serde::{Serialize, Deserialize};
2/**Usage records allow you to report customer usage and metrics to Stripe for
3metered billing of subscription prices.
4
5Related guide: [Metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing)*/
6#[derive(Debug, Clone, Serialize, Deserialize, Default)]
7pub struct UsageRecord {
8 ///Unique identifier for the object.
9 pub id: String,
10 ///Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
11 pub livemode: bool,
12 ///String representing the object's type. Objects of the same type share the same value.
13 pub object: String,
14 ///The usage quantity for the specified date.
15 pub quantity: i64,
16 ///The ID of the subscription item this usage record contains data for.
17 pub subscription_item: String,
18 ///The timestamp when this usage occurred.
19 pub timestamp: i64,
20}
21impl std::fmt::Display for UsageRecord {
22 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
23 write!(f, "{}", serde_json::to_string(self).unwrap())
24 }
25}