stripe/model/subscription_schedule_phase_configuration.rs
1use serde::{Serialize, Deserialize};
2use super::{
3 SchedulesPhaseAutomaticTax, SubscriptionScheduleAddInvoiceItem,
4 SubscriptionScheduleConfigurationItem, TaxRate,
5};
6///A phase describes the plans, coupon, and trialing status of a subscription for a predefined time period.
7#[derive(Debug, Clone, Serialize, Deserialize, Default)]
8pub struct SubscriptionSchedulePhaseConfiguration {
9 ///A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
10 pub add_invoice_items: Vec<SubscriptionScheduleAddInvoiceItem>,
11 ///A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account during this phase of the schedule.
12 #[serde(skip_serializing_if = "Option::is_none")]
13 pub application_fee_percent: Option<f64>,
14 ///
15 #[serde(skip_serializing_if = "Option::is_none")]
16 pub automatic_tax: Option<SchedulesPhaseAutomaticTax>,
17 ///Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
18 #[serde(skip_serializing_if = "Option::is_none")]
19 pub billing_cycle_anchor: Option<String>,
20 ///Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
21 #[serde(skip_serializing_if = "Option::is_none")]
22 pub billing_thresholds: Option<serde_json::Value>,
23 ///Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
24 #[serde(skip_serializing_if = "Option::is_none")]
25 pub collection_method: Option<String>,
26 ///ID of the coupon to use during this phase of the subscription schedule.
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub coupon: Option<serde_json::Value>,
29 ///Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
30 pub currency: String,
31 ///ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
32 #[serde(skip_serializing_if = "Option::is_none")]
33 pub default_payment_method: Option<serde_json::Value>,
34 ///The default tax rates to apply to the subscription during this phase of the subscription schedule.
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub default_tax_rates: Option<Vec<TaxRate>>,
37 ///Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
38 #[serde(skip_serializing_if = "Option::is_none")]
39 pub description: Option<String>,
40 ///The end of this phase of the subscription schedule.
41 pub end_date: i64,
42 ///The invoice settings applicable during this phase.
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub invoice_settings: Option<serde_json::Value>,
45 ///Subscription items to configure the subscription to during this phase of the subscription schedule.
46 pub items: Vec<SubscriptionScheduleConfigurationItem>,
47 ///Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered. Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`.
48 #[serde(skip_serializing_if = "Option::is_none")]
49 pub metadata: Option<serde_json::Value>,
50 ///The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription. See the Connect documentation for details.
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub on_behalf_of: Option<serde_json::Value>,
53 ///If the subscription schedule will prorate when transitioning to this phase. Possible values are `create_prorations` and `none`.
54 pub proration_behavior: String,
55 ///The start of this phase of the subscription schedule.
56 pub start_date: i64,
57 ///The account (if any) the associated subscription's payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription's invoices.
58 #[serde(skip_serializing_if = "Option::is_none")]
59 pub transfer_data: Option<serde_json::Value>,
60 ///When the trial ends within the phase.
61 #[serde(skip_serializing_if = "Option::is_none")]
62 pub trial_end: Option<i64>,
63}
64impl std::fmt::Display for SubscriptionSchedulePhaseConfiguration {
65 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
66 write!(f, "{}", serde_json::to_string(self).unwrap())
67 }
68}