Class: Stripe::InvoiceUpcomingLinesService::ListParams::SubscriptionDetails

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/services/invoice_upcoming_lines_service.rb

Defined Under Namespace

Classes: Item, Prebilling

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

Constructor Details

#initialize(billing_cycle_anchor: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, prebilling: nil, proration_behavior: nil, proration_date: nil, resume_at: nil, start_date: nil, trial_end: nil) ⇒ SubscriptionDetails

Returns a new instance of SubscriptionDetails.



1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1559

def initialize(
  billing_cycle_anchor: nil,
  cancel_at: nil,
  cancel_at_period_end: nil,
  cancel_now: nil,
  default_tax_rates: nil,
  items: nil,
  prebilling: nil,
  proration_behavior: nil,
  proration_date: nil,
  resume_at: nil,
  start_date: nil,
  trial_end: nil
)
  @billing_cycle_anchor = billing_cycle_anchor
  @cancel_at = cancel_at
  @cancel_at_period_end = cancel_at_period_end
  @cancel_now = cancel_now
  @default_tax_rates = default_tax_rates
  @items = items
  @prebilling = prebilling
  @proration_behavior = proration_behavior
  @proration_date = proration_date
  @resume_at = resume_at
  @start_date = start_date
  @trial_end = trial_end
end

Instance Attribute Details

#billing_cycle_anchorObject

For new subscriptions, a future timestamp to anchor the subscription’s [billing cycle](stripe.com/docs/subscriptions/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`.



1535
1536
1537
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1535

def billing_cycle_anchor
  @billing_cycle_anchor
end

#cancel_atObject

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.



1537
1538
1539
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1537

def cancel_at
  @cancel_at
end

#cancel_at_period_endObject

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



1539
1540
1541
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1539

def cancel_at_period_end
  @cancel_at_period_end
end

#cancel_nowObject

This simulates the subscription being canceled or expired immediately.



1541
1542
1543
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1541

def cancel_now
  @cancel_now
end

#default_tax_ratesObject

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.



1543
1544
1545
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1543

def default_tax_rates
  @default_tax_rates
end

#itemsObject

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



1545
1546
1547
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1545

def items
  @items
end

#prebillingObject

The pre-billing to apply to the subscription as a preview.



1547
1548
1549
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1547

def prebilling
  @prebilling
end

#proration_behaviorObject

Determines how to handle [prorations](stripe.com/docs/billing/subscriptions/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`.



1549
1550
1551
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1549

def proration_behavior
  @proration_behavior
end

#proration_dateObject

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’.



1551
1552
1553
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1551

def proration_date
  @proration_date
end

#resume_atObject

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



1553
1554
1555
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1553

def resume_at
  @resume_at
end

#start_dateObject

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



1555
1556
1557
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1555

def start_date
  @start_date
end

#trial_endObject

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.



1557
1558
1559
# File 'lib/stripe/services/invoice_upcoming_lines_service.rb', line 1557

def trial_end
  @trial_end
end