Class InvoiceUpcomingParams.Builder

java.lang.Object
com.stripe.param.InvoiceUpcomingParams.Builder
Enclosing class:
InvoiceUpcomingParams

public static class InvoiceUpcomingParams.Builder extends Object
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public InvoiceUpcomingParams build()
      Finalize and obtain parameter instance from this builder.
    • setAutomaticTax

      Settings for automatic tax lookup for this invoice preview.
    • setCoupon

      public InvoiceUpcomingParams.Builder setCoupon(String coupon)
      The code of the coupon to apply. If subscription or subscription_items is provided, the invoice returned will preview updating or creating a subscription with that coupon. Otherwise, it will preview applying that coupon to the customer for the next upcoming invoice from among the customer's subscriptions. The invoice can be previewed without a coupon by passing this value as an empty string.
    • setCurrency

      public InvoiceUpcomingParams.Builder setCurrency(String currency)
      The currency to preview this invoice in. Defaults to that of customer if not specified.
    • setCustomer

      public InvoiceUpcomingParams.Builder setCustomer(String customer)
      The identifier of the customer whose upcoming invoice you'd like to retrieve.
    • setCustomerDetails

      public InvoiceUpcomingParams.Builder setCustomerDetails(InvoiceUpcomingParams.CustomerDetails customerDetails)
      Details about the customer you want to invoice or overrides for an existing customer.
    • addDiscount

      Add an element to `discounts` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.discounts for the field documentation.
    • addAllDiscount

      Add all elements to `discounts` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.discounts for the field documentation.
    • setDiscounts

      public InvoiceUpcomingParams.Builder setDiscounts(EmptyParam discounts)
      The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. This only works for coupons directly applied to the invoice. To apply a coupon to a subscription, you must use the coupon parameter instead. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use coupon instead.
    • setDiscounts

      The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. This only works for coupons directly applied to the invoice. To apply a coupon to a subscription, you must use the coupon parameter instead. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use coupon instead.
    • addExpand

      public InvoiceUpcomingParams.Builder addExpand(String element)
      Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.expand for the field documentation.
    • addAllExpand

      public InvoiceUpcomingParams.Builder addAllExpand(List<String> elements)
      Add all elements to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.expand for the field documentation.
    • putExtraParam

      public InvoiceUpcomingParams.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. See InvoiceUpcomingParams.extraParams for the field documentation.
    • putAllExtraParam

      public InvoiceUpcomingParams.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. See InvoiceUpcomingParams.extraParams for the field documentation.
    • addInvoiceItem

      Add an element to `invoiceItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.invoiceItems for the field documentation.
    • addAllInvoiceItem

      Add all elements to `invoiceItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.invoiceItems for the field documentation.
    • setSchedule

      public InvoiceUpcomingParams.Builder setSchedule(String schedule)
      The identifier of the unstarted schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields.
    • setSubscription

      public InvoiceUpcomingParams.Builder setSubscription(String subscription)
      The identifier of the subscription for which you'd like to retrieve the upcoming invoice. If not provided, but a subscription_items is provided, you will preview creating a subscription with those items. If neither subscription nor subscription_items is provided, you will retrieve the next upcoming invoice from among the customer's subscriptions.
    • setSubscriptionBillingCycleAnchor

      public InvoiceUpcomingParams.Builder setSubscriptionBillingCycleAnchor(InvoiceUpcomingParams.SubscriptionBillingCycleAnchor subscriptionBillingCycleAnchor)
      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.
    • setSubscriptionBillingCycleAnchor

      public InvoiceUpcomingParams.Builder setSubscriptionBillingCycleAnchor(Long subscriptionBillingCycleAnchor)
      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.
    • setSubscriptionCancelAt

      public InvoiceUpcomingParams.Builder setSubscriptionCancelAt(Long subscriptionCancelAt)
      Timestamp indicating when the subscription should be scheduled to cancel. Will prorate if within the current period and prorations have been enabled using proration_behavior.
    • setSubscriptionCancelAt

      public InvoiceUpcomingParams.Builder setSubscriptionCancelAt(EmptyParam subscriptionCancelAt)
      Timestamp indicating when the subscription should be scheduled to cancel. Will prorate if within the current period and prorations have been enabled using proration_behavior.
    • setSubscriptionCancelAtPeriodEnd

      public InvoiceUpcomingParams.Builder setSubscriptionCancelAtPeriodEnd(Boolean subscriptionCancelAtPeriodEnd)
      Boolean indicating whether this subscription should cancel at the end of the current period.
    • setSubscriptionCancelNow

      public InvoiceUpcomingParams.Builder setSubscriptionCancelNow(Boolean subscriptionCancelNow)
      This simulates the subscription being canceled or expired immediately.
    • addSubscriptionDefaultTaxRate

      public InvoiceUpcomingParams.Builder addSubscriptionDefaultTaxRate(String element)
      Add an element to `subscriptionDefaultTaxRates` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.subscriptionDefaultTaxRates for the field documentation.
    • addAllSubscriptionDefaultTaxRate

      public InvoiceUpcomingParams.Builder addAllSubscriptionDefaultTaxRate(List<String> elements)
      Add all elements to `subscriptionDefaultTaxRates` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.subscriptionDefaultTaxRates for the field documentation.
    • setSubscriptionDefaultTaxRates

      public InvoiceUpcomingParams.Builder setSubscriptionDefaultTaxRates(EmptyParam subscriptionDefaultTaxRates)
      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.
    • setSubscriptionDefaultTaxRates

      public InvoiceUpcomingParams.Builder setSubscriptionDefaultTaxRates(List<String> subscriptionDefaultTaxRates)
      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.
    • addSubscriptionItem

      Add an element to `subscriptionItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.subscriptionItems for the field documentation.
    • addAllSubscriptionItem

      Add all elements to `subscriptionItems` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See InvoiceUpcomingParams.subscriptionItems for the field documentation.
    • setSubscriptionPrebilling

      public InvoiceUpcomingParams.Builder setSubscriptionPrebilling(InvoiceUpcomingParams.SubscriptionPrebilling subscriptionPrebilling)
      The pre-billing to apply to the subscription as a preview.
    • setSubscriptionProrationBehavior

      public InvoiceUpcomingParams.Builder setSubscriptionProrationBehavior(InvoiceUpcomingParams.SubscriptionProrationBehavior subscriptionProrationBehavior)
      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.
    • setSubscriptionProrationDate

      public InvoiceUpcomingParams.Builder setSubscriptionProrationDate(Long subscriptionProrationDate)
      If previewing an update to a subscription, and doing proration, subscription_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_items, or subscription_trial_end are required. Also, subscription_proration_behavior cannot be set to 'none'.
    • setSubscriptionResumeAt

      public InvoiceUpcomingParams.Builder setSubscriptionResumeAt(InvoiceUpcomingParams.SubscriptionResumeAt subscriptionResumeAt)
      For paused subscriptions, setting subscription_resume_at to now will preview the invoice that will be generated if the subscription is resumed.
    • setSubscriptionStartDate

      public InvoiceUpcomingParams.Builder setSubscriptionStartDate(Long subscriptionStartDate)
      Date a subscription is intended to start (can be future or past).
    • setSubscriptionTrialEnd

      public InvoiceUpcomingParams.Builder setSubscriptionTrialEnd(InvoiceUpcomingParams.SubscriptionTrialEnd subscriptionTrialEnd)
      If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of subscription_items or subscription is required.
    • setSubscriptionTrialEnd

      public InvoiceUpcomingParams.Builder setSubscriptionTrialEnd(Long subscriptionTrialEnd)
      If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of subscription_items or subscription is required.
    • setSubscriptionTrialFromPlan

      public InvoiceUpcomingParams.Builder setSubscriptionTrialFromPlan(Boolean subscriptionTrialFromPlan)
      Indicates if a plan's trial_period_days should be applied to the subscription. Setting subscription_trial_end per subscription is preferred, and this defaults to false. Setting this flag to true together with subscription_trial_end is not allowed. See Using trial periods on subscriptions to learn more.