Class: Stripe::InvoiceService::CreatePreviewParams

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

Defined Under Namespace

Classes: AutomaticTax, CustomerDetails, Discount, InvoiceItem, Issuer, ScheduleDetails, SubscriptionDetails

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

Constructor Details

#initialize(automatic_tax: nil, currency: nil, customer: nil, customer_details: nil, discounts: nil, expand: nil, invoice_items: nil, issuer: nil, on_behalf_of: nil, preview_mode: nil, schedule: nil, schedule_details: nil, subscription: nil, subscription_details: nil) ⇒ CreatePreviewParams

Returns a new instance of CreatePreviewParams.



2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
# File 'lib/stripe/services/invoice_service.rb', line 2627

def initialize(
  automatic_tax: nil,
  currency: nil,
  customer: nil,
  customer_details: nil,
  discounts: nil,
  expand: nil,
  invoice_items: nil,
  issuer: nil,
  on_behalf_of: nil,
  preview_mode: nil,
  schedule: nil,
  schedule_details: nil,
  subscription: nil,
  subscription_details: nil
)
  @automatic_tax = automatic_tax
  @currency = currency
  @customer = customer
  @customer_details = customer_details
  @discounts = discounts
  @expand = expand
  @invoice_items = invoice_items
  @issuer = issuer
  @on_behalf_of = on_behalf_of
  @preview_mode = preview_mode
  @schedule = schedule
  @schedule_details = schedule_details
  @subscription = subscription
  @subscription_details = subscription_details
end

Instance Attribute Details

#automatic_taxObject

Settings for automatic tax lookup for this invoice preview.



2599
2600
2601
# File 'lib/stripe/services/invoice_service.rb', line 2599

def automatic_tax
  @automatic_tax
end

#currencyObject

The currency to preview this invoice in. Defaults to that of ‘customer` if not specified.



2601
2602
2603
# File 'lib/stripe/services/invoice_service.rb', line 2601

def currency
  @currency
end

#customerObject

The identifier of the customer whose upcoming invoice you’d like to retrieve. If ‘automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set.



2603
2604
2605
# File 'lib/stripe/services/invoice_service.rb', line 2603

def customer
  @customer
end

#customer_detailsObject

Details about the customer you want to invoice or overrides for an existing customer. If ‘automatic_tax` is enabled then one of `customer`, `customer_details`, `subscription`, or `schedule` must be set.



2605
2606
2607
# File 'lib/stripe/services/invoice_service.rb', line 2605

def customer_details
  @customer_details
end

#discountsObject

The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the subscription or customer. This works for both coupons directly applied to an invoice and coupons applied to a subscription. Pass an empty string to avoid inheriting any discounts.



2607
2608
2609
# File 'lib/stripe/services/invoice_service.rb', line 2607

def discounts
  @discounts
end

#expandObject

Specifies which fields in the response should be expanded.



2609
2610
2611
# File 'lib/stripe/services/invoice_service.rb', line 2609

def expand
  @expand
end

#invoice_itemsObject

List of invoice items to add or update in the upcoming invoice preview (up to 250).



2611
2612
2613
# File 'lib/stripe/services/invoice_service.rb', line 2611

def invoice_items
  @invoice_items
end

#issuerObject

The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.



2613
2614
2615
# File 'lib/stripe/services/invoice_service.rb', line 2613

def issuer
  @issuer
end

#on_behalf_ofObject

The account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](stripe.com/docs/billing/invoices/connect) documentation for details.



2615
2616
2617
# File 'lib/stripe/services/invoice_service.rb', line 2615

def on_behalf_of
  @on_behalf_of
end

#preview_modeObject

Customizes the types of values to include when calculating the invoice. Defaults to ‘next` if unspecified.



2617
2618
2619
# File 'lib/stripe/services/invoice_service.rb', line 2617

def preview_mode
  @preview_mode
end

#scheduleObject

The identifier of the schedule whose upcoming invoice you’d like to retrieve. Cannot be used with subscription or subscription fields.



2619
2620
2621
# File 'lib/stripe/services/invoice_service.rb', line 2619

def schedule
  @schedule
end

#schedule_detailsObject

The schedule creation or modification params to apply as a preview. Cannot be used with ‘subscription` or `subscription_` prefixed fields.



2621
2622
2623
# File 'lib/stripe/services/invoice_service.rb', line 2621

def schedule_details
  @schedule_details
end

#subscriptionObject

The identifier of the subscription for which you’d like to retrieve the upcoming invoice. If not provided, but a ‘subscription_details.items` is provided, you will preview creating a subscription with those items. If neither `subscription` nor `subscription_details.items` is provided, you will retrieve the next upcoming invoice from among the customer’s subscriptions.



2623
2624
2625
# File 'lib/stripe/services/invoice_service.rb', line 2623

def subscription
  @subscription
end

#subscription_detailsObject

The subscription creation or modification params to apply as a preview. Cannot be used with ‘schedule` or `schedule_details` fields.



2625
2626
2627
# File 'lib/stripe/services/invoice_service.rb', line 2625

def subscription_details
  @subscription_details
end