Class: Stripe::InvoiceCreatePreviewParams

Inherits:
RequestParams show all
Defined in:
lib/stripe/params/invoice_create_preview_params.rb

Defined Under Namespace

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

attr_accessor, coerce_params, coerce_value, new, #to_h

Constructor Details

#initialize(automatic_tax: nil, currency: nil, customer: nil, customer_account: 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) ⇒ InvoiceCreatePreviewParams

Returns a new instance of InvoiceCreatePreviewParams.



1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1912

def initialize(
  automatic_tax: nil,
  currency: nil,
  customer: nil,
  customer_account: 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_account = 
  @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.



1882
1883
1884
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1882

def automatic_tax
  @automatic_tax
end

#currencyObject

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



1884
1885
1886
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1884

def currency
  @currency
end

#customerObject

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



1886
1887
1888
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1886

def customer
  @customer
end

#customer_accountObject

The identifier of the account representing the customer whose upcoming invoice you’re retrieving. If ‘automatic_tax` is enabled then one of `customer`, `customer_account`, `customer_details`, `subscription`, or `schedule` must be set.



1888
1889
1890
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1888

def 
  @customer_account
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.



1890
1891
1892
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1890

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.



1892
1893
1894
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1892

def discounts
  @discounts
end

#expandObject

Specifies which fields in the response should be expanded.



1894
1895
1896
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1894

def expand
  @expand
end

#invoice_itemsObject

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



1896
1897
1898
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1896

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.



1898
1899
1900
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1898

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](docs.stripe.com/billing/invoices/connect) documentation for details.



1900
1901
1902
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1900

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.



1902
1903
1904
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1902

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.



1904
1905
1906
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1904

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.



1906
1907
1908
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1906

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.



1908
1909
1910
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1908

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.



1910
1911
1912
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1910

def subscription_details
  @subscription_details
end

Class Method Details

.field_encodingsObject



1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1946

def self.field_encodings
  @field_encodings = {
    invoice_items: {
      kind: :array,
      element: {
        kind: :object,
        fields: {
          price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
          quantity_decimal: :decimal_string,
          unit_amount_decimal: :decimal_string,
        },
      },
    },
    schedule_details: {
      kind: :object,
      fields: {
        phases: {
          kind: :array,
          element: {
            kind: :object,
            fields: {
              add_invoice_items: {
                kind: :array,
                element: {
                  kind: :object,
                  fields: {
                    price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
                  },
                },
              },
              items: {
                kind: :array,
                element: {
                  kind: :object,
                  fields: {
                    price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
                  },
                },
              },
            },
          },
        },
      },
    },
    subscription_details: {
      kind: :object,
      fields: {
        items: {
          kind: :array,
          element: {
            kind: :object,
            fields: {
              price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
            },
          },
        },
      },
    },
  }
end