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.



1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1075

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



1045
1046
1047
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1045

def automatic_tax
  @automatic_tax
end

#currencyObject

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



1047
1048
1049
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1047

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.



1049
1050
1051
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1049

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.



1051
1052
1053
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1051

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



1053
1054
1055
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1053

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.



1055
1056
1057
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1055

def discounts
  @discounts
end

#expandObject

Specifies which fields in the response should be expanded.



1057
1058
1059
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1057

def expand
  @expand
end

#invoice_itemsObject

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



1059
1060
1061
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1059

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.



1061
1062
1063
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1061

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.



1063
1064
1065
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1063

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.



1065
1066
1067
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1065

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.



1067
1068
1069
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1067

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.



1069
1070
1071
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1069

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.



1071
1072
1073
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1071

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.



1073
1074
1075
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1073

def subscription_details
  @subscription_details
end

Class Method Details

.field_encodingsObject



1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 1109

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