Class InvoiceUpcomingParams.Builder

  • Enclosing class:
    InvoiceUpcomingParams

    public static class InvoiceUpcomingParams.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • setCoupon

        public InvoiceUpcomingParams.Builder setCoupon​(java.lang.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.
      • setCustomer

        public InvoiceUpcomingParams.Builder setCustomer​(java.lang.String customer)
        The identifier of the customer whose upcoming invoice you'd like to retrieve.
      • 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. 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

        public InvoiceUpcomingParams.Builder setDiscounts​(java.util.List<InvoiceUpcomingParams.Discount> discounts)
        The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. 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​(java.lang.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​(java.util.List<java.lang.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​(java.lang.String key,
                                                           java.lang.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​(java.util.Map<java.lang.String,​java.lang.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.
      • setSchedule

        public InvoiceUpcomingParams.Builder setSchedule​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.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​(java.lang.Boolean subscriptionCancelAtPeriodEnd)
        Boolean indicating whether this subscription should cancel at the end of the current period.
      • setSubscriptionCancelNow

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

        public InvoiceUpcomingParams.Builder addSubscriptionDefaultTaxRate​(java.lang.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​(java.util.List<java.lang.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​(java.util.List<java.lang.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.
      • 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. Valid values are create_prorations, none, or always_invoice.

        Passing create_prorations will cause proration invoice items to be created when applicable. These proration items will only be invoiced immediately under certain conditions. In order to always invoice immediately for prorations, pass always_invoice.

        Prorations can be disabled by passing none.

      • setSubscriptionProrationDate

        public InvoiceUpcomingParams.Builder setSubscriptionProrationDate​(java.lang.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 cannot be before the subscription was on its current plan. If set, subscription, and one of subscription_items, or subscription_trial_end are required. Also, subscription_proration_behavior cannot be set to 'none'.
      • setSubscriptionStartDate

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

        public InvoiceUpcomingParams.Builder setSubscriptionTrialEnd​(java.lang.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​(java.lang.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.