CreatePreviewInvoiceSubscriptionDetails

Struct CreatePreviewInvoiceSubscriptionDetails 

Source
pub struct CreatePreviewInvoiceSubscriptionDetails {
    pub billing_cycle_anchor: Option<CreatePreviewInvoiceSubscriptionDetailsBillingCycleAnchor>,
    pub billing_mode: Option<CreatePreviewInvoiceSubscriptionDetailsBillingMode>,
    pub cancel_at: Option<CreatePreviewInvoiceSubscriptionDetailsCancelAt>,
    pub cancel_at_period_end: Option<bool>,
    pub cancel_now: Option<bool>,
    pub default_tax_rates: Option<Vec<String>>,
    pub items: Option<Vec<CreatePreviewInvoiceSubscriptionDetailsItems>>,
    pub proration_behavior: Option<CreatePreviewInvoiceSubscriptionDetailsProrationBehavior>,
    pub proration_date: Option<Timestamp>,
    pub resume_at: Option<CreatePreviewInvoiceSubscriptionDetailsResumeAt>,
    pub start_date: Option<Timestamp>,
    pub trial_end: Option<CreatePreviewInvoiceSubscriptionDetailsTrialEnd>,
}
Expand description

The subscription creation or modification params to apply as a preview. Cannot be used with schedule or schedule_details fields.

Fields§

§billing_cycle_anchor: Option<CreatePreviewInvoiceSubscriptionDetailsBillingCycleAnchor>

For new subscriptions, a future timestamp to anchor the subscription’s billing cycle. This is used to determine the date of the first full invoice, and, for plans with month or year intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to now or unchanged.

§billing_mode: Option<CreatePreviewInvoiceSubscriptionDetailsBillingMode>

Controls how prorations and invoices for subscriptions are calculated and orchestrated.

§cancel_at: Option<CreatePreviewInvoiceSubscriptionDetailsCancelAt>

A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using proration_behavior. If set during a future period, this will always cause a proration for that period.

§cancel_at_period_end: Option<bool>

Indicate whether this subscription should cancel at the end of the current period (current_period_end). Defaults to false.

§cancel_now: Option<bool>

This simulates the subscription being canceled or expired immediately.

§default_tax_rates: Option<Vec<String>>

If provided, the invoice returned will preview updating or creating a subscription with these default tax rates. The default tax rates will apply to any line item that does not have tax_rates set.

§items: Option<Vec<CreatePreviewInvoiceSubscriptionDetailsItems>>

A list of up to 20 subscription items, each with an attached price.

§proration_behavior: Option<CreatePreviewInvoiceSubscriptionDetailsProrationBehavior>

Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting billing_cycle_anchor=now, or starting a trial), or if an item’s quantity changes. The default value is create_prorations.

§proration_date: Option<Timestamp>

If previewing an update to a subscription, and doing proration, subscription_details.proration_date forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, subscription, and one of subscription_details.items, or subscription_details.trial_end are required. Also, subscription_details.proration_behavior cannot be set to ‘none’.

§resume_at: Option<CreatePreviewInvoiceSubscriptionDetailsResumeAt>

For paused subscriptions, setting subscription_details.resume_at to now will preview the invoice that will be generated if the subscription is resumed.

§start_date: Option<Timestamp>

Date a subscription is intended to start (can be future or past).

§trial_end: Option<CreatePreviewInvoiceSubscriptionDetailsTrialEnd>

If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of subscription_details.items or subscription is required.

Implementations§

Trait Implementations§

Source§

impl Clone for CreatePreviewInvoiceSubscriptionDetails

Source§

fn clone(&self) -> CreatePreviewInvoiceSubscriptionDetails

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CreatePreviewInvoiceSubscriptionDetails

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CreatePreviewInvoiceSubscriptionDetails

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Serialize for CreatePreviewInvoiceSubscriptionDetails

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more