stripe/resources/generated/subscription_schedule.rs
1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::client::{Client, Response};
6use crate::ids::{CustomerId, SubscriptionScheduleId};
7use crate::params::{Expand, Expandable, List, Metadata, Object, Paginable, RangeQuery, Timestamp};
8use crate::resources::{
9 Account, Application, CollectionMethod, ConnectAccountReference, Coupon, Currency, Customer,
10 PaymentMethod, Plan, Price, Scheduled, Subscription, SubscriptionBillingThresholds,
11 SubscriptionItemBillingThresholds, SubscriptionTransferData, TaxId, TaxRate,
12 TestHelpersTestClock,
13};
14use serde::{Deserialize, Serialize};
15
16/// The resource representing a Stripe "SubscriptionSchedule".
17///
18/// For more details see <https://stripe.com/docs/api/subscription_schedules/object>
19#[derive(Clone, Debug, Default, Deserialize, Serialize)]
20pub struct SubscriptionSchedule {
21 /// Unique identifier for the object.
22 pub id: SubscriptionScheduleId,
23
24 /// ID of the Connect Application that created the schedule.
25 pub application: Option<Expandable<Application>>,
26
27 /// Time at which the subscription schedule was canceled.
28 ///
29 /// Measured in seconds since the Unix epoch.
30 pub canceled_at: Option<Timestamp>,
31
32 /// Time at which the subscription schedule was completed.
33 ///
34 /// Measured in seconds since the Unix epoch.
35 pub completed_at: Option<Timestamp>,
36
37 /// Time at which the object was created.
38 ///
39 /// Measured in seconds since the Unix epoch.
40 pub created: Timestamp,
41
42 /// Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`.
43 pub current_phase: Option<SubscriptionScheduleCurrentPhase>,
44
45 /// ID of the customer who owns the subscription schedule.
46 pub customer: Expandable<Customer>,
47
48 pub default_settings: SubscriptionScheduleDefaultSettings,
49
50 /// Behavior of the subscription schedule and underlying subscription when it ends.
51 ///
52 /// Possible values are `release` or `cancel` with the default being `release`.
53 /// `release` will end the subscription schedule and keep the underlying subscription running.
54 /// `cancel` will end the subscription schedule and cancel the underlying subscription.
55 pub end_behavior: SubscriptionScheduleEndBehavior,
56
57 /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
58 pub livemode: bool,
59
60 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
61 ///
62 /// This can be useful for storing additional information about the object in a structured format.
63 pub metadata: Option<Metadata>,
64
65 /// Configuration for the subscription schedule's phases.
66 pub phases: Vec<SubscriptionSchedulePhaseConfiguration>,
67
68 /// Time at which the subscription schedule was released.
69 ///
70 /// Measured in seconds since the Unix epoch.
71 pub released_at: Option<Timestamp>,
72
73 /// ID of the subscription once managed by the subscription schedule (if it is released).
74 pub released_subscription: Option<String>,
75
76 /// The present status of the subscription schedule.
77 ///
78 /// Possible values are `not_started`, `active`, `completed`, `released`, and `canceled`.
79 /// You can read more about the different states in our [behavior guide](https://stripe.com/docs/billing/subscriptions/subscription-schedules).
80 pub status: SubscriptionScheduleStatus,
81
82 /// ID of the subscription managed by the subscription schedule.
83 pub subscription: Option<Expandable<Subscription>>,
84
85 /// ID of the test clock this subscription schedule belongs to.
86 pub test_clock: Option<Expandable<TestHelpersTestClock>>,
87}
88
89impl SubscriptionSchedule {
90 /// Retrieves the list of your subscription schedules.
91 pub fn list(
92 client: &Client,
93 params: &ListSubscriptionSchedules<'_>,
94 ) -> Response<List<SubscriptionSchedule>> {
95 client.get_query("/subscription_schedules", params)
96 }
97
98 /// Creates a new subscription schedule object.
99 ///
100 /// Each customer can have up to 500 active or scheduled subscriptions.
101 pub fn create(
102 client: &Client,
103 params: CreateSubscriptionSchedule<'_>,
104 ) -> Response<SubscriptionSchedule> {
105 #[allow(clippy::needless_borrows_for_generic_args)]
106 client.post_form("/subscription_schedules", ¶ms)
107 }
108
109 /// Retrieves the details of an existing subscription schedule.
110 ///
111 /// You only need to supply the unique subscription schedule identifier that was returned upon subscription schedule creation.
112 pub fn retrieve(
113 client: &Client,
114 id: &SubscriptionScheduleId,
115 expand: &[&str],
116 ) -> Response<SubscriptionSchedule> {
117 client.get_query(&format!("/subscription_schedules/{}", id), Expand { expand })
118 }
119
120 /// Updates an existing subscription schedule.
121 pub fn update(
122 client: &Client,
123 id: &SubscriptionScheduleId,
124 params: UpdateSubscriptionSchedule<'_>,
125 ) -> Response<SubscriptionSchedule> {
126 #[allow(clippy::needless_borrows_for_generic_args)]
127 client.post_form(&format!("/subscription_schedules/{}", id), ¶ms)
128 }
129}
130
131impl Object for SubscriptionSchedule {
132 type Id = SubscriptionScheduleId;
133 fn id(&self) -> Self::Id {
134 self.id.clone()
135 }
136 fn object(&self) -> &'static str {
137 "subscription_schedule"
138 }
139}
140
141#[derive(Clone, Debug, Default, Deserialize, Serialize)]
142pub struct SubscriptionScheduleCurrentPhase {
143 /// The end of this phase of the subscription schedule.
144 pub end_date: Timestamp,
145
146 /// The start of this phase of the subscription schedule.
147 pub start_date: Timestamp,
148}
149
150#[derive(Clone, Debug, Default, Deserialize, Serialize)]
151pub struct SubscriptionSchedulePhaseConfiguration {
152 /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
153 pub add_invoice_items: Vec<SubscriptionScheduleAddInvoiceItem>,
154
155 /// A non-negative decimal between 0 and 100, with at most two decimal places.
156 ///
157 /// 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.
158 pub application_fee_percent: Option<f64>,
159
160 #[serde(skip_serializing_if = "Option::is_none")]
161 pub automatic_tax: Option<SchedulesPhaseAutomaticTax>,
162
163 /// Possible values are `phase_start` or `automatic`.
164 ///
165 /// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
166 /// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
167 /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
168 pub billing_cycle_anchor: Option<SubscriptionSchedulePhaseConfigurationBillingCycleAnchor>,
169
170 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
171 pub billing_thresholds: Option<SubscriptionBillingThresholds>,
172
173 /// Either `charge_automatically`, or `send_invoice`.
174 ///
175 /// 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.
176 /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
177 pub collection_method: Option<CollectionMethod>,
178
179 /// ID of the coupon to use during this phase of the subscription schedule.
180 pub coupon: Option<Expandable<Coupon>>,
181
182 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
183 ///
184 /// Must be a [supported currency](https://stripe.com/docs/currencies).
185 pub currency: Currency,
186
187 /// ID of the default payment method for the subscription schedule.
188 ///
189 /// It must belong to the customer associated with the subscription schedule.
190 /// If not set, invoices will use the default payment method in the customer's invoice settings.
191 pub default_payment_method: Option<Expandable<PaymentMethod>>,
192
193 /// The default tax rates to apply to the subscription during this phase of the subscription schedule.
194 #[serde(skip_serializing_if = "Option::is_none")]
195 pub default_tax_rates: Option<Vec<TaxRate>>,
196
197 /// Subscription description, meant to be displayable to the customer.
198 ///
199 /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
200 pub description: Option<String>,
201
202 /// The end of this phase of the subscription schedule.
203 pub end_date: Timestamp,
204
205 /// The invoice settings applicable during this phase.
206 pub invoice_settings: Option<InvoiceSettingSubscriptionSchedulePhaseSetting>,
207
208 /// Subscription items to configure the subscription to during this phase of the subscription schedule.
209 pub items: Vec<SubscriptionScheduleConfigurationItem>,
210
211 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
212 ///
213 /// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered.
214 /// Updating the underlying subscription's `metadata` directly will not affect the current phase's `metadata`.
215 pub metadata: Option<Metadata>,
216
217 /// The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription.
218 ///
219 /// See the Connect documentation for details.
220 pub on_behalf_of: Option<Expandable<Account>>,
221
222 /// If the subscription schedule will prorate when transitioning to this phase.
223 ///
224 /// Possible values are `create_prorations` and `none`.
225 pub proration_behavior: SubscriptionProrationBehavior,
226
227 /// The start of this phase of the subscription schedule.
228 pub start_date: Timestamp,
229
230 /// 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.
231 pub transfer_data: Option<SubscriptionTransferData>,
232
233 /// When the trial ends within the phase.
234 pub trial_end: Option<Timestamp>,
235}
236
237#[derive(Clone, Debug, Default, Deserialize, Serialize)]
238pub struct InvoiceSettingSubscriptionSchedulePhaseSetting {
239 /// The account tax IDs associated with this phase of the subscription schedule.
240 ///
241 /// Will be set on invoices generated by this phase of the subscription schedule.
242 #[serde(skip_serializing_if = "Option::is_none")]
243 pub account_tax_ids: Option<Vec<Expandable<TaxId>>>,
244
245 /// Number of days within which a customer must pay invoices generated by this subscription schedule.
246 ///
247 /// This value will be `null` for subscription schedules where `billing=charge_automatically`.
248 pub days_until_due: Option<u32>,
249
250 /// The connected account that issues the invoice.
251 ///
252 /// The invoice is presented with the branding and support information of the specified account.
253 pub issuer: Option<ConnectAccountReference>,
254}
255
256#[derive(Clone, Debug, Default, Deserialize, Serialize)]
257pub struct SchedulesPhaseAutomaticTax {
258 /// Whether Stripe automatically computes tax on invoices created during this phase.
259 pub enabled: bool,
260
261 /// The account that's liable for tax.
262 ///
263 /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
264 /// The tax transaction is returned in the report of the connected account.
265 pub liability: Option<ConnectAccountReference>,
266}
267
268#[derive(Clone, Debug, Default, Deserialize, Serialize)]
269pub struct SubscriptionScheduleAddInvoiceItem {
270 /// ID of the price used to generate the invoice item.
271 pub price: Expandable<Price>,
272
273 /// The quantity of the invoice item.
274 pub quantity: Option<u64>,
275
276 /// The tax rates which apply to the item.
277 ///
278 /// When set, the `default_tax_rates` do not apply to this item.
279 #[serde(skip_serializing_if = "Option::is_none")]
280 pub tax_rates: Option<Vec<TaxRate>>,
281}
282
283#[derive(Clone, Debug, Default, Deserialize, Serialize)]
284pub struct SubscriptionScheduleConfigurationItem {
285 /// Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period.
286 pub billing_thresholds: Option<SubscriptionItemBillingThresholds>,
287
288 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an item.
289 ///
290 /// Metadata on this item will update the underlying subscription item's `metadata` when the phase is entered.
291 pub metadata: Option<Metadata>,
292
293 /// ID of the plan to which the customer should be subscribed.
294 pub plan: Expandable<Plan>,
295
296 /// ID of the price to which the customer should be subscribed.
297 pub price: Expandable<Price>,
298
299 /// Quantity of the plan to which the customer should be subscribed.
300 #[serde(skip_serializing_if = "Option::is_none")]
301 pub quantity: Option<u64>,
302
303 /// The tax rates which apply to this `phase_item`.
304 ///
305 /// When set, the `default_tax_rates` on the phase do not apply to this `phase_item`.
306 #[serde(skip_serializing_if = "Option::is_none")]
307 pub tax_rates: Option<Vec<TaxRate>>,
308}
309
310#[derive(Clone, Debug, Default, Deserialize, Serialize)]
311pub struct SubscriptionScheduleDefaultSettings {
312 /// A non-negative decimal between 0 and 100, with at most two decimal places.
313 ///
314 /// 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.
315 pub application_fee_percent: Option<f64>,
316
317 #[serde(skip_serializing_if = "Option::is_none")]
318 pub automatic_tax: Option<SubscriptionSchedulesResourceDefaultSettingsAutomaticTax>,
319
320 /// Possible values are `phase_start` or `automatic`.
321 ///
322 /// If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase.
323 /// If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase.
324 /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
325 pub billing_cycle_anchor: SubscriptionScheduleDefaultSettingsBillingCycleAnchor,
326
327 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
328 pub billing_thresholds: Option<SubscriptionBillingThresholds>,
329
330 /// Either `charge_automatically`, or `send_invoice`.
331 ///
332 /// 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.
333 /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
334 pub collection_method: Option<SubscriptionScheduleDefaultSettingsCollectionMethod>,
335
336 /// ID of the default payment method for the subscription schedule.
337 ///
338 /// If not set, invoices will use the default payment method in the customer's invoice settings.
339 pub default_payment_method: Option<Expandable<PaymentMethod>>,
340
341 /// Subscription description, meant to be displayable to the customer.
342 ///
343 /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
344 pub description: Option<String>,
345
346 pub invoice_settings: SubscriptionScheduleInvoiceSettings,
347
348 /// The account (if any) the charge was made on behalf of for charges associated with the schedule's subscription.
349 ///
350 /// See the Connect documentation for details.
351 pub on_behalf_of: Option<Expandable<Account>>,
352
353 /// 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.
354 pub transfer_data: Option<SubscriptionTransferData>,
355}
356
357#[derive(Clone, Debug, Default, Deserialize, Serialize)]
358pub struct SubscriptionSchedulesResourceDefaultSettingsAutomaticTax {
359 /// Whether Stripe automatically computes tax on invoices created during this phase.
360 pub enabled: bool,
361
362 /// The account that's liable for tax.
363 ///
364 /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
365 /// The tax transaction is returned in the report of the connected account.
366 pub liability: Option<ConnectAccountReference>,
367}
368
369/// The parameters for `SubscriptionSchedule::create`.
370#[derive(Clone, Debug, Serialize, Default)]
371pub struct CreateSubscriptionSchedule<'a> {
372 /// The identifier of the customer to create the subscription schedule for.
373 #[serde(skip_serializing_if = "Option::is_none")]
374 pub customer: Option<CustomerId>,
375
376 /// Object representing the subscription schedule's default settings.
377 #[serde(skip_serializing_if = "Option::is_none")]
378 pub default_settings: Option<SubscriptionScheduleDefaultSettingsParams>,
379
380 /// Behavior of the subscription schedule and underlying subscription when it ends.
381 ///
382 /// Possible values are `release` or `cancel` with the default being `release`.
383 /// `release` will end the subscription schedule and keep the underlying subscription running.
384 /// `cancel` will end the subscription schedule and cancel the underlying subscription.
385 #[serde(skip_serializing_if = "Option::is_none")]
386 pub end_behavior: Option<SubscriptionScheduleEndBehavior>,
387
388 /// Specifies which fields in the response should be expanded.
389 #[serde(skip_serializing_if = "Expand::is_empty")]
390 pub expand: &'a [&'a str],
391
392 /// Migrate an existing subscription to be managed by a subscription schedule.
393 ///
394 /// If this parameter is set, a subscription schedule will be created using the subscription's item(s), set to auto-renew using the subscription's interval.
395 /// When using this parameter, other parameters (such as phase values) cannot be set.
396 /// To create a subscription schedule with other modifications, we recommend making two separate API calls.
397 #[serde(skip_serializing_if = "Option::is_none")]
398 pub from_subscription: Option<&'a str>,
399
400 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
401 ///
402 /// This can be useful for storing additional information about the object in a structured format.
403 /// Individual keys can be unset by posting an empty value to them.
404 /// All keys can be unset by posting an empty value to `metadata`.
405 #[serde(skip_serializing_if = "Option::is_none")]
406 pub metadata: Option<Metadata>,
407
408 /// List representing phases of the subscription schedule.
409 ///
410 /// Each phase can be customized to have different durations, plans, and coupons.
411 /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
412 #[serde(skip_serializing_if = "Option::is_none")]
413 pub phases: Option<Vec<CreateSubscriptionSchedulePhases>>,
414
415 /// When the subscription schedule starts.
416 ///
417 /// We recommend using `now` so that it starts the subscription immediately.
418 /// You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on.
419 #[serde(skip_serializing_if = "Option::is_none")]
420 pub start_date: Option<Scheduled>,
421}
422
423impl<'a> CreateSubscriptionSchedule<'a> {
424 pub fn new() -> Self {
425 CreateSubscriptionSchedule {
426 customer: Default::default(),
427 default_settings: Default::default(),
428 end_behavior: Default::default(),
429 expand: Default::default(),
430 from_subscription: Default::default(),
431 metadata: Default::default(),
432 phases: Default::default(),
433 start_date: Default::default(),
434 }
435 }
436}
437
438/// The parameters for `SubscriptionSchedule::list`.
439#[derive(Clone, Debug, Serialize, Default)]
440pub struct ListSubscriptionSchedules<'a> {
441 /// Only return subscription schedules that were created canceled the given date interval.
442 #[serde(skip_serializing_if = "Option::is_none")]
443 pub canceled_at: Option<RangeQuery<Timestamp>>,
444
445 /// Only return subscription schedules that completed during the given date interval.
446 #[serde(skip_serializing_if = "Option::is_none")]
447 pub completed_at: Option<RangeQuery<Timestamp>>,
448
449 /// Only return subscription schedules that were created during the given date interval.
450 #[serde(skip_serializing_if = "Option::is_none")]
451 pub created: Option<RangeQuery<Timestamp>>,
452
453 /// Only return subscription schedules for the given customer.
454 #[serde(skip_serializing_if = "Option::is_none")]
455 pub customer: Option<CustomerId>,
456
457 /// A cursor for use in pagination.
458 ///
459 /// `ending_before` is an object ID that defines your place in the list.
460 /// 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.
461 #[serde(skip_serializing_if = "Option::is_none")]
462 pub ending_before: Option<SubscriptionScheduleId>,
463
464 /// Specifies which fields in the response should be expanded.
465 #[serde(skip_serializing_if = "Expand::is_empty")]
466 pub expand: &'a [&'a str],
467
468 /// A limit on the number of objects to be returned.
469 ///
470 /// Limit can range between 1 and 100, and the default is 10.
471 #[serde(skip_serializing_if = "Option::is_none")]
472 pub limit: Option<u64>,
473
474 /// Only return subscription schedules that were released during the given date interval.
475 #[serde(skip_serializing_if = "Option::is_none")]
476 pub released_at: Option<RangeQuery<Timestamp>>,
477
478 /// Only return subscription schedules that have not started yet.
479 #[serde(skip_serializing_if = "Option::is_none")]
480 pub scheduled: Option<bool>,
481
482 /// A cursor for use in pagination.
483 ///
484 /// `starting_after` is an object ID that defines your place in the list.
485 /// 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.
486 #[serde(skip_serializing_if = "Option::is_none")]
487 pub starting_after: Option<SubscriptionScheduleId>,
488}
489
490impl<'a> ListSubscriptionSchedules<'a> {
491 pub fn new() -> Self {
492 ListSubscriptionSchedules {
493 canceled_at: Default::default(),
494 completed_at: Default::default(),
495 created: Default::default(),
496 customer: Default::default(),
497 ending_before: Default::default(),
498 expand: Default::default(),
499 limit: Default::default(),
500 released_at: Default::default(),
501 scheduled: Default::default(),
502 starting_after: Default::default(),
503 }
504 }
505}
506impl Paginable for ListSubscriptionSchedules<'_> {
507 type O = SubscriptionSchedule;
508 fn set_last(&mut self, item: Self::O) {
509 self.starting_after = Some(item.id());
510 }
511}
512/// The parameters for `SubscriptionSchedule::update`.
513#[derive(Clone, Debug, Serialize, Default)]
514pub struct UpdateSubscriptionSchedule<'a> {
515 /// Object representing the subscription schedule's default settings.
516 #[serde(skip_serializing_if = "Option::is_none")]
517 pub default_settings: Option<SubscriptionScheduleDefaultSettingsParams>,
518
519 /// Behavior of the subscription schedule and underlying subscription when it ends.
520 ///
521 /// Possible values are `release` or `cancel` with the default being `release`.
522 /// `release` will end the subscription schedule and keep the underlying subscription running.
523 /// `cancel` will end the subscription schedule and cancel the underlying subscription.
524 #[serde(skip_serializing_if = "Option::is_none")]
525 pub end_behavior: Option<SubscriptionScheduleEndBehavior>,
526
527 /// Specifies which fields in the response should be expanded.
528 #[serde(skip_serializing_if = "Expand::is_empty")]
529 pub expand: &'a [&'a str],
530
531 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object.
532 ///
533 /// This can be useful for storing additional information about the object in a structured format.
534 /// Individual keys can be unset by posting an empty value to them.
535 /// All keys can be unset by posting an empty value to `metadata`.
536 #[serde(skip_serializing_if = "Option::is_none")]
537 pub metadata: Option<Metadata>,
538
539 /// List representing phases of the subscription schedule.
540 ///
541 /// Each phase can be customized to have different durations, plans, and coupons.
542 /// If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
543 /// Note that past phases can be omitted.
544 #[serde(skip_serializing_if = "Option::is_none")]
545 pub phases: Option<Vec<UpdateSubscriptionSchedulePhases>>,
546
547 /// If the update changes the current phase, indicates whether the changes should be prorated.
548 ///
549 /// The default value is `create_prorations`.
550 #[serde(skip_serializing_if = "Option::is_none")]
551 pub proration_behavior: Option<SubscriptionProrationBehavior>,
552}
553
554impl<'a> UpdateSubscriptionSchedule<'a> {
555 pub fn new() -> Self {
556 UpdateSubscriptionSchedule {
557 default_settings: Default::default(),
558 end_behavior: Default::default(),
559 expand: Default::default(),
560 metadata: Default::default(),
561 phases: Default::default(),
562 proration_behavior: Default::default(),
563 }
564 }
565}
566
567#[derive(Clone, Debug, Default, Deserialize, Serialize)]
568pub struct CreateSubscriptionSchedulePhases {
569 /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
570 ///
571 /// You may pass up to 20 items.
572 #[serde(skip_serializing_if = "Option::is_none")]
573 pub add_invoice_items: Option<Vec<AddInvoiceItems>>,
574
575 /// A non-negative decimal between 0 and 100, with at most two decimal places.
576 ///
577 /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
578 /// The request must be made by a platform account on a connected account in order to set an application fee percentage.
579 /// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
580 #[serde(skip_serializing_if = "Option::is_none")]
581 pub application_fee_percent: Option<f64>,
582
583 /// Automatic tax settings for this phase.
584 #[serde(skip_serializing_if = "Option::is_none")]
585 pub automatic_tax: Option<CreateSubscriptionSchedulePhasesAutomaticTax>,
586
587 /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed.
588 ///
589 /// Cannot be set to `phase_start` if this phase specifies a trial.
590 /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
591 #[serde(skip_serializing_if = "Option::is_none")]
592 pub billing_cycle_anchor: Option<CreateSubscriptionSchedulePhasesBillingCycleAnchor>,
593
594 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
595 ///
596 /// Pass an empty string to remove previously-defined thresholds.
597 #[serde(skip_serializing_if = "Option::is_none")]
598 pub billing_thresholds: Option<SubscriptionBillingThresholds>,
599
600 /// Either `charge_automatically`, or `send_invoice`.
601 ///
602 /// 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.
603 /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
604 /// Defaults to `charge_automatically` on creation.
605 #[serde(skip_serializing_if = "Option::is_none")]
606 pub collection_method: Option<CollectionMethod>,
607
608 /// The identifier of the coupon to apply to this phase of the subscription schedule.
609 #[serde(skip_serializing_if = "Option::is_none")]
610 pub coupon: Option<String>,
611
612 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
613 ///
614 /// Must be a [supported currency](https://stripe.com/docs/currencies).
615 #[serde(skip_serializing_if = "Option::is_none")]
616 pub currency: Option<Currency>,
617
618 /// ID of the default payment method for the subscription schedule.
619 ///
620 /// It must belong to the customer associated with the subscription schedule.
621 /// If not set, invoices will use the default payment method in the customer's invoice settings.
622 #[serde(skip_serializing_if = "Option::is_none")]
623 pub default_payment_method: Option<String>,
624
625 /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
626 ///
627 /// These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
628 #[serde(skip_serializing_if = "Option::is_none")]
629 pub default_tax_rates: Option<Vec<String>>,
630
631 /// Subscription description, meant to be displayable to the customer.
632 ///
633 /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
634 #[serde(skip_serializing_if = "Option::is_none")]
635 pub description: Option<String>,
636
637 /// The date at which this phase of the subscription schedule ends.
638 ///
639 /// If set, `iterations` must not be set.
640 #[serde(skip_serializing_if = "Option::is_none")]
641 pub end_date: Option<Scheduled>,
642
643 /// All invoices will be billed using the specified settings.
644 #[serde(skip_serializing_if = "Option::is_none")]
645 pub invoice_settings: Option<SubscriptionScheduleInvoiceSettings>,
646
647 /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
648 pub items: Vec<CreateSubscriptionSchedulePhasesItems>,
649
650 /// Integer representing the multiplier applied to the price interval.
651 ///
652 /// For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`.
653 /// If set, `end_date` must not be set.
654 #[serde(skip_serializing_if = "Option::is_none")]
655 pub iterations: Option<i64>,
656
657 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
658 ///
659 /// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`.
660 /// Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`.
661 /// To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
662 #[serde(skip_serializing_if = "Option::is_none")]
663 pub metadata: Option<Metadata>,
664
665 /// The account on behalf of which to charge, for each of the associated subscription's invoices.
666 #[serde(skip_serializing_if = "Option::is_none")]
667 pub on_behalf_of: Option<String>,
668
669 /// Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase.
670 ///
671 /// The default value is `create_prorations`.
672 /// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase.
673 /// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
674 #[serde(skip_serializing_if = "Option::is_none")]
675 pub proration_behavior: Option<SubscriptionProrationBehavior>,
676
677 /// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
678 #[serde(skip_serializing_if = "Option::is_none")]
679 pub transfer_data: Option<CreateSubscriptionSchedulePhasesTransferData>,
680
681 /// If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
682 #[serde(skip_serializing_if = "Option::is_none")]
683 pub trial: Option<bool>,
684
685 /// Sets the phase to trialing from the start date to this date.
686 ///
687 /// Must be before the phase end date, can not be combined with `trial`.
688 #[serde(skip_serializing_if = "Option::is_none")]
689 pub trial_end: Option<Scheduled>,
690}
691
692#[derive(Clone, Debug, Default, Deserialize, Serialize)]
693pub struct SubscriptionScheduleDefaultSettingsParams {
694 /// A non-negative decimal between 0 and 100, with at most two decimal places.
695 ///
696 /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
697 /// The request must be made by a platform account on a connected account in order to set an application fee percentage.
698 /// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
699 #[serde(skip_serializing_if = "Option::is_none")]
700 pub application_fee_percent: Option<f64>,
701
702 /// Default settings for automatic tax computation.
703 #[serde(skip_serializing_if = "Option::is_none")]
704 pub automatic_tax: Option<SubscriptionScheduleDefaultSettingsParamsAutomaticTax>,
705
706 /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed.
707 ///
708 /// Cannot be set to `phase_start` if this phase specifies a trial.
709 /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
710 #[serde(skip_serializing_if = "Option::is_none")]
711 pub billing_cycle_anchor: Option<SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor>,
712
713 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
714 ///
715 /// Pass an empty string to remove previously-defined thresholds.
716 #[serde(skip_serializing_if = "Option::is_none")]
717 pub billing_thresholds: Option<SubscriptionScheduleBillingThresholds>,
718
719 /// Either `charge_automatically`, or `send_invoice`.
720 ///
721 /// 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.
722 /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
723 /// Defaults to `charge_automatically` on creation.
724 #[serde(skip_serializing_if = "Option::is_none")]
725 pub collection_method: Option<CollectionMethod>,
726
727 /// ID of the default payment method for the subscription schedule.
728 ///
729 /// It must belong to the customer associated with the subscription schedule.
730 /// If not set, invoices will use the default payment method in the customer's invoice settings.
731 #[serde(skip_serializing_if = "Option::is_none")]
732 pub default_payment_method: Option<String>,
733
734 /// Subscription description, meant to be displayable to the customer.
735 ///
736 /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
737 #[serde(skip_serializing_if = "Option::is_none")]
738 pub description: Option<String>,
739
740 /// All invoices will be billed using the specified settings.
741 #[serde(skip_serializing_if = "Option::is_none")]
742 pub invoice_settings: Option<SubscriptionScheduleInvoiceSettings>,
743
744 /// The account on behalf of which to charge, for each of the associated subscription's invoices.
745 #[serde(skip_serializing_if = "Option::is_none")]
746 pub on_behalf_of: Option<String>,
747
748 /// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
749 #[serde(skip_serializing_if = "Option::is_none")]
750 pub transfer_data: Option<SubscriptionScheduleDefaultSettingsParamsTransferData>,
751}
752
753#[derive(Clone, Debug, Default, Deserialize, Serialize)]
754pub struct UpdateSubscriptionSchedulePhases {
755 /// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase.
756 ///
757 /// You may pass up to 20 items.
758 #[serde(skip_serializing_if = "Option::is_none")]
759 pub add_invoice_items: Option<Vec<AddInvoiceItems>>,
760
761 /// A non-negative decimal between 0 and 100, with at most two decimal places.
762 ///
763 /// This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account.
764 /// The request must be made by a platform account on a connected account in order to set an application fee percentage.
765 /// For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
766 #[serde(skip_serializing_if = "Option::is_none")]
767 pub application_fee_percent: Option<f64>,
768
769 /// Automatic tax settings for this phase.
770 #[serde(skip_serializing_if = "Option::is_none")]
771 pub automatic_tax: Option<UpdateSubscriptionSchedulePhasesAutomaticTax>,
772
773 /// Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed.
774 ///
775 /// Cannot be set to `phase_start` if this phase specifies a trial.
776 /// For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
777 #[serde(skip_serializing_if = "Option::is_none")]
778 pub billing_cycle_anchor: Option<UpdateSubscriptionSchedulePhasesBillingCycleAnchor>,
779
780 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
781 ///
782 /// Pass an empty string to remove previously-defined thresholds.
783 #[serde(skip_serializing_if = "Option::is_none")]
784 pub billing_thresholds: Option<SubscriptionBillingThresholds>,
785
786 /// Either `charge_automatically`, or `send_invoice`.
787 ///
788 /// 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.
789 /// When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`.
790 /// Defaults to `charge_automatically` on creation.
791 #[serde(skip_serializing_if = "Option::is_none")]
792 pub collection_method: Option<CollectionMethod>,
793
794 /// The identifier of the coupon to apply to this phase of the subscription schedule.
795 #[serde(skip_serializing_if = "Option::is_none")]
796 pub coupon: Option<String>,
797
798 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
799 ///
800 /// Must be a [supported currency](https://stripe.com/docs/currencies).
801 #[serde(skip_serializing_if = "Option::is_none")]
802 pub currency: Option<Currency>,
803
804 /// ID of the default payment method for the subscription schedule.
805 ///
806 /// It must belong to the customer associated with the subscription schedule.
807 /// If not set, invoices will use the default payment method in the customer's invoice settings.
808 #[serde(skip_serializing_if = "Option::is_none")]
809 pub default_payment_method: Option<String>,
810
811 /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
812 ///
813 /// These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
814 #[serde(skip_serializing_if = "Option::is_none")]
815 pub default_tax_rates: Option<Vec<String>>,
816
817 /// Subscription description, meant to be displayable to the customer.
818 ///
819 /// Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
820 #[serde(skip_serializing_if = "Option::is_none")]
821 pub description: Option<String>,
822
823 /// The date at which this phase of the subscription schedule ends.
824 ///
825 /// If set, `iterations` must not be set.
826 #[serde(skip_serializing_if = "Option::is_none")]
827 pub end_date: Option<Scheduled>,
828
829 /// All invoices will be billed using the specified settings.
830 #[serde(skip_serializing_if = "Option::is_none")]
831 pub invoice_settings: Option<SubscriptionScheduleInvoiceSettings>,
832
833 /// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
834 pub items: Vec<UpdateSubscriptionSchedulePhasesItems>,
835
836 /// Integer representing the multiplier applied to the price interval.
837 ///
838 /// For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`.
839 /// If set, `end_date` must not be set.
840 #[serde(skip_serializing_if = "Option::is_none")]
841 pub iterations: Option<i64>,
842
843 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase.
844 ///
845 /// Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`.
846 /// Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`.
847 /// To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
848 #[serde(skip_serializing_if = "Option::is_none")]
849 pub metadata: Option<Metadata>,
850
851 /// The account on behalf of which to charge, for each of the associated subscription's invoices.
852 #[serde(skip_serializing_if = "Option::is_none")]
853 pub on_behalf_of: Option<String>,
854
855 /// Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase.
856 ///
857 /// The default value is `create_prorations`.
858 /// This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase.
859 /// It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
860 #[serde(skip_serializing_if = "Option::is_none")]
861 pub proration_behavior: Option<SubscriptionProrationBehavior>,
862
863 /// The date at which this phase of the subscription schedule starts or `now`.
864 ///
865 /// Must be set on the first phase.
866 #[serde(skip_serializing_if = "Option::is_none")]
867 pub start_date: Option<Scheduled>,
868
869 /// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
870 #[serde(skip_serializing_if = "Option::is_none")]
871 pub transfer_data: Option<UpdateSubscriptionSchedulePhasesTransferData>,
872
873 /// If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
874 #[serde(skip_serializing_if = "Option::is_none")]
875 pub trial: Option<bool>,
876
877 /// Sets the phase to trialing from the start date to this date.
878 ///
879 /// Must be before the phase end date, can not be combined with `trial`.
880 #[serde(skip_serializing_if = "Option::is_none")]
881 pub trial_end: Option<Scheduled>,
882}
883
884#[derive(Clone, Debug, Default, Deserialize, Serialize)]
885pub struct AddInvoiceItems {
886 /// The ID of the price object.
887 #[serde(skip_serializing_if = "Option::is_none")]
888 pub price: Option<String>,
889
890 /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
891 #[serde(skip_serializing_if = "Option::is_none")]
892 pub price_data: Option<InvoiceItemPriceData>,
893
894 /// Quantity for this item.
895 ///
896 /// Defaults to 1.
897 #[serde(skip_serializing_if = "Option::is_none")]
898 pub quantity: Option<u64>,
899
900 /// The tax rates which apply to the item.
901 ///
902 /// When set, the `default_tax_rates` do not apply to this item.
903 #[serde(skip_serializing_if = "Option::is_none")]
904 pub tax_rates: Option<Vec<String>>,
905}
906
907#[derive(Clone, Debug, Default, Deserialize, Serialize)]
908pub struct CreateSubscriptionSchedulePhasesAutomaticTax {
909 /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
910 pub enabled: bool,
911
912 /// The account that's liable for tax.
913 ///
914 /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
915 /// The tax transaction is returned in the report of the connected account.
916 #[serde(skip_serializing_if = "Option::is_none")]
917 pub liability: Option<CreateSubscriptionSchedulePhasesAutomaticTaxLiability>,
918}
919
920#[derive(Clone, Debug, Default, Deserialize, Serialize)]
921pub struct CreateSubscriptionSchedulePhasesItems {
922 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
923 ///
924 /// When updating, pass an empty string to remove previously-defined thresholds.
925 #[serde(skip_serializing_if = "Option::is_none")]
926 pub billing_thresholds: Option<CreateSubscriptionSchedulePhasesItemsBillingThresholds>,
927
928 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item.
929 ///
930 /// Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys.
931 /// Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`.
932 /// To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
933 #[serde(skip_serializing_if = "Option::is_none")]
934 pub metadata: Option<Metadata>,
935
936 /// The plan ID to subscribe to.
937 ///
938 /// You may specify the same ID in `plan` and `price`.
939 #[serde(skip_serializing_if = "Option::is_none")]
940 pub plan: Option<String>,
941
942 /// The ID of the price object.
943 #[serde(skip_serializing_if = "Option::is_none")]
944 pub price: Option<String>,
945
946 /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
947 #[serde(skip_serializing_if = "Option::is_none")]
948 pub price_data: Option<CreateSubscriptionSchedulePhasesItemsPriceData>,
949
950 /// Quantity for the given price.
951 ///
952 /// Can be set only if the price's `usage_type` is `licensed` and not `metered`.
953 #[serde(skip_serializing_if = "Option::is_none")]
954 pub quantity: Option<u64>,
955
956 /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
957 ///
958 /// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription.
959 /// When updating, pass an empty string to remove previously-defined tax rates.
960 #[serde(skip_serializing_if = "Option::is_none")]
961 pub tax_rates: Option<Vec<String>>,
962}
963
964#[derive(Clone, Debug, Default, Deserialize, Serialize)]
965pub struct CreateSubscriptionSchedulePhasesTransferData {
966 /// A non-negative decimal between 0 and 100, with at most two decimal places.
967 ///
968 /// This represents the percentage of the subscription invoice total that will be transferred to the destination account.
969 /// By default, the entire amount is transferred to the destination.
970 #[serde(skip_serializing_if = "Option::is_none")]
971 pub amount_percent: Option<f64>,
972
973 /// ID of an existing, connected Stripe account.
974 pub destination: String,
975}
976
977#[derive(Clone, Debug, Default, Deserialize, Serialize)]
978pub struct SubscriptionScheduleBillingThresholds {
979 /// Monetary threshold that triggers the subscription to advance to a new billing period.
980 #[serde(skip_serializing_if = "Option::is_none")]
981 pub amount_gte: Option<i64>,
982
983 /// Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached.
984 ///
985 /// If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
986 #[serde(skip_serializing_if = "Option::is_none")]
987 pub reset_billing_cycle_anchor: Option<bool>,
988}
989
990#[derive(Clone, Debug, Default, Deserialize, Serialize)]
991pub struct SubscriptionScheduleDefaultSettingsParamsAutomaticTax {
992 /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
993 pub enabled: bool,
994
995 /// The account that's liable for tax.
996 ///
997 /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
998 /// The tax transaction is returned in the report of the connected account.
999 #[serde(skip_serializing_if = "Option::is_none")]
1000 pub liability: Option<SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiability>,
1001}
1002
1003#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1004pub struct SubscriptionScheduleDefaultSettingsParamsTransferData {
1005 /// A non-negative decimal between 0 and 100, with at most two decimal places.
1006 ///
1007 /// This represents the percentage of the subscription invoice total that will be transferred to the destination account.
1008 /// By default, the entire amount is transferred to the destination.
1009 #[serde(skip_serializing_if = "Option::is_none")]
1010 pub amount_percent: Option<f64>,
1011
1012 /// ID of an existing, connected Stripe account.
1013 pub destination: String,
1014}
1015
1016#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1017pub struct SubscriptionScheduleInvoiceSettings {
1018 /// The account tax IDs associated with this phase of the subscription schedule.
1019 ///
1020 /// Will be set on invoices generated by this phase of the subscription schedule.
1021 #[serde(skip_serializing_if = "Option::is_none")]
1022 pub account_tax_ids: Option<Vec<String>>,
1023
1024 /// Number of days within which a customer must pay invoices generated by this subscription schedule.
1025 ///
1026 /// This value will be `null` for subscription schedules where `billing=charge_automatically`.
1027 #[serde(skip_serializing_if = "Option::is_none")]
1028 pub days_until_due: Option<u32>,
1029
1030 /// The connected account that issues the invoice.
1031 ///
1032 /// The invoice is presented with the branding and support information of the specified account.
1033 #[serde(skip_serializing_if = "Option::is_none")]
1034 pub issuer: Option<SubscriptionScheduleInvoiceSettingsIssuer>,
1035}
1036
1037#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1038pub struct UpdateSubscriptionSchedulePhasesAutomaticTax {
1039 /// Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
1040 pub enabled: bool,
1041
1042 /// The account that's liable for tax.
1043 ///
1044 /// If set, the business address and tax registrations required to perform the tax calculation are loaded from this account.
1045 /// The tax transaction is returned in the report of the connected account.
1046 #[serde(skip_serializing_if = "Option::is_none")]
1047 pub liability: Option<UpdateSubscriptionSchedulePhasesAutomaticTaxLiability>,
1048}
1049
1050#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1051pub struct UpdateSubscriptionSchedulePhasesItems {
1052 /// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
1053 ///
1054 /// When updating, pass an empty string to remove previously-defined thresholds.
1055 #[serde(skip_serializing_if = "Option::is_none")]
1056 pub billing_thresholds: Option<UpdateSubscriptionSchedulePhasesItemsBillingThresholds>,
1057
1058 /// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item.
1059 ///
1060 /// Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys.
1061 /// Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`.
1062 /// To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
1063 #[serde(skip_serializing_if = "Option::is_none")]
1064 pub metadata: Option<Metadata>,
1065
1066 /// The plan ID to subscribe to.
1067 ///
1068 /// You may specify the same ID in `plan` and `price`.
1069 #[serde(skip_serializing_if = "Option::is_none")]
1070 pub plan: Option<String>,
1071
1072 /// The ID of the price object.
1073 #[serde(skip_serializing_if = "Option::is_none")]
1074 pub price: Option<String>,
1075
1076 /// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
1077 #[serde(skip_serializing_if = "Option::is_none")]
1078 pub price_data: Option<UpdateSubscriptionSchedulePhasesItemsPriceData>,
1079
1080 /// Quantity for the given price.
1081 ///
1082 /// Can be set only if the price's `usage_type` is `licensed` and not `metered`.
1083 #[serde(skip_serializing_if = "Option::is_none")]
1084 pub quantity: Option<u64>,
1085
1086 /// A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids.
1087 ///
1088 /// These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription.
1089 /// When updating, pass an empty string to remove previously-defined tax rates.
1090 #[serde(skip_serializing_if = "Option::is_none")]
1091 pub tax_rates: Option<Vec<String>>,
1092}
1093
1094#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1095pub struct UpdateSubscriptionSchedulePhasesTransferData {
1096 /// A non-negative decimal between 0 and 100, with at most two decimal places.
1097 ///
1098 /// This represents the percentage of the subscription invoice total that will be transferred to the destination account.
1099 /// By default, the entire amount is transferred to the destination.
1100 #[serde(skip_serializing_if = "Option::is_none")]
1101 pub amount_percent: Option<f64>,
1102
1103 /// ID of an existing, connected Stripe account.
1104 pub destination: String,
1105}
1106
1107#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1108pub struct CreateSubscriptionSchedulePhasesAutomaticTaxLiability {
1109 /// The connected account being referenced when `type` is `account`.
1110 #[serde(skip_serializing_if = "Option::is_none")]
1111 pub account: Option<String>,
1112
1113 /// Type of the account referenced in the request.
1114 #[serde(rename = "type")]
1115 pub type_: CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType,
1116}
1117
1118#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1119pub struct CreateSubscriptionSchedulePhasesItemsBillingThresholds {
1120 /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)).
1121 pub usage_gte: i64,
1122}
1123
1124#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1125pub struct CreateSubscriptionSchedulePhasesItemsPriceData {
1126 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
1127 ///
1128 /// Must be a [supported currency](https://stripe.com/docs/currencies).
1129 pub currency: Currency,
1130
1131 /// The ID of the product that this price will belong to.
1132 pub product: String,
1133
1134 /// The recurring components of a price such as `interval` and `interval_count`.
1135 pub recurring: CreateSubscriptionSchedulePhasesItemsPriceDataRecurring,
1136
1137 /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
1138 ///
1139 /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
1140 /// One of `inclusive`, `exclusive`, or `unspecified`.
1141 /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1142 #[serde(skip_serializing_if = "Option::is_none")]
1143 pub tax_behavior: Option<CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior>,
1144
1145 /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1146 #[serde(skip_serializing_if = "Option::is_none")]
1147 pub unit_amount: Option<i64>,
1148
1149 /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
1150 ///
1151 /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
1152 #[serde(skip_serializing_if = "Option::is_none")]
1153 pub unit_amount_decimal: Option<String>,
1154}
1155
1156#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1157pub struct InvoiceItemPriceData {
1158 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
1159 ///
1160 /// Must be a [supported currency](https://stripe.com/docs/currencies).
1161 pub currency: Currency,
1162
1163 /// The ID of the product that this price will belong to.
1164 pub product: String,
1165
1166 /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
1167 ///
1168 /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
1169 /// One of `inclusive`, `exclusive`, or `unspecified`.
1170 /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1171 #[serde(skip_serializing_if = "Option::is_none")]
1172 pub tax_behavior: Option<InvoiceItemPriceDataTaxBehavior>,
1173
1174 /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1175 #[serde(skip_serializing_if = "Option::is_none")]
1176 pub unit_amount: Option<i64>,
1177
1178 /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
1179 ///
1180 /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
1181 #[serde(skip_serializing_if = "Option::is_none")]
1182 pub unit_amount_decimal: Option<String>,
1183}
1184
1185#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1186pub struct SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiability {
1187 /// The connected account being referenced when `type` is `account`.
1188 #[serde(skip_serializing_if = "Option::is_none")]
1189 pub account: Option<String>,
1190
1191 /// Type of the account referenced in the request.
1192 #[serde(rename = "type")]
1193 pub type_: SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType,
1194}
1195
1196#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1197pub struct SubscriptionScheduleInvoiceSettingsIssuer {
1198 /// The connected account being referenced when `type` is `account`.
1199 #[serde(skip_serializing_if = "Option::is_none")]
1200 pub account: Option<String>,
1201
1202 /// Type of the account referenced in the request.
1203 #[serde(rename = "type")]
1204 pub type_: SubscriptionScheduleInvoiceSettingsIssuerType,
1205}
1206
1207#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1208pub struct UpdateSubscriptionSchedulePhasesAutomaticTaxLiability {
1209 /// The connected account being referenced when `type` is `account`.
1210 #[serde(skip_serializing_if = "Option::is_none")]
1211 pub account: Option<String>,
1212
1213 /// Type of the account referenced in the request.
1214 #[serde(rename = "type")]
1215 pub type_: UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType,
1216}
1217
1218#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1219pub struct UpdateSubscriptionSchedulePhasesItemsBillingThresholds {
1220 /// Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)).
1221 pub usage_gte: i64,
1222}
1223
1224#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1225pub struct UpdateSubscriptionSchedulePhasesItemsPriceData {
1226 /// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase.
1227 ///
1228 /// Must be a [supported currency](https://stripe.com/docs/currencies).
1229 pub currency: Currency,
1230
1231 /// The ID of the product that this price will belong to.
1232 pub product: String,
1233
1234 /// The recurring components of a price such as `interval` and `interval_count`.
1235 pub recurring: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring,
1236
1237 /// Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
1238 ///
1239 /// Specifies whether the price is considered inclusive of taxes or exclusive of taxes.
1240 /// One of `inclusive`, `exclusive`, or `unspecified`.
1241 /// Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1242 #[serde(skip_serializing_if = "Option::is_none")]
1243 pub tax_behavior: Option<UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior>,
1244
1245 /// A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1246 #[serde(skip_serializing_if = "Option::is_none")]
1247 pub unit_amount: Option<i64>,
1248
1249 /// Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
1250 ///
1251 /// Only one of `unit_amount` and `unit_amount_decimal` can be set.
1252 #[serde(skip_serializing_if = "Option::is_none")]
1253 pub unit_amount_decimal: Option<String>,
1254}
1255
1256#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1257pub struct CreateSubscriptionSchedulePhasesItemsPriceDataRecurring {
1258 /// Specifies billing frequency.
1259 ///
1260 /// Either `day`, `week`, `month` or `year`.
1261 pub interval: CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval,
1262
1263 /// The number of intervals between subscription billings.
1264 ///
1265 /// For example, `interval=month` and `interval_count=3` bills every 3 months.
1266 /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1267 #[serde(skip_serializing_if = "Option::is_none")]
1268 pub interval_count: Option<u64>,
1269}
1270
1271#[derive(Clone, Debug, Default, Deserialize, Serialize)]
1272pub struct UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring {
1273 /// Specifies billing frequency.
1274 ///
1275 /// Either `day`, `week`, `month` or `year`.
1276 pub interval: UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval,
1277
1278 /// The number of intervals between subscription billings.
1279 ///
1280 /// For example, `interval=month` and `interval_count=3` bills every 3 months.
1281 /// Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1282 #[serde(skip_serializing_if = "Option::is_none")]
1283 pub interval_count: Option<u64>,
1284}
1285
1286/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesAutomaticTaxLiability`'s `type` field.
1287#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1288#[serde(rename_all = "snake_case")]
1289pub enum CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1290 Account,
1291 #[serde(rename = "self")]
1292 Self_,
1293}
1294
1295impl CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1296 pub fn as_str(self) -> &'static str {
1297 match self {
1298 CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Account => "account",
1299 CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Self_ => "self",
1300 }
1301 }
1302}
1303
1304impl AsRef<str> for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1305 fn as_ref(&self) -> &str {
1306 self.as_str()
1307 }
1308}
1309
1310impl std::fmt::Display for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1311 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1312 self.as_str().fmt(f)
1313 }
1314}
1315impl std::default::Default for CreateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1316 fn default() -> Self {
1317 Self::Account
1318 }
1319}
1320
1321/// An enum representing the possible values of an `CreateSubscriptionSchedulePhases`'s `billing_cycle_anchor` field.
1322#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1323#[serde(rename_all = "snake_case")]
1324pub enum CreateSubscriptionSchedulePhasesBillingCycleAnchor {
1325 Automatic,
1326 PhaseStart,
1327}
1328
1329impl CreateSubscriptionSchedulePhasesBillingCycleAnchor {
1330 pub fn as_str(self) -> &'static str {
1331 match self {
1332 CreateSubscriptionSchedulePhasesBillingCycleAnchor::Automatic => "automatic",
1333 CreateSubscriptionSchedulePhasesBillingCycleAnchor::PhaseStart => "phase_start",
1334 }
1335 }
1336}
1337
1338impl AsRef<str> for CreateSubscriptionSchedulePhasesBillingCycleAnchor {
1339 fn as_ref(&self) -> &str {
1340 self.as_str()
1341 }
1342}
1343
1344impl std::fmt::Display for CreateSubscriptionSchedulePhasesBillingCycleAnchor {
1345 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1346 self.as_str().fmt(f)
1347 }
1348}
1349impl std::default::Default for CreateSubscriptionSchedulePhasesBillingCycleAnchor {
1350 fn default() -> Self {
1351 Self::Automatic
1352 }
1353}
1354
1355/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesItemsPriceDataRecurring`'s `interval` field.
1356#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1357#[serde(rename_all = "snake_case")]
1358pub enum CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1359 Day,
1360 Month,
1361 Week,
1362 Year,
1363}
1364
1365impl CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1366 pub fn as_str(self) -> &'static str {
1367 match self {
1368 CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Day => "day",
1369 CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Month => "month",
1370 CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Week => "week",
1371 CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Year => "year",
1372 }
1373 }
1374}
1375
1376impl AsRef<str> for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1377 fn as_ref(&self) -> &str {
1378 self.as_str()
1379 }
1380}
1381
1382impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1383 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1384 self.as_str().fmt(f)
1385 }
1386}
1387impl std::default::Default for CreateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1388 fn default() -> Self {
1389 Self::Day
1390 }
1391}
1392
1393/// An enum representing the possible values of an `CreateSubscriptionSchedulePhasesItemsPriceData`'s `tax_behavior` field.
1394#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1395#[serde(rename_all = "snake_case")]
1396pub enum CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1397 Exclusive,
1398 Inclusive,
1399 Unspecified,
1400}
1401
1402impl CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1403 pub fn as_str(self) -> &'static str {
1404 match self {
1405 CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Exclusive => "exclusive",
1406 CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Inclusive => "inclusive",
1407 CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Unspecified => "unspecified",
1408 }
1409 }
1410}
1411
1412impl AsRef<str> for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1413 fn as_ref(&self) -> &str {
1414 self.as_str()
1415 }
1416}
1417
1418impl std::fmt::Display for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1419 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1420 self.as_str().fmt(f)
1421 }
1422}
1423impl std::default::Default for CreateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1424 fn default() -> Self {
1425 Self::Exclusive
1426 }
1427}
1428
1429/// An enum representing the possible values of an `InvoiceItemPriceData`'s `tax_behavior` field.
1430#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1431#[serde(rename_all = "snake_case")]
1432pub enum InvoiceItemPriceDataTaxBehavior {
1433 Exclusive,
1434 Inclusive,
1435 Unspecified,
1436}
1437
1438impl InvoiceItemPriceDataTaxBehavior {
1439 pub fn as_str(self) -> &'static str {
1440 match self {
1441 InvoiceItemPriceDataTaxBehavior::Exclusive => "exclusive",
1442 InvoiceItemPriceDataTaxBehavior::Inclusive => "inclusive",
1443 InvoiceItemPriceDataTaxBehavior::Unspecified => "unspecified",
1444 }
1445 }
1446}
1447
1448impl AsRef<str> for InvoiceItemPriceDataTaxBehavior {
1449 fn as_ref(&self) -> &str {
1450 self.as_str()
1451 }
1452}
1453
1454impl std::fmt::Display for InvoiceItemPriceDataTaxBehavior {
1455 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1456 self.as_str().fmt(f)
1457 }
1458}
1459impl std::default::Default for InvoiceItemPriceDataTaxBehavior {
1460 fn default() -> Self {
1461 Self::Exclusive
1462 }
1463}
1464
1465/// An enum representing the possible values of an `SubscriptionSchedulePhaseConfiguration`'s `proration_behavior` field.
1466#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1467#[serde(rename_all = "snake_case")]
1468pub enum SubscriptionProrationBehavior {
1469 AlwaysInvoice,
1470 CreateProrations,
1471 None,
1472}
1473
1474impl SubscriptionProrationBehavior {
1475 pub fn as_str(self) -> &'static str {
1476 match self {
1477 SubscriptionProrationBehavior::AlwaysInvoice => "always_invoice",
1478 SubscriptionProrationBehavior::CreateProrations => "create_prorations",
1479 SubscriptionProrationBehavior::None => "none",
1480 }
1481 }
1482}
1483
1484impl AsRef<str> for SubscriptionProrationBehavior {
1485 fn as_ref(&self) -> &str {
1486 self.as_str()
1487 }
1488}
1489
1490impl std::fmt::Display for SubscriptionProrationBehavior {
1491 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1492 self.as_str().fmt(f)
1493 }
1494}
1495impl std::default::Default for SubscriptionProrationBehavior {
1496 fn default() -> Self {
1497 Self::AlwaysInvoice
1498 }
1499}
1500
1501/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettings`'s `billing_cycle_anchor` field.
1502#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1503#[serde(rename_all = "snake_case")]
1504pub enum SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
1505 Automatic,
1506 PhaseStart,
1507}
1508
1509impl SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
1510 pub fn as_str(self) -> &'static str {
1511 match self {
1512 SubscriptionScheduleDefaultSettingsBillingCycleAnchor::Automatic => "automatic",
1513 SubscriptionScheduleDefaultSettingsBillingCycleAnchor::PhaseStart => "phase_start",
1514 }
1515 }
1516}
1517
1518impl AsRef<str> for SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
1519 fn as_ref(&self) -> &str {
1520 self.as_str()
1521 }
1522}
1523
1524impl std::fmt::Display for SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
1525 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1526 self.as_str().fmt(f)
1527 }
1528}
1529impl std::default::Default for SubscriptionScheduleDefaultSettingsBillingCycleAnchor {
1530 fn default() -> Self {
1531 Self::Automatic
1532 }
1533}
1534
1535/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettings`'s `collection_method` field.
1536#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1537#[serde(rename_all = "snake_case")]
1538pub enum SubscriptionScheduleDefaultSettingsCollectionMethod {
1539 ChargeAutomatically,
1540 SendInvoice,
1541}
1542
1543impl SubscriptionScheduleDefaultSettingsCollectionMethod {
1544 pub fn as_str(self) -> &'static str {
1545 match self {
1546 SubscriptionScheduleDefaultSettingsCollectionMethod::ChargeAutomatically => {
1547 "charge_automatically"
1548 }
1549 SubscriptionScheduleDefaultSettingsCollectionMethod::SendInvoice => "send_invoice",
1550 }
1551 }
1552}
1553
1554impl AsRef<str> for SubscriptionScheduleDefaultSettingsCollectionMethod {
1555 fn as_ref(&self) -> &str {
1556 self.as_str()
1557 }
1558}
1559
1560impl std::fmt::Display for SubscriptionScheduleDefaultSettingsCollectionMethod {
1561 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1562 self.as_str().fmt(f)
1563 }
1564}
1565impl std::default::Default for SubscriptionScheduleDefaultSettingsCollectionMethod {
1566 fn default() -> Self {
1567 Self::ChargeAutomatically
1568 }
1569}
1570
1571/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiability`'s `type` field.
1572#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1573#[serde(rename_all = "snake_case")]
1574pub enum SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
1575 Account,
1576 #[serde(rename = "self")]
1577 Self_,
1578}
1579
1580impl SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
1581 pub fn as_str(self) -> &'static str {
1582 match self {
1583 SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType::Account => {
1584 "account"
1585 }
1586 SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType::Self_ => "self",
1587 }
1588 }
1589}
1590
1591impl AsRef<str> for SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
1592 fn as_ref(&self) -> &str {
1593 self.as_str()
1594 }
1595}
1596
1597impl std::fmt::Display for SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
1598 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1599 self.as_str().fmt(f)
1600 }
1601}
1602impl std::default::Default for SubscriptionScheduleDefaultSettingsParamsAutomaticTaxLiabilityType {
1603 fn default() -> Self {
1604 Self::Account
1605 }
1606}
1607
1608/// An enum representing the possible values of an `SubscriptionScheduleDefaultSettingsParams`'s `billing_cycle_anchor` field.
1609#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1610#[serde(rename_all = "snake_case")]
1611pub enum SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
1612 Automatic,
1613 PhaseStart,
1614}
1615
1616impl SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
1617 pub fn as_str(self) -> &'static str {
1618 match self {
1619 SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor::Automatic => "automatic",
1620 SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor::PhaseStart => {
1621 "phase_start"
1622 }
1623 }
1624 }
1625}
1626
1627impl AsRef<str> for SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
1628 fn as_ref(&self) -> &str {
1629 self.as_str()
1630 }
1631}
1632
1633impl std::fmt::Display for SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
1634 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1635 self.as_str().fmt(f)
1636 }
1637}
1638impl std::default::Default for SubscriptionScheduleDefaultSettingsParamsBillingCycleAnchor {
1639 fn default() -> Self {
1640 Self::Automatic
1641 }
1642}
1643
1644/// An enum representing the possible values of an `SubscriptionSchedule`'s `end_behavior` field.
1645#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1646#[serde(rename_all = "snake_case")]
1647pub enum SubscriptionScheduleEndBehavior {
1648 Cancel,
1649 None,
1650 Release,
1651 Renew,
1652}
1653
1654impl SubscriptionScheduleEndBehavior {
1655 pub fn as_str(self) -> &'static str {
1656 match self {
1657 SubscriptionScheduleEndBehavior::Cancel => "cancel",
1658 SubscriptionScheduleEndBehavior::None => "none",
1659 SubscriptionScheduleEndBehavior::Release => "release",
1660 SubscriptionScheduleEndBehavior::Renew => "renew",
1661 }
1662 }
1663}
1664
1665impl AsRef<str> for SubscriptionScheduleEndBehavior {
1666 fn as_ref(&self) -> &str {
1667 self.as_str()
1668 }
1669}
1670
1671impl std::fmt::Display for SubscriptionScheduleEndBehavior {
1672 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1673 self.as_str().fmt(f)
1674 }
1675}
1676impl std::default::Default for SubscriptionScheduleEndBehavior {
1677 fn default() -> Self {
1678 Self::Cancel
1679 }
1680}
1681
1682/// An enum representing the possible values of an `SubscriptionScheduleInvoiceSettingsIssuer`'s `type` field.
1683#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1684#[serde(rename_all = "snake_case")]
1685pub enum SubscriptionScheduleInvoiceSettingsIssuerType {
1686 Account,
1687 #[serde(rename = "self")]
1688 Self_,
1689}
1690
1691impl SubscriptionScheduleInvoiceSettingsIssuerType {
1692 pub fn as_str(self) -> &'static str {
1693 match self {
1694 SubscriptionScheduleInvoiceSettingsIssuerType::Account => "account",
1695 SubscriptionScheduleInvoiceSettingsIssuerType::Self_ => "self",
1696 }
1697 }
1698}
1699
1700impl AsRef<str> for SubscriptionScheduleInvoiceSettingsIssuerType {
1701 fn as_ref(&self) -> &str {
1702 self.as_str()
1703 }
1704}
1705
1706impl std::fmt::Display for SubscriptionScheduleInvoiceSettingsIssuerType {
1707 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1708 self.as_str().fmt(f)
1709 }
1710}
1711impl std::default::Default for SubscriptionScheduleInvoiceSettingsIssuerType {
1712 fn default() -> Self {
1713 Self::Account
1714 }
1715}
1716
1717/// An enum representing the possible values of an `SubscriptionSchedulePhaseConfiguration`'s `billing_cycle_anchor` field.
1718#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1719#[serde(rename_all = "snake_case")]
1720pub enum SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
1721 Automatic,
1722 PhaseStart,
1723}
1724
1725impl SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
1726 pub fn as_str(self) -> &'static str {
1727 match self {
1728 SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::Automatic => "automatic",
1729 SubscriptionSchedulePhaseConfigurationBillingCycleAnchor::PhaseStart => "phase_start",
1730 }
1731 }
1732}
1733
1734impl AsRef<str> for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
1735 fn as_ref(&self) -> &str {
1736 self.as_str()
1737 }
1738}
1739
1740impl std::fmt::Display for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
1741 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1742 self.as_str().fmt(f)
1743 }
1744}
1745impl std::default::Default for SubscriptionSchedulePhaseConfigurationBillingCycleAnchor {
1746 fn default() -> Self {
1747 Self::Automatic
1748 }
1749}
1750
1751/// An enum representing the possible values of an `SubscriptionSchedule`'s `status` field.
1752#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1753#[serde(rename_all = "snake_case")]
1754pub enum SubscriptionScheduleStatus {
1755 Active,
1756 Canceled,
1757 Completed,
1758 NotStarted,
1759 Released,
1760}
1761
1762impl SubscriptionScheduleStatus {
1763 pub fn as_str(self) -> &'static str {
1764 match self {
1765 SubscriptionScheduleStatus::Active => "active",
1766 SubscriptionScheduleStatus::Canceled => "canceled",
1767 SubscriptionScheduleStatus::Completed => "completed",
1768 SubscriptionScheduleStatus::NotStarted => "not_started",
1769 SubscriptionScheduleStatus::Released => "released",
1770 }
1771 }
1772}
1773
1774impl AsRef<str> for SubscriptionScheduleStatus {
1775 fn as_ref(&self) -> &str {
1776 self.as_str()
1777 }
1778}
1779
1780impl std::fmt::Display for SubscriptionScheduleStatus {
1781 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1782 self.as_str().fmt(f)
1783 }
1784}
1785impl std::default::Default for SubscriptionScheduleStatus {
1786 fn default() -> Self {
1787 Self::Active
1788 }
1789}
1790
1791/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesAutomaticTaxLiability`'s `type` field.
1792#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1793#[serde(rename_all = "snake_case")]
1794pub enum UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1795 Account,
1796 #[serde(rename = "self")]
1797 Self_,
1798}
1799
1800impl UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1801 pub fn as_str(self) -> &'static str {
1802 match self {
1803 UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Account => "account",
1804 UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType::Self_ => "self",
1805 }
1806 }
1807}
1808
1809impl AsRef<str> for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1810 fn as_ref(&self) -> &str {
1811 self.as_str()
1812 }
1813}
1814
1815impl std::fmt::Display for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1816 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1817 self.as_str().fmt(f)
1818 }
1819}
1820impl std::default::Default for UpdateSubscriptionSchedulePhasesAutomaticTaxLiabilityType {
1821 fn default() -> Self {
1822 Self::Account
1823 }
1824}
1825
1826/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhases`'s `billing_cycle_anchor` field.
1827#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1828#[serde(rename_all = "snake_case")]
1829pub enum UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
1830 Automatic,
1831 PhaseStart,
1832}
1833
1834impl UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
1835 pub fn as_str(self) -> &'static str {
1836 match self {
1837 UpdateSubscriptionSchedulePhasesBillingCycleAnchor::Automatic => "automatic",
1838 UpdateSubscriptionSchedulePhasesBillingCycleAnchor::PhaseStart => "phase_start",
1839 }
1840 }
1841}
1842
1843impl AsRef<str> for UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
1844 fn as_ref(&self) -> &str {
1845 self.as_str()
1846 }
1847}
1848
1849impl std::fmt::Display for UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
1850 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1851 self.as_str().fmt(f)
1852 }
1853}
1854impl std::default::Default for UpdateSubscriptionSchedulePhasesBillingCycleAnchor {
1855 fn default() -> Self {
1856 Self::Automatic
1857 }
1858}
1859
1860/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesItemsPriceDataRecurring`'s `interval` field.
1861#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1862#[serde(rename_all = "snake_case")]
1863pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1864 Day,
1865 Month,
1866 Week,
1867 Year,
1868}
1869
1870impl UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1871 pub fn as_str(self) -> &'static str {
1872 match self {
1873 UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Day => "day",
1874 UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Month => "month",
1875 UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Week => "week",
1876 UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval::Year => "year",
1877 }
1878 }
1879}
1880
1881impl AsRef<str> for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1882 fn as_ref(&self) -> &str {
1883 self.as_str()
1884 }
1885}
1886
1887impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1888 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1889 self.as_str().fmt(f)
1890 }
1891}
1892impl std::default::Default for UpdateSubscriptionSchedulePhasesItemsPriceDataRecurringInterval {
1893 fn default() -> Self {
1894 Self::Day
1895 }
1896}
1897
1898/// An enum representing the possible values of an `UpdateSubscriptionSchedulePhasesItemsPriceData`'s `tax_behavior` field.
1899#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
1900#[serde(rename_all = "snake_case")]
1901pub enum UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1902 Exclusive,
1903 Inclusive,
1904 Unspecified,
1905}
1906
1907impl UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1908 pub fn as_str(self) -> &'static str {
1909 match self {
1910 UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Exclusive => "exclusive",
1911 UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Inclusive => "inclusive",
1912 UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior::Unspecified => "unspecified",
1913 }
1914 }
1915}
1916
1917impl AsRef<str> for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1918 fn as_ref(&self) -> &str {
1919 self.as_str()
1920 }
1921}
1922
1923impl std::fmt::Display for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1924 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1925 self.as_str().fmt(f)
1926 }
1927}
1928impl std::default::Default for UpdateSubscriptionSchedulePhasesItemsPriceDataTaxBehavior {
1929 fn default() -> Self {
1930 Self::Exclusive
1931 }
1932}