Package com.stripe.param
Class InvoiceCreatePreviewParams.SubscriptionDetails.Builder
java.lang.Object
com.stripe.param.InvoiceCreatePreviewParams.SubscriptionDetails.Builder
- Enclosing class:
- InvoiceCreatePreviewParams.SubscriptionDetails
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAllDefaultTaxRate
(List<String> elements) Add all elements to `defaultTaxRates` list.Add all elements to `items` list.addDefaultTaxRate
(String element) Add an element to `defaultTaxRates` list.Add an element to `items` list.build()
Finalize and obtain parameter instance from this builder.putAllExtraParam
(Map<String, Object> map) Add all map key/value pairs to `extraParams` map.putExtraParam
(String key, Object value) Add a key/value pair to `extraParams` map.setBillingCycleAnchor
(InvoiceCreatePreviewParams.SubscriptionDetails.BillingCycleAnchor billingCycleAnchor) For new subscriptions, a future timestamp to anchor the subscription's billing cycle.setBillingCycleAnchor
(Long billingCycleAnchor) For new subscriptions, a future timestamp to anchor the subscription's billing cycle.setCancelAt
(EmptyParam cancelAt) A timestamp at which the subscription should cancel.setCancelAt
(Long cancelAt) A timestamp at which the subscription should cancel.setCancelAtPeriodEnd
(Boolean cancelAtPeriodEnd) Indicate whether this subscription should cancel at the end of the current period (current_period_end
).setCancelNow
(Boolean cancelNow) This simulates the subscription being canceled or expired immediately.setDefaultTaxRates
(EmptyParam defaultTaxRates) If provided, the invoice returned will preview updating or creating a subscription with these default tax rates.setDefaultTaxRates
(List<String> defaultTaxRates) If provided, the invoice returned will preview updating or creating a subscription with these default tax rates.setProrationBehavior
(InvoiceCreatePreviewParams.SubscriptionDetails.ProrationBehavior prorationBehavior) Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resettingbilling_cycle_anchor=now
, or starting a trial), or if an item'squantity
changes.setProrationDate
(Long prorationDate) 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.For paused subscriptions, settingsubscription_details.resume_at
tonow
will preview the invoice that will be generated if the subscription is resumed.setStartDate
(Long startDate) Date a subscription is intended to start (can be future or past).If provided, the invoice returned will preview updating or creating a subscription with that trial end.setTrialEnd
(Long trialEnd) If provided, the invoice returned will preview updating or creating a subscription with that trial end.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Finalize and obtain parameter instance from this builder. -
setBillingCycleAnchor
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setBillingCycleAnchor(InvoiceCreatePreviewParams.SubscriptionDetails.BillingCycleAnchor billingCycleAnchor) 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 withmonth
oryear
intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set tonow
orunchanged
. -
setBillingCycleAnchor
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setBillingCycleAnchor(Long billingCycleAnchor) 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 withmonth
oryear
intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set tonow
orunchanged
. -
setCancelAt
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 usingproration_behavior
. If set during a future period, this will always cause a proration for that period. -
setCancelAt
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 usingproration_behavior
. If set during a future period, this will always cause a proration for that period. -
setCancelAtPeriodEnd
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setCancelAtPeriodEnd(Boolean cancelAtPeriodEnd) Indicate whether this subscription should cancel at the end of the current period (current_period_end
). Defaults tofalse
. -
setCancelNow
This simulates the subscription being canceled or expired immediately. -
addDefaultTaxRate
Add an element to `defaultTaxRates` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeInvoiceCreatePreviewParams.SubscriptionDetails.defaultTaxRates
for the field documentation. -
addAllDefaultTaxRate
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder addAllDefaultTaxRate(List<String> elements) Add all elements to `defaultTaxRates` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeInvoiceCreatePreviewParams.SubscriptionDetails.defaultTaxRates
for the field documentation. -
setDefaultTaxRates
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setDefaultTaxRates(EmptyParam defaultTaxRates) 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 havetax_rates
set. -
setDefaultTaxRates
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setDefaultTaxRates(List<String> defaultTaxRates) 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 havetax_rates
set. -
putExtraParam
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder putExtraParam(String key, Object value) Add a key/value pair to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. SeeInvoiceCreatePreviewParams.SubscriptionDetails.extraParams
for the field documentation. -
putAllExtraParam
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder putAllExtraParam(Map<String, Object> map) Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. SeeInvoiceCreatePreviewParams.SubscriptionDetails.extraParams
for the field documentation. -
addItem
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder addItem(InvoiceCreatePreviewParams.SubscriptionDetails.Item element) Add an element to `items` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeInvoiceCreatePreviewParams.SubscriptionDetails.items
for the field documentation. -
addAllItem
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder addAllItem(List<InvoiceCreatePreviewParams.SubscriptionDetails.Item> elements) Add all elements to `items` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. SeeInvoiceCreatePreviewParams.SubscriptionDetails.items
for the field documentation. -
setProrationBehavior
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setProrationBehavior(InvoiceCreatePreviewParams.SubscriptionDetails.ProrationBehavior prorationBehavior) Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resettingbilling_cycle_anchor=now
, or starting a trial), or if an item'squantity
changes. The default value iscreate_prorations
. -
setProrationDate
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 ofsubscription_details.items
, orsubscription_details.trial_end
are required. Also,subscription_details.proration_behavior
cannot be set to 'none'. -
setResumeAt
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setResumeAt(InvoiceCreatePreviewParams.SubscriptionDetails.ResumeAt resumeAt) For paused subscriptions, settingsubscription_details.resume_at
tonow
will preview the invoice that will be generated if the subscription is resumed. -
setStartDate
Date a subscription is intended to start (can be future or past). -
setTrialEnd
public InvoiceCreatePreviewParams.SubscriptionDetails.Builder setTrialEnd(InvoiceCreatePreviewParams.SubscriptionDetails.TrialEnd trialEnd) If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one ofsubscription_details.items
orsubscription
is required. -
setTrialEnd
If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one ofsubscription_details.items
orsubscription
is required.
-