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, billing_cadence: 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.



2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2438

def initialize(
  automatic_tax: nil,
  billing_cadence: 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
  @billing_cadence = billing_cadence
  @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.



2406
2407
2408
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2406

def automatic_tax
  @automatic_tax
end

#billing_cadenceObject

The identifier of the billing cadence for which you’d like to retrieve the upcoming invoice. Cannot be provided when ‘subscription`, `schedule`, `subscription_details` or `schedule_details` are provided.



2408
2409
2410
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2408

def billing_cadence
  @billing_cadence
end

#currencyObject

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



2410
2411
2412
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2410

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.



2412
2413
2414
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2412

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.



2414
2415
2416
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2414

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.



2416
2417
2418
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2416

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.



2418
2419
2420
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2418

def discounts
  @discounts
end

#expandObject

Specifies which fields in the response should be expanded.



2420
2421
2422
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2420

def expand
  @expand
end

#invoice_itemsObject

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



2422
2423
2424
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2422

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.



2424
2425
2426
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2424

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.



2426
2427
2428
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2426

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.



2428
2429
2430
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2428

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.



2430
2431
2432
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2430

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.



2432
2433
2434
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2432

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.



2434
2435
2436
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2434

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.



2436
2437
2438
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2436

def subscription_details
  @subscription_details
end

Class Method Details

.field_encodingsObject



2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2474

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