[−][src]Struct stripe::CreateSubscription
The parameters for Subscription::create
.
Fields
application_fee_percent: Option<f64>
A non-negative decimal between 0 and 100, with at most two decimal places.
This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner's Stripe account. The request must be made with an OAuth key in order to set an application fee percentage. For more information, see the application fees documentation.
billing: Option<SubscriptionBilling>
Either charge_automatically
, or send_invoice
.
When charging automatically, Stripe will attempt to pay this subscription at the end of the cycle using the default source attached to the customer.
When sending an invoice, Stripe will email your customer an invoice with payment instructions.
Defaults to charge_automatically
.
billing_cycle_anchor: Option<Timestamp>
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.
billing_thresholds: Option<SubscriptionBillingThresholds>
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
Pass an empty string to remove previously-defined thresholds.
cancel_at_period_end: Option<bool>
Boolean indicating whether this subscription should cancel at the end of the current period.
coupon: Option<CouponId>
The code of the coupon to apply to this subscription.
A coupon applied to a subscription will only affect invoices created for that particular subscription.
customer: CustomerId
The identifier of the customer to subscribe.
days_until_due: Option<u32>
Number of days a customer has to pay invoices generated by this subscription.
Valid only for subscriptions where billing
is set to send_invoice
.
default_payment_method: Option<&'a str>
ID of the default payment method for the subscription.
It must belong to the customer associated with the subscription. If not set, invoices will use the default payment method in the customer's invoice settings.
default_source: Option<&'a str>
ID of the default payment source for the subscription.
It must belong to the customer associated with the subscription and be in a chargeable state. If not set, defaults to the customer's default source.
default_tax_rates: Option<Vec<String>>
The tax rates that will apply to any subscription item that does not have tax_rates
set.
Invoices created will have their default_tax_rates
populated from the subscription.
expand: &'a [&'a str]
Specifies which fields in the response should be expanded.
items: Option<Vec<CreateSubscriptionItems>>
List of subscription items, each with an attached plan.
metadata: Option<Metadata>
A set of key-value pairs that you can attach to a Subscription
object.
It can be useful for storing additional information about the subscription in a structured format.
prorate: Option<bool>
Boolean (defaults to true
) telling us whether to credit for unused time 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.
If false
, the anchor period will be free (similar to a trial) and no proration adjustments will be created.
tax_percent: Option<f64>
A non-negative decimal (with at most four decimal places) between 0 and 100.
This represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount in each billing period.
For example, a plan which charges $10/month with a tax_percent
of 20.0
will charge $12 per invoice.
To unset a previously-set value, pass an empty string.
This field has been deprecated and will be removed in a future API version, for further information view the migration docs for tax_rates
.
trial_end: Option<Scheduled>
Unix timestamp representing the end of the trial period the customer will get before being charged for the first time.
This will always overwrite any trials that might apply via a subscribed plan.
If set, trial_end will override the default trial period of the plan the customer is being subscribed to.
The special value now
can be provided to end the customer's trial immediately.
Can be at most two years from billing_cycle_anchor
.
trial_from_plan: Option<bool>
Indicates if a plan's trial_period_days
should be applied to the subscription.
Setting trial_end
per subscription is preferred, and this defaults to false
.
Setting this flag to true
together with trial_end
is not allowed.
trial_period_days: Option<u32>
Integer representing the number of trial period days before the customer is charged for the first time.
This will always overwrite any trials that might apply via a subscribed plan.
Methods
impl<'a> CreateSubscription<'a>
[src]
pub fn new(customer: CustomerId) -> Self
[src]
Trait Implementations
impl<'a> Clone for CreateSubscription<'a>
[src]
fn clone(&self) -> CreateSubscription<'a>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> Debug for CreateSubscription<'a>
[src]
impl<'a> Serialize for CreateSubscription<'a>
[src]
Auto Trait Implementations
impl<'a> Send for CreateSubscription<'a>
impl<'a> Sync for CreateSubscription<'a>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self