• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-go / 11296113556

11 Oct 2024 04:42PM UTC coverage: 62.991% (-0.02%) from 63.015%
11296113556

Pull #1934

github

stripe-openapi[bot]
Update generated code for v1291
Pull Request #1934: Update generated code for beta

0 of 8 new or added lines in 2 files covered. (0.0%)

469 existing lines in 20 files now uncovered.

6209 of 9857 relevant lines covered (62.99%)

15.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

7.33
/invoice.go
1
//
2
//
3
// File generated from our OpenAPI spec
4
//
5
//
6

7
package stripe
8

9
import (
10
        "encoding/json"
11
        "github.com/stripe/stripe-go/v80/form"
12
)
13

14
// The status of the payment, one of `open`, `paid`, or `past_due`
15
type InvoiceAmountsDueStatus string
16

17
// List of values that InvoiceAmountsDueStatus can take
18
const (
19
        InvoiceAmountsDueStatusOpen    InvoiceAmountsDueStatus = "open"
20
        InvoiceAmountsDueStatusPaid    InvoiceAmountsDueStatus = "paid"
21
        InvoiceAmountsDueStatusPastDue InvoiceAmountsDueStatus = "past_due"
22
)
23

24
// Type of the account referenced.
25
type InvoiceAutomaticTaxLiabilityType string
26

27
// List of values that InvoiceAutomaticTaxLiabilityType can take
28
const (
29
        InvoiceAutomaticTaxLiabilityTypeAccount InvoiceAutomaticTaxLiabilityType = "account"
30
        InvoiceAutomaticTaxLiabilityTypeSelf    InvoiceAutomaticTaxLiabilityType = "self"
31
)
32

33
// The status of the most recent automated tax calculation for this invoice.
34
type InvoiceAutomaticTaxStatus string
35

36
// List of values that InvoiceAutomaticTaxStatus can take
37
const (
38
        InvoiceAutomaticTaxStatusComplete               InvoiceAutomaticTaxStatus = "complete"
39
        InvoiceAutomaticTaxStatusFailed                 InvoiceAutomaticTaxStatus = "failed"
40
        InvoiceAutomaticTaxStatusRequiresLocationInputs InvoiceAutomaticTaxStatus = "requires_location_inputs"
41
)
42

43
// Indicates the reason why the invoice was created.
44
//
45
// * `manual`: Unrelated to a subscription, for example, created via the invoice editor.
46
// * `subscription`: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
47
// * `subscription_create`: A new subscription was created.
48
// * `subscription_cycle`: A subscription advanced into a new period.
49
// * `subscription_threshold`: A subscription reached a billing threshold.
50
// * `subscription_update`: A subscription was updated.
51
// * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint.
52
type InvoiceBillingReason string
53

54
// List of values that InvoiceBillingReason can take
55
const (
56
        InvoiceBillingReasonAutomaticPendingInvoiceItemInvoice InvoiceBillingReason = "automatic_pending_invoice_item_invoice"
57
        InvoiceBillingReasonManual                             InvoiceBillingReason = "manual"
58
        InvoiceBillingReasonQuoteAccept                        InvoiceBillingReason = "quote_accept"
59
        InvoiceBillingReasonSubscription                       InvoiceBillingReason = "subscription"
60
        InvoiceBillingReasonSubscriptionCreate                 InvoiceBillingReason = "subscription_create"
61
        InvoiceBillingReasonSubscriptionCycle                  InvoiceBillingReason = "subscription_cycle"
62
        InvoiceBillingReasonSubscriptionThreshold              InvoiceBillingReason = "subscription_threshold"
63
        InvoiceBillingReasonSubscriptionUpdate                 InvoiceBillingReason = "subscription_update"
64
        InvoiceBillingReasonUpcoming                           InvoiceBillingReason = "upcoming"
65
)
66

67
// Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
68
type InvoiceCollectionMethod string
69

70
// List of values that InvoiceCollectionMethod can take
71
const (
72
        InvoiceCollectionMethodChargeAutomatically InvoiceCollectionMethod = "charge_automatically"
73
        InvoiceCollectionMethodSendInvoice         InvoiceCollectionMethod = "send_invoice"
74
)
75

76
// Type of the account referenced.
77
type InvoiceIssuerType string
78

79
// List of values that InvoiceIssuerType can take
80
const (
81
        InvoiceIssuerTypeAccount InvoiceIssuerType = "account"
82
        InvoiceIssuerTypeSelf    InvoiceIssuerType = "self"
83
)
84

85
// Transaction type of the mandate.
86
type InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionType string
87

88
// List of values that InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionType can take
89
const (
90
        InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionTypeBusiness InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionType = "business"
91
        InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionTypePersonal InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionType = "personal"
92
)
93

94
// Bank account verification method.
95
type InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethod string
96

97
// List of values that InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethod can take
98
const (
99
        InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethodAutomatic     InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethod = "automatic"
100
        InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethodInstant       InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethod = "instant"
101
        InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethodMicrodeposits InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethod = "microdeposits"
102
)
103

104
// We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
105
type InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure string
106

107
// List of values that InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure can take
108
const (
109
        InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecureAny       InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure = "any"
110
        InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecureAutomatic InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure = "automatic"
111
        InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecureChallenge InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure = "challenge"
112
)
113

114
// The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
115
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceFundingType string
116

117
// List of values that InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceFundingType can take
118
const (
119
        InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceFundingTypeBankTransfer InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceFundingType = "bank_transfer"
120
)
121

122
// The account subcategories to use to filter for possible accounts to link. Valid subcategories are `checking` and `savings`.
123
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategory string
124

125
// List of values that InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategory can take
126
const (
127
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategoryChecking InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategory = "checking"
128
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategorySavings  InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategory = "savings"
129
)
130

131
// The list of permissions to request. The `payment_method` permission must be included.
132
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission string
133

134
// List of values that InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission can take
135
const (
136
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionBalances      InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "balances"
137
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionOwnership     InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "ownership"
138
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionPaymentMethod InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "payment_method"
139
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionTransactions  InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "transactions"
140
)
141

142
// Data features requested to be retrieved upon account creation.
143
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch string
144

145
// List of values that InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch can take
146
const (
147
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchBalances         InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "balances"
148
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchInferredBalances InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "inferred_balances"
149
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchOwnership        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "ownership"
150
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetchTransactions     InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch = "transactions"
151
)
152

153
// Bank account verification method.
154
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethod string
155

156
// List of values that InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethod can take
157
const (
158
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethodAutomatic     InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethod = "automatic"
159
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethodInstant       InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethod = "instant"
160
        InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethodMicrodeposits InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethod = "microdeposits"
161
)
162

163
// The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice).
164
type InvoicePaymentSettingsPaymentMethodType string
165

166
// List of values that InvoicePaymentSettingsPaymentMethodType can take
167
const (
168
        InvoicePaymentSettingsPaymentMethodTypeACHCreditTransfer  InvoicePaymentSettingsPaymentMethodType = "ach_credit_transfer"
169
        InvoicePaymentSettingsPaymentMethodTypeACHDebit           InvoicePaymentSettingsPaymentMethodType = "ach_debit"
170
        InvoicePaymentSettingsPaymentMethodTypeACSSDebit          InvoicePaymentSettingsPaymentMethodType = "acss_debit"
171
        InvoicePaymentSettingsPaymentMethodTypeAmazonPay          InvoicePaymentSettingsPaymentMethodType = "amazon_pay"
172
        InvoicePaymentSettingsPaymentMethodTypeAUBECSDebit        InvoicePaymentSettingsPaymentMethodType = "au_becs_debit"
173
        InvoicePaymentSettingsPaymentMethodTypeBACSDebit          InvoicePaymentSettingsPaymentMethodType = "bacs_debit"
174
        InvoicePaymentSettingsPaymentMethodTypeBancontact         InvoicePaymentSettingsPaymentMethodType = "bancontact"
175
        InvoicePaymentSettingsPaymentMethodTypeBoleto             InvoicePaymentSettingsPaymentMethodType = "boleto"
176
        InvoicePaymentSettingsPaymentMethodTypeCard               InvoicePaymentSettingsPaymentMethodType = "card"
177
        InvoicePaymentSettingsPaymentMethodTypeCashApp            InvoicePaymentSettingsPaymentMethodType = "cashapp"
178
        InvoicePaymentSettingsPaymentMethodTypeCustomerBalance    InvoicePaymentSettingsPaymentMethodType = "customer_balance"
179
        InvoicePaymentSettingsPaymentMethodTypeEPS                InvoicePaymentSettingsPaymentMethodType = "eps"
180
        InvoicePaymentSettingsPaymentMethodTypeFPX                InvoicePaymentSettingsPaymentMethodType = "fpx"
181
        InvoicePaymentSettingsPaymentMethodTypeGiropay            InvoicePaymentSettingsPaymentMethodType = "giropay"
182
        InvoicePaymentSettingsPaymentMethodTypeGrabpay            InvoicePaymentSettingsPaymentMethodType = "grabpay"
183
        InvoicePaymentSettingsPaymentMethodTypeIDEAL              InvoicePaymentSettingsPaymentMethodType = "ideal"
184
        InvoicePaymentSettingsPaymentMethodTypeKonbini            InvoicePaymentSettingsPaymentMethodType = "konbini"
185
        InvoicePaymentSettingsPaymentMethodTypeLink               InvoicePaymentSettingsPaymentMethodType = "link"
186
        InvoicePaymentSettingsPaymentMethodTypeMultibanco         InvoicePaymentSettingsPaymentMethodType = "multibanco"
187
        InvoicePaymentSettingsPaymentMethodTypeP24                InvoicePaymentSettingsPaymentMethodType = "p24"
188
        InvoicePaymentSettingsPaymentMethodTypePayNow             InvoicePaymentSettingsPaymentMethodType = "paynow"
189
        InvoicePaymentSettingsPaymentMethodTypePaypal             InvoicePaymentSettingsPaymentMethodType = "paypal"
190
        InvoicePaymentSettingsPaymentMethodTypePromptPay          InvoicePaymentSettingsPaymentMethodType = "promptpay"
191
        InvoicePaymentSettingsPaymentMethodTypeRevolutPay         InvoicePaymentSettingsPaymentMethodType = "revolut_pay"
192
        InvoicePaymentSettingsPaymentMethodTypeSEPACreditTransfer InvoicePaymentSettingsPaymentMethodType = "sepa_credit_transfer"
193
        InvoicePaymentSettingsPaymentMethodTypeSEPADebit          InvoicePaymentSettingsPaymentMethodType = "sepa_debit"
194
        InvoicePaymentSettingsPaymentMethodTypeSofort             InvoicePaymentSettingsPaymentMethodType = "sofort"
195
        InvoicePaymentSettingsPaymentMethodTypeSwish              InvoicePaymentSettingsPaymentMethodType = "swish"
196
        InvoicePaymentSettingsPaymentMethodTypeUSBankAccount      InvoicePaymentSettingsPaymentMethodType = "us_bank_account"
197
        InvoicePaymentSettingsPaymentMethodTypeWeChatPay          InvoicePaymentSettingsPaymentMethodType = "wechat_pay"
198
)
199

200
// Page size of invoice pdf. Options include a4, letter, and auto. If set to auto, page size will be switched to a4 or letter based on customer locale.
201
type InvoiceRenderingPDFPageSize string
202

203
// List of values that InvoiceRenderingPDFPageSize can take
204
const (
205
        InvoiceRenderingPDFPageSizeA4     InvoiceRenderingPDFPageSize = "a4"
206
        InvoiceRenderingPDFPageSizeAuto   InvoiceRenderingPDFPageSize = "auto"
207
        InvoiceRenderingPDFPageSizeLetter InvoiceRenderingPDFPageSize = "letter"
208
)
209

210
// The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
211
type InvoiceShippingCostTaxTaxabilityReason string
212

213
// List of values that InvoiceShippingCostTaxTaxabilityReason can take
214
const (
215
        InvoiceShippingCostTaxTaxabilityReasonCustomerExempt       InvoiceShippingCostTaxTaxabilityReason = "customer_exempt"
216
        InvoiceShippingCostTaxTaxabilityReasonNotCollecting        InvoiceShippingCostTaxTaxabilityReason = "not_collecting"
217
        InvoiceShippingCostTaxTaxabilityReasonNotSubjectToTax      InvoiceShippingCostTaxTaxabilityReason = "not_subject_to_tax"
218
        InvoiceShippingCostTaxTaxabilityReasonNotSupported         InvoiceShippingCostTaxTaxabilityReason = "not_supported"
219
        InvoiceShippingCostTaxTaxabilityReasonPortionProductExempt InvoiceShippingCostTaxTaxabilityReason = "portion_product_exempt"
220
        InvoiceShippingCostTaxTaxabilityReasonPortionReducedRated  InvoiceShippingCostTaxTaxabilityReason = "portion_reduced_rated"
221
        InvoiceShippingCostTaxTaxabilityReasonPortionStandardRated InvoiceShippingCostTaxTaxabilityReason = "portion_standard_rated"
222
        InvoiceShippingCostTaxTaxabilityReasonProductExempt        InvoiceShippingCostTaxTaxabilityReason = "product_exempt"
223
        InvoiceShippingCostTaxTaxabilityReasonProductExemptHoliday InvoiceShippingCostTaxTaxabilityReason = "product_exempt_holiday"
224
        InvoiceShippingCostTaxTaxabilityReasonProportionallyRated  InvoiceShippingCostTaxTaxabilityReason = "proportionally_rated"
225
        InvoiceShippingCostTaxTaxabilityReasonReducedRated         InvoiceShippingCostTaxTaxabilityReason = "reduced_rated"
226
        InvoiceShippingCostTaxTaxabilityReasonReverseCharge        InvoiceShippingCostTaxTaxabilityReason = "reverse_charge"
227
        InvoiceShippingCostTaxTaxabilityReasonStandardRated        InvoiceShippingCostTaxTaxabilityReason = "standard_rated"
228
        InvoiceShippingCostTaxTaxabilityReasonTaxableBasisReduced  InvoiceShippingCostTaxTaxabilityReason = "taxable_basis_reduced"
229
        InvoiceShippingCostTaxTaxabilityReasonZeroRated            InvoiceShippingCostTaxTaxabilityReason = "zero_rated"
230
)
231

232
// The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview)
233
type InvoiceStatus string
234

235
// List of values that InvoiceStatus can take
236
const (
237
        InvoiceStatusDraft         InvoiceStatus = "draft"
238
        InvoiceStatusOpen          InvoiceStatus = "open"
239
        InvoiceStatusPaid          InvoiceStatus = "paid"
240
        InvoiceStatusUncollectible InvoiceStatus = "uncollectible"
241
        InvoiceStatusVoid          InvoiceStatus = "void"
242
)
243

244
// The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
245
type InvoiceSubscriptionDetailsPauseCollectionBehavior string
246

247
// List of values that InvoiceSubscriptionDetailsPauseCollectionBehavior can take
248
const (
249
        InvoiceSubscriptionDetailsPauseCollectionBehaviorKeepAsDraft       InvoiceSubscriptionDetailsPauseCollectionBehavior = "keep_as_draft"
250
        InvoiceSubscriptionDetailsPauseCollectionBehaviorMarkUncollectible InvoiceSubscriptionDetailsPauseCollectionBehavior = "mark_uncollectible"
251
        InvoiceSubscriptionDetailsPauseCollectionBehaviorVoid              InvoiceSubscriptionDetailsPauseCollectionBehavior = "void"
252
)
253

254
// Type of the pretax credit amount referenced.
255
type InvoiceTotalPretaxCreditAmountType string
256

257
// List of values that InvoiceTotalPretaxCreditAmountType can take
258
const (
259
        InvoiceTotalPretaxCreditAmountTypeCreditBalanceTransaction InvoiceTotalPretaxCreditAmountType = "credit_balance_transaction"
260
        InvoiceTotalPretaxCreditAmountTypeDiscount                 InvoiceTotalPretaxCreditAmountType = "discount"
261
        InvoiceTotalPretaxCreditAmountTypeMargin                   InvoiceTotalPretaxCreditAmountType = "margin"
262
)
263

264
// The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
265
type InvoiceTotalTaxAmountTaxabilityReason string
266

267
// List of values that InvoiceTotalTaxAmountTaxabilityReason can take
268
const (
269
        InvoiceTotalTaxAmountTaxabilityReasonCustomerExempt       InvoiceTotalTaxAmountTaxabilityReason = "customer_exempt"
270
        InvoiceTotalTaxAmountTaxabilityReasonNotCollecting        InvoiceTotalTaxAmountTaxabilityReason = "not_collecting"
271
        InvoiceTotalTaxAmountTaxabilityReasonNotSubjectToTax      InvoiceTotalTaxAmountTaxabilityReason = "not_subject_to_tax"
272
        InvoiceTotalTaxAmountTaxabilityReasonNotSupported         InvoiceTotalTaxAmountTaxabilityReason = "not_supported"
273
        InvoiceTotalTaxAmountTaxabilityReasonPortionProductExempt InvoiceTotalTaxAmountTaxabilityReason = "portion_product_exempt"
274
        InvoiceTotalTaxAmountTaxabilityReasonPortionReducedRated  InvoiceTotalTaxAmountTaxabilityReason = "portion_reduced_rated"
275
        InvoiceTotalTaxAmountTaxabilityReasonPortionStandardRated InvoiceTotalTaxAmountTaxabilityReason = "portion_standard_rated"
276
        InvoiceTotalTaxAmountTaxabilityReasonProductExempt        InvoiceTotalTaxAmountTaxabilityReason = "product_exempt"
277
        InvoiceTotalTaxAmountTaxabilityReasonProductExemptHoliday InvoiceTotalTaxAmountTaxabilityReason = "product_exempt_holiday"
278
        InvoiceTotalTaxAmountTaxabilityReasonProportionallyRated  InvoiceTotalTaxAmountTaxabilityReason = "proportionally_rated"
279
        InvoiceTotalTaxAmountTaxabilityReasonReducedRated         InvoiceTotalTaxAmountTaxabilityReason = "reduced_rated"
280
        InvoiceTotalTaxAmountTaxabilityReasonReverseCharge        InvoiceTotalTaxAmountTaxabilityReason = "reverse_charge"
281
        InvoiceTotalTaxAmountTaxabilityReasonStandardRated        InvoiceTotalTaxAmountTaxabilityReason = "standard_rated"
282
        InvoiceTotalTaxAmountTaxabilityReasonTaxableBasisReduced  InvoiceTotalTaxAmountTaxabilityReason = "taxable_basis_reduced"
283
        InvoiceTotalTaxAmountTaxabilityReasonZeroRated            InvoiceTotalTaxAmountTaxabilityReason = "zero_rated"
284
)
285

286
// Permanently deletes a one-off invoice draft. This cannot be undone. Attempts to delete invoices that are no longer in a draft state will fail; once an invoice has been finalized or if an invoice is for a subscription, it must be [voided](https://stripe.com/docs/api#void_invoice).
287
type InvoiceParams struct {
288
        Params `form:"*"`
289
        // The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
290
        AccountTaxIDs []*string `form:"account_tax_ids"`
291
        // List of expected payments and corresponding due dates. Valid only for invoices where `collection_method=send_invoice`.
292
        AmountsDue []*InvoiceAmountsDueParams `form:"amounts_due"`
293
        // A fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account. The request must be made with an OAuth key or the Stripe-Account header in order to take an application fee. For more information, see the application fees [documentation](https://stripe.com/docs/billing/invoices/connect#collecting-fees).
294
        ApplicationFeeAmount *int64 `form:"application_fee_amount"`
295
        // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action.
296
        AutoAdvance *bool `form:"auto_advance"`
297
        // Settings for automatic tax lookup for this invoice.
298
        AutomaticTax *InvoiceAutomaticTaxParams `form:"automatic_tax"`
299
        // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions. Defaults to `charge_automatically`.
300
        CollectionMethod *string `form:"collection_method"`
301
        // The currency to create this invoice in. Defaults to that of `customer` if not specified.
302
        Currency *string `form:"currency"`
303
        // The ID of the customer who will be billed.
304
        Customer *string `form:"customer"`
305
        // A list of up to 4 custom fields to be displayed on the invoice. If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. Pass an empty string to remove previously-defined fields.
306
        CustomFields []*InvoiceCustomFieldParams `form:"custom_fields"`
307
        // The number of days from which the invoice is created until it is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices.
308
        DaysUntilDue *int64 `form:"days_until_due"`
309
        // The ids of the margins to apply to the invoice. Can be overridden by line item `margins`.
310
        DefaultMargins []*string `form:"default_margins"`
311
        // ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.
312
        DefaultPaymentMethod *string `form:"default_payment_method"`
313
        // ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
314
        DefaultSource *string `form:"default_source"`
315
        // The tax rates that will apply to any line item that does not have `tax_rates` set. Pass an empty string to remove previously-defined tax rates.
316
        DefaultTaxRates []*string `form:"default_tax_rates"`
317
        // An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.
318
        Description *string `form:"description"`
319
        // The coupons and promotion codes to redeem into discounts for the invoice. If not specified, inherits the discount from the invoice's customer. Pass an empty string to avoid inheriting any discounts.
320
        Discounts []*InvoiceDiscountParams `form:"discounts"`
321
        // The date on which payment for this invoice is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices.
322
        DueDate *int64 `form:"due_date"`
323
        // The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.
324
        EffectiveAt *int64 `form:"effective_at"`
325
        // Specifies which fields in the response should be expanded.
326
        Expand []*string `form:"expand"`
327
        // Footer to be displayed on the invoice.
328
        Footer *string `form:"footer"`
329
        // Revise an existing invoice. The new invoice will be created in `status=draft`. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
330
        FromInvoice *InvoiceFromInvoiceParams `form:"from_invoice"`
331
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
332
        Issuer *InvoiceIssuerParams `form:"issuer"`
333
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
334
        Metadata map[string]string `form:"metadata"`
335
        // Set the number for this invoice. If no number is present then a number will be assigned automatically when the invoice is finalized. In many markets, regulations require invoices to be unique, sequential and / or gapless. You are responsible for ensuring this is true across all your different invoicing systems in the event that you edit the invoice number using our API. If you use only Stripe for your invoices and do not change invoice numbers, Stripe handles this aspect of compliance for you automatically.
336
        Number *string `form:"number"`
337
        // 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](https://stripe.com/docs/billing/invoices/connect) documentation for details.
338
        OnBehalfOf *string `form:"on_behalf_of"`
339
        // Configuration settings for the PaymentIntent that is generated when the invoice is finalized.
340
        PaymentSettings *InvoicePaymentSettingsParams `form:"payment_settings"`
341
        // How to handle pending invoice items on invoice creation. Defaults to `exclude` if the parameter is omitted.
342
        PendingInvoiceItemsBehavior *string `form:"pending_invoice_items_behavior"`
343
        // The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
344
        Rendering *InvoiceRenderingParams `form:"rendering"`
345
        // Settings for the cost of shipping for this invoice.
346
        ShippingCost *InvoiceShippingCostParams `form:"shipping_cost"`
347
        // Shipping details for the invoice. The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
348
        ShippingDetails *InvoiceShippingDetailsParams `form:"shipping_details"`
349
        // Extra information about a charge for the customer's credit card statement. It must contain at least one letter. If not specified and this invoice is part of a subscription, the default `statement_descriptor` will be set to the first subscription item's product's `statement_descriptor`.
350
        StatementDescriptor *string `form:"statement_descriptor"`
351
        // The ID of the subscription to invoice, if any. If set, the created invoice will only include pending invoice items for that subscription. The subscription's billing cycle and regular subscription events won't be affected.
352
        Subscription *string `form:"subscription"`
353
        // If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. This will be unset if you POST an empty value.
354
        TransferData *InvoiceTransferDataParams `form:"transfer_data"`
355
}
356

357
// AddExpand appends a new field to expand.
UNCOV
358
func (p *InvoiceParams) AddExpand(f string) {
×
UNCOV
359
        p.Expand = append(p.Expand, &f)
×
UNCOV
360
}
×
361

362
// AddMetadata adds a new key-value pair to the Metadata.
363
func (p *InvoiceParams) AddMetadata(key string, value string) {
×
364
        if p.Metadata == nil {
×
365
                p.Metadata = make(map[string]string)
×
UNCOV
366
        }
×
367

368
        p.Metadata[key] = value
×
369
}
370

371
// List of expected payments and corresponding due dates. Valid only for invoices where `collection_method=send_invoice`.
372
type InvoiceAmountsDueParams struct {
373
        // The amount in cents (or local equivalent).
374
        Amount *int64 `form:"amount"`
375
        // Number of days from when invoice is finalized until the payment is due.
376
        DaysUntilDue *int64 `form:"days_until_due"`
377
        // An arbitrary string attached to the object. Often useful for displaying to users.
378
        Description *string `form:"description"`
379
        // Date on which a payment plan's payment is due.
380
        DueDate *int64 `form:"due_date"`
381
}
382

383
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
384
type InvoiceAutomaticTaxLiabilityParams struct {
385
        // The connected account being referenced when `type` is `account`.
386
        Account *string `form:"account"`
387
        // Type of the account referenced in the request.
388
        Type *string `form:"type"`
389
}
390

391
// Settings for automatic tax lookup for this invoice.
392
type InvoiceAutomaticTaxParams struct {
393
        // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices.
394
        Enabled *bool `form:"enabled"`
395
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
396
        Liability *InvoiceAutomaticTaxLiabilityParams `form:"liability"`
397
}
398

399
// A list of up to 4 custom fields to be displayed on the invoice. If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. Pass an empty string to remove previously-defined fields.
400
type InvoiceCustomFieldParams struct {
401
        // The name of the custom field. This may be up to 40 characters.
402
        Name *string `form:"name"`
403
        // The value of the custom field. This may be up to 140 characters.
404
        Value *string `form:"value"`
405
}
406

407
// Time span for the redeemed discount.
408
type InvoiceDiscountDiscountEndDurationParams struct {
409
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
410
        Interval *string `form:"interval"`
411
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
412
        IntervalCount *int64 `form:"interval_count"`
413
}
414

415
// Details to determine how long the discount should be applied for.
416
type InvoiceDiscountDiscountEndParams struct {
417
        // Time span for the redeemed discount.
418
        Duration *InvoiceDiscountDiscountEndDurationParams `form:"duration"`
419
        // A precise Unix timestamp for the discount to end. Must be in the future.
420
        Timestamp *int64 `form:"timestamp"`
421
        // The type of calculation made to determine when the discount ends.
422
        Type *string `form:"type"`
423
}
424

425
// The discounts that will apply to the invoice. Pass an empty string to remove previously-defined discounts.
426
type InvoiceDiscountParams struct {
427
        // ID of the coupon to create a new discount for.
428
        Coupon *string `form:"coupon"`
429
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
430
        Discount *string `form:"discount"`
431
        // Details to determine how long the discount should be applied for.
432
        DiscountEnd *InvoiceDiscountDiscountEndParams `form:"discount_end"`
433
        // ID of the promotion code to create a new discount for.
434
        PromotionCode *string `form:"promotion_code"`
435
}
436

437
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
438
type InvoiceIssuerParams struct {
439
        // The connected account being referenced when `type` is `account`.
440
        Account *string `form:"account"`
441
        // Type of the account referenced in the request.
442
        Type *string `form:"type"`
443
}
444

445
// Additional fields for Mandate creation
446
type InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsParams struct {
447
        // Transaction type of the mandate.
448
        TransactionType *string `form:"transaction_type"`
449
}
450

451
// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice's PaymentIntent.
452
type InvoicePaymentSettingsPaymentMethodOptionsACSSDebitParams struct {
453
        // Additional fields for Mandate creation
454
        MandateOptions *InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsParams `form:"mandate_options"`
455
        // Verification method for the intent
456
        VerificationMethod *string `form:"verification_method"`
457
}
458

459
// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent.
460
type InvoicePaymentSettingsPaymentMethodOptionsBancontactParams struct {
461
        // Preferred language of the Bancontact authorization page that the customer is redirected to.
462
        PreferredLanguage *string `form:"preferred_language"`
463
}
464

465
// The selected installment plan to use for this invoice.
466
type InvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanParams struct {
467
        // For `fixed_count` installment plans, this is required. It represents the number of installment payments your customer will make to their credit card.
468
        Count *int64 `form:"count"`
469
        // For `fixed_count` installment plans, this is required. It represents the interval between installment payments your customer will make to their credit card.
470
        // One of `month`.
471
        Interval *string `form:"interval"`
472
        // Type of installment plan, one of `fixed_count`.
473
        Type *string `form:"type"`
474
}
475

476
// Installment configuration for payments attempted on this invoice (Mexico Only).
477
//
478
// For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments).
479
type InvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsParams struct {
480
        // Setting to true enables installments for this invoice.
481
        // Setting to false will prevent any selected plan from applying to a payment.
482
        Enabled *bool `form:"enabled"`
483
        // The selected installment plan to use for this invoice.
484
        Plan *InvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsPlanParams `form:"plan"`
485
}
486

487
// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice's PaymentIntent.
488
type InvoicePaymentSettingsPaymentMethodOptionsCardParams struct {
489
        // Installment configuration for payments attempted on this invoice (Mexico Only).
490
        //
491
        // For more information, see the [installments integration guide](https://stripe.com/docs/payments/installments).
492
        Installments *InvoicePaymentSettingsPaymentMethodOptionsCardInstallmentsParams `form:"installments"`
493
        // We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
494
        RequestThreeDSecure *string `form:"request_three_d_secure"`
495
}
496

497
// Configuration for eu_bank_transfer funding type.
498
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEUBankTransferParams struct {
499
        // The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
500
        Country *string `form:"country"`
501
}
502

503
// Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
504
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferParams struct {
505
        // Configuration for eu_bank_transfer funding type.
506
        EUBankTransfer *InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEUBankTransferParams `form:"eu_bank_transfer"`
507
        // The bank transfer type that can be used for funding. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
508
        Type *string `form:"type"`
509
}
510

511
// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice's PaymentIntent.
512
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceParams struct {
513
        // Configuration for the bank transfer funding type, if the `funding_type` is set to `bank_transfer`.
514
        BankTransfer *InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferParams `form:"bank_transfer"`
515
        // The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
516
        FundingType *string `form:"funding_type"`
517
}
518

519
// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice's PaymentIntent.
520
type InvoicePaymentSettingsPaymentMethodOptionsKonbiniParams struct{}
521

522
// If paying by `sepa_debit`, this sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice's PaymentIntent.
523
type InvoicePaymentSettingsPaymentMethodOptionsSEPADebitParams struct{}
524

525
// Provide filters for the linked accounts that the customer can select for the payment method.
526
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersParams struct {
527
        // The account subcategories to use to filter for selectable accounts. Valid subcategories are `checking` and `savings`.
528
        AccountSubcategories []*string `form:"account_subcategories"`
529
        // ID of the institution to use to filter for selectable accounts.
530
        Institution *string `form:"institution"`
531
}
532

533
// Additional fields for Financial Connections Session creation
534
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
535
        // Provide filters for the linked accounts that the customer can select for the payment method.
536
        Filters *InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersParams `form:"filters"`
537
        // The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `ownership`, `payment_method`, and `transactions`.
538
        Permissions []*string `form:"permissions"`
539
        // List of data features that you would like to retrieve upon account creation.
540
        Prefetch []*string `form:"prefetch"`
541
}
542

543
// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice's PaymentIntent.
544
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountParams struct {
545
        // Additional fields for Financial Connections Session creation
546
        FinancialConnections *InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsParams `form:"financial_connections"`
547
        // Verification method for the intent
548
        VerificationMethod *string `form:"verification_method"`
549
}
550

551
// Payment-method-specific configuration to provide to the invoice's PaymentIntent.
552
type InvoicePaymentSettingsPaymentMethodOptionsParams struct {
553
        // If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice's PaymentIntent.
554
        ACSSDebit *InvoicePaymentSettingsPaymentMethodOptionsACSSDebitParams `form:"acss_debit"`
555
        // If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent.
556
        Bancontact *InvoicePaymentSettingsPaymentMethodOptionsBancontactParams `form:"bancontact"`
557
        // If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice's PaymentIntent.
558
        Card *InvoicePaymentSettingsPaymentMethodOptionsCardParams `form:"card"`
559
        // If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice's PaymentIntent.
560
        CustomerBalance *InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceParams `form:"customer_balance"`
561
        // If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice's PaymentIntent.
562
        Konbini *InvoicePaymentSettingsPaymentMethodOptionsKonbiniParams `form:"konbini"`
563
        // If paying by `sepa_debit`, this sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice's PaymentIntent.
564
        SEPADebit *InvoicePaymentSettingsPaymentMethodOptionsSEPADebitParams `form:"sepa_debit"`
565
        // If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice's PaymentIntent.
566
        USBankAccount *InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountParams `form:"us_bank_account"`
567
}
568

569
// Configuration settings for the PaymentIntent that is generated when the invoice is finalized.
570
type InvoicePaymentSettingsParams struct {
571
        // ID of the mandate to be used for this invoice. It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set.
572
        DefaultMandate *string `form:"default_mandate"`
573
        // Payment-method-specific configuration to provide to the invoice's PaymentIntent.
574
        PaymentMethodOptions *InvoicePaymentSettingsPaymentMethodOptionsParams `form:"payment_method_options"`
575
        // The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice).
576
        PaymentMethodTypes []*string `form:"payment_method_types"`
577
}
578

579
// Invoice pdf rendering options
580
type InvoiceRenderingPDFParams struct {
581
        // Page size for invoice PDF. Can be set to `a4`, `letter`, or `auto`.
582
        //  If set to `auto`, invoice PDF page size defaults to `a4` for customers with
583
        //  Japanese locale and `letter` for customers with other locales.
584
        PageSize *string `form:"page_size"`
585
}
586

587
// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
588
type InvoiceRenderingParams struct {
589
        // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs. One of `exclude_tax` or `include_inclusive_tax`. `include_inclusive_tax` will include inclusive tax (and exclude exclusive tax) in invoice PDF amounts. `exclude_tax` will exclude all tax (inclusive and exclusive alike) from invoice PDF amounts.
590
        AmountTaxDisplay *string `form:"amount_tax_display"`
591
        // Invoice pdf rendering options
592
        PDF *InvoiceRenderingPDFParams `form:"pdf"`
593
        // ID of the invoice rendering template to use for this invoice.
594
        Template *string `form:"template"`
595
        // The specific version of invoice rendering template to use for this invoice.
596
        TemplateVersion *int64 `form:"template_version"`
597
}
598

599
// The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
600
type InvoiceShippingCostShippingRateDataDeliveryEstimateMaximumParams struct {
601
        // A unit of time.
602
        Unit *string `form:"unit"`
603
        // Must be greater than 0.
604
        Value *int64 `form:"value"`
605
}
606

607
// The lower bound of the estimated range. If empty, represents no lower bound.
608
type InvoiceShippingCostShippingRateDataDeliveryEstimateMinimumParams struct {
609
        // A unit of time.
610
        Unit *string `form:"unit"`
611
        // Must be greater than 0.
612
        Value *int64 `form:"value"`
613
}
614

615
// The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
616
type InvoiceShippingCostShippingRateDataDeliveryEstimateParams struct {
617
        // The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite.
618
        Maximum *InvoiceShippingCostShippingRateDataDeliveryEstimateMaximumParams `form:"maximum"`
619
        // The lower bound of the estimated range. If empty, represents no lower bound.
620
        Minimum *InvoiceShippingCostShippingRateDataDeliveryEstimateMinimumParams `form:"minimum"`
621
}
622

623
// Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
624
type InvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsParams struct {
625
        // A non-negative integer in cents representing how much to charge.
626
        Amount *int64 `form:"amount"`
627
        // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
628
        TaxBehavior *string `form:"tax_behavior"`
629
}
630

631
// Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`.
632
type InvoiceShippingCostShippingRateDataFixedAmountParams struct {
633
        // A non-negative integer in cents representing how much to charge.
634
        Amount *int64 `form:"amount"`
635
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
636
        Currency *string `form:"currency"`
637
        // Shipping rates defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
638
        CurrencyOptions map[string]*InvoiceShippingCostShippingRateDataFixedAmountCurrencyOptionsParams `form:"currency_options"`
639
}
640

641
// Parameters to create a new ad-hoc shipping rate for this order.
642
type InvoiceShippingCostShippingRateDataParams struct {
643
        // The estimated range for how long shipping will take, meant to be displayable to the customer. This will appear on CheckoutSessions.
644
        DeliveryEstimate *InvoiceShippingCostShippingRateDataDeliveryEstimateParams `form:"delivery_estimate"`
645
        // The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions.
646
        DisplayName *string `form:"display_name"`
647
        // Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`.
648
        FixedAmount *InvoiceShippingCostShippingRateDataFixedAmountParams `form:"fixed_amount"`
649
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
650
        Metadata map[string]string `form:"metadata"`
651
        // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`.
652
        TaxBehavior *string `form:"tax_behavior"`
653
        // A [tax code](https://stripe.com/docs/tax/tax-categories) ID. The Shipping tax code is `txcd_92010001`.
654
        TaxCode *string `form:"tax_code"`
655
        // The type of calculation to use on the shipping rate.
656
        Type *string `form:"type"`
657
}
658

659
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
660
func (p *InvoiceShippingCostShippingRateDataParams) AddMetadata(key string, value string) {
×
UNCOV
661
        if p.Metadata == nil {
×
UNCOV
662
                p.Metadata = make(map[string]string)
×
UNCOV
663
        }
×
664

665
        p.Metadata[key] = value
×
666
}
667

668
// Settings for the cost of shipping for this invoice.
669
type InvoiceShippingCostParams struct {
670
        // The ID of the shipping rate to use for this order.
671
        ShippingRate *string `form:"shipping_rate"`
672
        // Parameters to create a new ad-hoc shipping rate for this order.
673
        ShippingRateData *InvoiceShippingCostShippingRateDataParams `form:"shipping_rate_data"`
674
}
675

676
// Shipping details for the invoice. The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
677
type InvoiceShippingDetailsParams struct {
678
        // Shipping address
679
        Address *AddressParams `form:"address"`
680
        // Recipient name.
681
        Name *string `form:"name"`
682
        // Recipient phone (including extension)
683
        Phone *string `form:"phone"`
684
}
685

686
// If specified, the funds from the invoice will be transferred to the destination and the ID of the resulting transfer will be found on the invoice's charge. This will be unset if you POST an empty value.
687
type InvoiceTransferDataParams struct {
688
        // The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred.
689
        Amount *int64 `form:"amount"`
690
        // ID of an existing, connected Stripe account.
691
        Destination *string `form:"destination"`
692
}
693

694
// You can list all invoices, or list the invoices for a specific customer. The invoices are returned sorted by creation date, with the most recently created invoices appearing first.
695
type InvoiceListParams struct {
696
        ListParams `form:"*"`
697
        // The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`.
698
        CollectionMethod *string `form:"collection_method"`
699
        // Only return invoices that were created during the given date interval.
700
        Created *int64 `form:"created"`
701
        // Only return invoices that were created during the given date interval.
702
        CreatedRange *RangeQueryParams `form:"created"`
703
        // Only return invoices for the customer specified by this customer ID.
704
        Customer     *string           `form:"customer"`
705
        DueDate      *int64            `form:"due_date"`
706
        DueDateRange *RangeQueryParams `form:"due_date"`
707
        // Specifies which fields in the response should be expanded.
708
        Expand []*string `form:"expand"`
709
        // The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview)
710
        Status *string `form:"status"`
711
        // Only return invoices for the subscription specified by this subscription ID.
712
        Subscription *string `form:"subscription"`
713
}
714

715
// AddExpand appends a new field to expand.
UNCOV
716
func (p *InvoiceListParams) AddExpand(f string) {
×
UNCOV
717
        p.Expand = append(p.Expand, &f)
×
UNCOV
718
}
×
719

720
// Revise an existing invoice. The new invoice will be created in `status=draft`. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
721
type InvoiceFromInvoiceParams struct {
722
        // The relation between the new invoice and the original invoice. Currently, only 'revision' is permitted
723
        Action *string `form:"action"`
724
        // The `id` of the invoice that will be cloned.
725
        Invoice *string `form:"invoice"`
726
}
727

728
// Search for invoices you've previously created using Stripe's [Search Query Language](https://stripe.com/docs/search#search-query-language).
729
// Don't use search in read-after-write flows where strict consistency is necessary. Under normal operating
730
// conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
731
// to an hour behind during outages. Search functionality is not available to merchants in India.
732
type InvoiceSearchParams struct {
733
        SearchParams `form:"*"`
734
        // Specifies which fields in the response should be expanded.
735
        Expand []*string `form:"expand"`
736
        // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
737
        Page *string `form:"page"`
738
}
739

740
// AddExpand appends a new field to expand.
UNCOV
741
func (p *InvoiceSearchParams) AddExpand(f string) {
×
UNCOV
742
        p.Expand = append(p.Expand, &f)
×
UNCOV
743
}
×
744

745
type InvoiceUpcomingAutomaticTaxParams struct {
746
        Enabled *bool `form:"enabled"`
747
}
748

749
// The customer's shipping information. Appears on invoices emailed to this customer.
750
type InvoiceUpcomingCustomerDetailsShippingParams struct {
751
        // Customer shipping address.
752
        Address *AddressParams `form:"address"`
753
        // Customer name.
754
        Name *string `form:"name"`
755
        // Customer phone (including extension).
756
        Phone *string `form:"phone"`
757
}
758

759
// Tax details about the customer.
760
type InvoiceUpcomingCustomerDetailsTaxParams struct {
761
        // A recent IP address of the customer used for tax reporting and tax location inference. Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
762
        IPAddress *string `form:"ip_address"`
763
}
764

765
// The customer's tax IDs.
766
type InvoiceUpcomingCustomerDetailsTaxIDParams struct {
767
        // Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `ma_vat`, `md_vat`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, or `za_vat`
768
        Type *string `form:"type"`
769
        // Value of the tax ID.
770
        Value *string `form:"value"`
771
}
772

773
// 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.
774
type InvoiceUpcomingCustomerDetailsParams struct {
775
        // The customer's address.
776
        Address *AddressParams `form:"address"`
777
        // The customer's shipping information. Appears on invoices emailed to this customer.
778
        Shipping *InvoiceUpcomingCustomerDetailsShippingParams `form:"shipping"`
779
        // Tax details about the customer.
780
        Tax *InvoiceUpcomingCustomerDetailsTaxParams `form:"tax"`
781
        // The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
782
        TaxExempt *string `form:"tax_exempt"`
783
        // The customer's tax IDs.
784
        TaxIDs []*InvoiceUpcomingCustomerDetailsTaxIDParams `form:"tax_ids"`
785
}
786

787
// The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
788
type InvoiceUpcomingInvoiceItemPeriodParams struct {
789
        // The end of the period, which must be greater than or equal to the start. This value is inclusive.
790
        End *int64 `form:"end"`
791
        // The start of the period. This value is inclusive.
792
        Start *int64 `form:"start"`
793
}
794

795
// List of invoice items to add or update in the upcoming invoice preview (up to 250).
796
type InvoiceUpcomingInvoiceItemParams struct {
797
        // The integer amount in cents (or local equivalent) of previewed invoice item.
798
        Amount *int64 `form:"amount"`
799
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Only applicable to new invoice items.
800
        Currency *string `form:"currency"`
801
        // An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
802
        Description *string `form:"description"`
803
        // Explicitly controls whether discounts apply to this invoice item. Defaults to true, except for negative invoice items.
804
        Discountable *bool `form:"discountable"`
805
        // The coupons to redeem into discounts for the invoice item in the preview.
806
        Discounts []*InvoiceItemDiscountParams `form:"discounts"`
807
        // The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice.
808
        InvoiceItem *string `form:"invoiceitem"`
809
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
810
        Metadata map[string]string `form:"metadata"`
811
        // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
812
        Period *InvoiceUpcomingInvoiceItemPeriodParams `form:"period"`
813
        // The ID of the price object. One of `price` or `price_data` is required.
814
        Price *string `form:"price"`
815
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
816
        PriceData *InvoiceItemPriceDataParams `form:"price_data"`
817
        // Non-negative integer. The quantity of units for the invoice item.
818
        Quantity *int64 `form:"quantity"`
819
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
820
        TaxBehavior *string `form:"tax_behavior"`
821
        // A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
822
        TaxCode *string `form:"tax_code"`
823
        // The tax rates that apply to the item. When set, any `default_tax_rates` do not apply to this item.
824
        TaxRates []*string `form:"tax_rates"`
825
        // The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount.
826
        UnitAmount *int64 `form:"unit_amount"`
827
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
828
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
829
}
830

831
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
832
func (p *InvoiceUpcomingInvoiceItemParams) AddMetadata(key string, value string) {
×
UNCOV
833
        if p.Metadata == nil {
×
UNCOV
834
                p.Metadata = make(map[string]string)
×
UNCOV
835
        }
×
836

837
        p.Metadata[key] = value
×
838
}
839

840
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
841
type InvoiceUpcomingIssuerParams struct {
842
        // The connected account being referenced when `type` is `account`.
843
        Account *string `form:"account"`
844
        // Type of the account referenced in the request.
845
        Type *string `form:"type"`
846
}
847

848
// Use the `end` time of a given discount.
849
type InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndDiscountEndParams struct {
850
        // The ID of a specific discount.
851
        Discount *string `form:"discount"`
852
}
853

854
// Time span for the amendment starting from the `amendment_start`.
855
type InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndDurationParams struct {
856
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
857
        Interval *string `form:"interval"`
858
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
859
        IntervalCount *int64 `form:"interval_count"`
860
}
861

862
// Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
863
type InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndParams struct {
864
        // Use the `end` time of a given discount.
865
        DiscountEnd *InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndDiscountEndParams `form:"discount_end"`
866
        // Time span for the amendment starting from the `amendment_start`.
867
        Duration *InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndDurationParams `form:"duration"`
868
        // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`.
869
        Timestamp *int64 `form:"timestamp"`
870
        // Select one of three ways to pass the `amendment_end`.
871
        Type *string `form:"type"`
872
}
873

874
// Details of another amendment in the same array, immediately after which this amendment should begin.
875
type InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartAmendmentEndParams struct {
876
        // The position of the previous amendment in the `amendments` array after which this amendment should begin. Indexes start from 0 and must be less than the index of the current amendment in the array.
877
        Index *int64 `form:"index"`
878
}
879

880
// Use the `end` time of a given discount.
881
type InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartDiscountEndParams struct {
882
        // The ID of a specific discount.
883
        Discount *string `form:"discount"`
884
}
885

886
// Details to identify the earliest timestamp where the proposed change should take effect.
887
type InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartParams struct {
888
        // Details of another amendment in the same array, immediately after which this amendment should begin.
889
        AmendmentEnd *InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartAmendmentEndParams `form:"amendment_end"`
890
        // Use the `end` time of a given discount.
891
        DiscountEnd *InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartDiscountEndParams `form:"discount_end"`
892
        // A precise Unix timestamp for the amendment to start.
893
        Timestamp *int64 `form:"timestamp"`
894
        // Select one of three ways to pass the `amendment_start`.
895
        Type *string `form:"type"`
896
}
897

898
// Details to determine how long the discount should be applied for.
899
type InvoiceUpcomingScheduleDetailsAmendmentDiscountActionAddDiscountEndParams struct {
900
        // The type of calculation made to determine when the discount ends.
901
        Type *string `form:"type"`
902
}
903

904
// Details of the discount to add.
905
type InvoiceUpcomingScheduleDetailsAmendmentDiscountActionAddParams struct {
906
        // The coupon code to redeem.
907
        Coupon *string `form:"coupon"`
908
        // An ID of an existing discount for a coupon that was already redeemed.
909
        Discount *string `form:"discount"`
910
        // Details to determine how long the discount should be applied for.
911
        DiscountEnd *InvoiceUpcomingScheduleDetailsAmendmentDiscountActionAddDiscountEndParams `form:"discount_end"`
912
        // The index, starting at 0, at which to position the new discount. When not supplied, Stripe defaults to appending the discount to the end of the `discounts` array.
913
        Index *int64 `form:"index"`
914
        // The promotion code to redeem.
915
        PromotionCode *string `form:"promotion_code"`
916
}
917

918
// Details of the discount to remove.
919
type InvoiceUpcomingScheduleDetailsAmendmentDiscountActionRemoveParams struct {
920
        // The coupon code to remove from the `discounts` array.
921
        Coupon *string `form:"coupon"`
922
        // The ID of a discount to remove from the `discounts` array.
923
        Discount *string `form:"discount"`
924
        // The ID of a promotion code to remove from the `discounts` array.
925
        PromotionCode *string `form:"promotion_code"`
926
}
927

928
// Details of the discount to replace the existing discounts with.
929
type InvoiceUpcomingScheduleDetailsAmendmentDiscountActionSetParams struct {
930
        // The coupon code to replace the `discounts` array with.
931
        Coupon *string `form:"coupon"`
932
        // An ID of an existing discount to replace the `discounts` array with.
933
        Discount *string `form:"discount"`
934
        // An ID of an existing promotion code to replace the `discounts` array with.
935
        PromotionCode *string `form:"promotion_code"`
936
}
937

938
// Changes to the coupons being redeemed or discounts being applied during the amendment time span.
939
type InvoiceUpcomingScheduleDetailsAmendmentDiscountActionParams struct {
940
        // Details of the discount to add.
941
        Add *InvoiceUpcomingScheduleDetailsAmendmentDiscountActionAddParams `form:"add"`
942
        // Details of the discount to remove.
943
        Remove *InvoiceUpcomingScheduleDetailsAmendmentDiscountActionRemoveParams `form:"remove"`
944
        // Details of the discount to replace the existing discounts with.
945
        Set *InvoiceUpcomingScheduleDetailsAmendmentDiscountActionSetParams `form:"set"`
946
        // Determines the type of discount action.
947
        Type *string `form:"type"`
948
}
949

950
// Time span for the redeemed discount.
951
type InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams struct {
952
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
953
        Interval *string `form:"interval"`
954
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
955
        IntervalCount *int64 `form:"interval_count"`
956
}
957

958
// Details to determine how long the discount should be applied for.
959
type InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountDiscountEndParams struct {
960
        // Time span for the redeemed discount.
961
        Duration *InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"`
962
        // A precise Unix timestamp for the discount to end. Must be in the future.
963
        Timestamp *int64 `form:"timestamp"`
964
        // The type of calculation made to determine when the discount ends.
965
        Type *string `form:"type"`
966
}
967

968
// The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
969
type InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountParams struct {
970
        // ID of the coupon to create a new discount for.
971
        Coupon *string `form:"coupon"`
972
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
973
        Discount *string `form:"discount"`
974
        // Details to determine how long the discount should be applied for.
975
        DiscountEnd *InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountDiscountEndParams `form:"discount_end"`
976
        // ID of the promotion code to create a new discount for.
977
        PromotionCode *string `form:"promotion_code"`
978
}
979

980
// Options that configure the trial on the subscription item.
981
type InvoiceUpcomingScheduleDetailsAmendmentItemActionAddTrialParams struct {
982
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
983
        ConvertsTo []*string `form:"converts_to"`
984
        // Determines the type of trial for this item.
985
        Type *string `form:"type"`
986
}
987

988
// Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
989
type InvoiceUpcomingScheduleDetailsAmendmentItemActionAddParams struct {
990
        // The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
991
        Discounts []*InvoiceUpcomingScheduleDetailsAmendmentItemActionAddDiscountParams `form:"discounts"`
992
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
993
        Metadata map[string]string `form:"metadata"`
994
        // The ID of the price object.
995
        Price *string `form:"price"`
996
        // Quantity for this item.
997
        Quantity *int64 `form:"quantity"`
998
        // The tax rates that apply to this subscription item. When set, the `default_tax_rates` on the subscription do not apply to this `subscription_item`.
999
        TaxRates []*string `form:"tax_rates"`
1000
        // Options that configure the trial on the subscription item.
1001
        Trial *InvoiceUpcomingScheduleDetailsAmendmentItemActionAddTrialParams `form:"trial"`
1002
}
1003

1004
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
1005
func (p *InvoiceUpcomingScheduleDetailsAmendmentItemActionAddParams) AddMetadata(key string, value string) {
×
UNCOV
1006
        if p.Metadata == nil {
×
UNCOV
1007
                p.Metadata = make(map[string]string)
×
UNCOV
1008
        }
×
1009

1010
        p.Metadata[key] = value
×
1011
}
1012

1013
// Details of the subscription item to remove.
1014
type InvoiceUpcomingScheduleDetailsAmendmentItemActionRemoveParams struct {
1015
        // ID of a price to remove.
1016
        Price *string `form:"price"`
1017
}
1018

1019
// Time span for the redeemed discount.
1020
type InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams struct {
1021
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1022
        Interval *string `form:"interval"`
1023
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1024
        IntervalCount *int64 `form:"interval_count"`
1025
}
1026

1027
// Details to determine how long the discount should be applied for.
1028
type InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountDiscountEndParams struct {
1029
        // Time span for the redeemed discount.
1030
        Duration *InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"`
1031
        // A precise Unix timestamp for the discount to end. Must be in the future.
1032
        Timestamp *int64 `form:"timestamp"`
1033
        // The type of calculation made to determine when the discount ends.
1034
        Type *string `form:"type"`
1035
}
1036

1037
// If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
1038
type InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountParams struct {
1039
        // ID of the coupon to create a new discount for.
1040
        Coupon *string `form:"coupon"`
1041
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1042
        Discount *string `form:"discount"`
1043
        // Details to determine how long the discount should be applied for.
1044
        DiscountEnd *InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountDiscountEndParams `form:"discount_end"`
1045
        // ID of the promotion code to create a new discount for.
1046
        PromotionCode *string `form:"promotion_code"`
1047
}
1048

1049
// If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
1050
type InvoiceUpcomingScheduleDetailsAmendmentItemActionSetTrialParams struct {
1051
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
1052
        ConvertsTo []*string `form:"converts_to"`
1053
        // Determines the type of trial for this item.
1054
        Type *string `form:"type"`
1055
}
1056

1057
// Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
1058
type InvoiceUpcomingScheduleDetailsAmendmentItemActionSetParams struct {
1059
        // If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
1060
        Discounts []*InvoiceUpcomingScheduleDetailsAmendmentItemActionSetDiscountParams `form:"discounts"`
1061
        // If an item with the `price` already exists, passing this will override the `metadata` on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `metadata`.
1062
        Metadata map[string]string `form:"metadata"`
1063
        // The ID of the price object.
1064
        Price *string `form:"price"`
1065
        // If an item with the `price` already exists, passing this will override the quantity on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `quantity`.
1066
        Quantity *int64 `form:"quantity"`
1067
        // If an item with the `price` already exists, passing this will override the `tax_rates` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `tax_rates`.
1068
        TaxRates []*string `form:"tax_rates"`
1069
        // If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
1070
        Trial *InvoiceUpcomingScheduleDetailsAmendmentItemActionSetTrialParams `form:"trial"`
1071
}
1072

1073
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
1074
func (p *InvoiceUpcomingScheduleDetailsAmendmentItemActionSetParams) AddMetadata(key string, value string) {
×
UNCOV
1075
        if p.Metadata == nil {
×
UNCOV
1076
                p.Metadata = make(map[string]string)
×
UNCOV
1077
        }
×
1078

1079
        p.Metadata[key] = value
×
1080
}
1081

1082
// Changes to the subscription items during the amendment time span.
1083
type InvoiceUpcomingScheduleDetailsAmendmentItemActionParams struct {
1084
        // Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
1085
        Add *InvoiceUpcomingScheduleDetailsAmendmentItemActionAddParams `form:"add"`
1086
        // Details of the subscription item to remove.
1087
        Remove *InvoiceUpcomingScheduleDetailsAmendmentItemActionRemoveParams `form:"remove"`
1088
        // Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
1089
        Set *InvoiceUpcomingScheduleDetailsAmendmentItemActionSetParams `form:"set"`
1090
        // Determines the type of item action.
1091
        Type *string `form:"type"`
1092
}
1093

1094
// Instructions for how to modify phase metadata
1095
type InvoiceUpcomingScheduleDetailsAmendmentMetadataActionParams struct {
1096
        // Key-value pairs to add to schedule phase metadata. These values will merge with existing schedule phase metadata.
1097
        Add map[string]string `form:"add"`
1098
        // Keys to remove from schedule phase metadata.
1099
        Remove []*string `form:"remove"`
1100
        // Key-value pairs to set as schedule phase metadata. Existing schedule phase metadata will be overwritten.
1101
        Set map[string]string `form:"set"`
1102
        // Select one of three ways to update phase-level `metadata` on subscription schedules.
1103
        Type *string `form:"type"`
1104
}
1105

1106
// Details of the pause_collection behavior to apply to the amendment.
1107
type InvoiceUpcomingScheduleDetailsAmendmentSetPauseCollectionSetParams struct {
1108
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
1109
        Behavior *string `form:"behavior"`
1110
}
1111

1112
// Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
1113
type InvoiceUpcomingScheduleDetailsAmendmentSetPauseCollectionParams struct {
1114
        // Details of the pause_collection behavior to apply to the amendment.
1115
        Set *InvoiceUpcomingScheduleDetailsAmendmentSetPauseCollectionSetParams `form:"set"`
1116
        // Determines the type of the pause_collection amendment.
1117
        Type *string `form:"type"`
1118
}
1119

1120
// Defines how the subscription should behave when a trial ends.
1121
type InvoiceUpcomingScheduleDetailsAmendmentTrialSettingsEndBehaviorParams struct {
1122
        // Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
1123
        ProrateUpFront *string `form:"prorate_up_front"`
1124
}
1125

1126
// Settings related to subscription trials.
1127
type InvoiceUpcomingScheduleDetailsAmendmentTrialSettingsParams struct {
1128
        // Defines how the subscription should behave when a trial ends.
1129
        EndBehavior *InvoiceUpcomingScheduleDetailsAmendmentTrialSettingsEndBehaviorParams `form:"end_behavior"`
1130
}
1131

1132
// Changes to apply to the phases of the subscription schedule, in the order provided.
1133
type InvoiceUpcomingScheduleDetailsAmendmentParams struct {
1134
        // Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
1135
        AmendmentEnd *InvoiceUpcomingScheduleDetailsAmendmentAmendmentEndParams `form:"amendment_end"`
1136
        // Details to identify the earliest timestamp where the proposed change should take effect.
1137
        AmendmentStart *InvoiceUpcomingScheduleDetailsAmendmentAmendmentStartParams `form:"amendment_start"`
1138
        // For point-in-time amendments (having no `amendment_end`), this attribute lets you set or remove whether the subscription's billing cycle anchor is reset at the `amendment_start` timestamp.For time-span based amendments (having both `amendment_start` and `amendment_end`), the only value valid is `automatic`, which removes any previously configured billing cycle anchor resets scheduled to occur during the window of time spanned by the amendment.
1139
        BillingCycleAnchor *string `form:"billing_cycle_anchor"`
1140
        // Changes to the coupons being redeemed or discounts being applied during the amendment time span.
1141
        DiscountActions []*InvoiceUpcomingScheduleDetailsAmendmentDiscountActionParams `form:"discount_actions"`
1142
        // Changes to the subscription items during the amendment time span.
1143
        ItemActions []*InvoiceUpcomingScheduleDetailsAmendmentItemActionParams `form:"item_actions"`
1144
        // Instructions for how to modify phase metadata
1145
        MetadataActions []*InvoiceUpcomingScheduleDetailsAmendmentMetadataActionParams `form:"metadata_actions"`
1146
        // Changes to how Stripe handles prorations during the amendment time span. Affects if and how prorations are created when a future phase starts. In cases where the amendment changes the currently active phase, it is used to determine whether or how to prorate now, at the time of the request. Also supported as a point-in-time operation when `amendment_end` is `null`.
1147
        ProrationBehavior *string `form:"proration_behavior"`
1148
        // Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
1149
        SetPauseCollection *InvoiceUpcomingScheduleDetailsAmendmentSetPauseCollectionParams `form:"set_pause_collection"`
1150
        // Ends the subscription schedule early as dictated by either the accompanying amendment's start or end.
1151
        SetScheduleEnd *string `form:"set_schedule_end"`
1152
        // Settings related to subscription trials.
1153
        TrialSettings *InvoiceUpcomingScheduleDetailsAmendmentTrialSettingsParams `form:"trial_settings"`
1154
}
1155

1156
// Time span for the redeemed discount.
1157
type InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams struct {
1158
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1159
        Interval *string `form:"interval"`
1160
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1161
        IntervalCount *int64 `form:"interval_count"`
1162
}
1163

1164
// Details to determine how long the discount should be applied for.
1165
type InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams struct {
1166
        // Time span for the redeemed discount.
1167
        Duration *InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"`
1168
        // A precise Unix timestamp for the discount to end. Must be in the future.
1169
        Timestamp *int64 `form:"timestamp"`
1170
        // The type of calculation made to determine when the discount ends.
1171
        Type *string `form:"type"`
1172
}
1173

1174
// The coupons to redeem into discounts for the item.
1175
type InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountParams struct {
1176
        // ID of the coupon to create a new discount for.
1177
        Coupon *string `form:"coupon"`
1178
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1179
        Discount *string `form:"discount"`
1180
        // Details to determine how long the discount should be applied for.
1181
        DiscountEnd *InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams `form:"discount_end"`
1182
        // ID of the promotion code to create a new discount for.
1183
        PromotionCode *string `form:"promotion_code"`
1184
}
1185

1186
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1187
type InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemPriceDataParams struct {
1188
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1189
        Currency *string `form:"currency"`
1190
        // The ID of the product that this price will belong to.
1191
        Product *string `form:"product"`
1192
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1193
        TaxBehavior *string `form:"tax_behavior"`
1194
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer.
1195
        UnitAmount *int64 `form:"unit_amount"`
1196
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1197
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
1198
}
1199

1200
// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
1201
type InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemParams struct {
1202
        // The coupons to redeem into discounts for the item.
1203
        Discounts []*InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemDiscountParams `form:"discounts"`
1204
        // The ID of the price object. One of `price` or `price_data` is required.
1205
        Price *string `form:"price"`
1206
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1207
        PriceData *InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemPriceDataParams `form:"price_data"`
1208
        // Quantity for this item. Defaults to 1.
1209
        Quantity *int64 `form:"quantity"`
1210
        // The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
1211
        TaxRates []*string `form:"tax_rates"`
1212
}
1213

1214
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1215
type InvoiceUpcomingScheduleDetailsPhaseAutomaticTaxLiabilityParams struct {
1216
        // The connected account being referenced when `type` is `account`.
1217
        Account *string `form:"account"`
1218
        // Type of the account referenced in the request.
1219
        Type *string `form:"type"`
1220
}
1221

1222
// Automatic tax settings for this phase.
1223
type InvoiceUpcomingScheduleDetailsPhaseAutomaticTaxParams struct {
1224
        // Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
1225
        Enabled *bool `form:"enabled"`
1226
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1227
        Liability *InvoiceUpcomingScheduleDetailsPhaseAutomaticTaxLiabilityParams `form:"liability"`
1228
}
1229

1230
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1231
type InvoiceUpcomingScheduleDetailsPhaseBillingThresholdsParams struct {
1232
        // Monetary threshold that triggers the subscription to advance to a new billing period
1233
        AmountGTE *int64 `form:"amount_gte"`
1234
        // Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
1235
        ResetBillingCycleAnchor *bool `form:"reset_billing_cycle_anchor"`
1236
}
1237

1238
// Time span for the redeemed discount.
1239
type InvoiceUpcomingScheduleDetailsPhaseDiscountDiscountEndDurationParams struct {
1240
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1241
        Interval *string `form:"interval"`
1242
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1243
        IntervalCount *int64 `form:"interval_count"`
1244
}
1245

1246
// Details to determine how long the discount should be applied for.
1247
type InvoiceUpcomingScheduleDetailsPhaseDiscountDiscountEndParams struct {
1248
        // Time span for the redeemed discount.
1249
        Duration *InvoiceUpcomingScheduleDetailsPhaseDiscountDiscountEndDurationParams `form:"duration"`
1250
        // A precise Unix timestamp for the discount to end. Must be in the future.
1251
        Timestamp *int64 `form:"timestamp"`
1252
        // The type of calculation made to determine when the discount ends.
1253
        Type *string `form:"type"`
1254
}
1255

1256
// The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
1257
type InvoiceUpcomingScheduleDetailsPhaseDiscountParams struct {
1258
        // ID of the coupon to create a new discount for.
1259
        Coupon *string `form:"coupon"`
1260
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1261
        Discount *string `form:"discount"`
1262
        // Details to determine how long the discount should be applied for.
1263
        DiscountEnd *InvoiceUpcomingScheduleDetailsPhaseDiscountDiscountEndParams `form:"discount_end"`
1264
        // ID of the promotion code to create a new discount for.
1265
        PromotionCode *string `form:"promotion_code"`
1266
}
1267

1268
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1269
type InvoiceUpcomingScheduleDetailsPhaseInvoiceSettingsIssuerParams struct {
1270
        // The connected account being referenced when `type` is `account`.
1271
        Account *string `form:"account"`
1272
        // Type of the account referenced in the request.
1273
        Type *string `form:"type"`
1274
}
1275

1276
// All invoices will be billed using the specified settings.
1277
type InvoiceUpcomingScheduleDetailsPhaseInvoiceSettingsParams struct {
1278
        // The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
1279
        AccountTaxIDs []*string `form:"account_tax_ids"`
1280
        // Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
1281
        DaysUntilDue *int64 `form:"days_until_due"`
1282
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1283
        Issuer *InvoiceUpcomingScheduleDetailsPhaseInvoiceSettingsIssuerParams `form:"issuer"`
1284
}
1285

1286
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1287
type InvoiceUpcomingScheduleDetailsPhaseItemBillingThresholdsParams struct {
1288
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
1289
        UsageGTE *int64 `form:"usage_gte"`
1290
}
1291

1292
// Time span for the redeemed discount.
1293
type InvoiceUpcomingScheduleDetailsPhaseItemDiscountDiscountEndDurationParams struct {
1294
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1295
        Interval *string `form:"interval"`
1296
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1297
        IntervalCount *int64 `form:"interval_count"`
1298
}
1299

1300
// Details to determine how long the discount should be applied for.
1301
type InvoiceUpcomingScheduleDetailsPhaseItemDiscountDiscountEndParams struct {
1302
        // Time span for the redeemed discount.
1303
        Duration *InvoiceUpcomingScheduleDetailsPhaseItemDiscountDiscountEndDurationParams `form:"duration"`
1304
        // A precise Unix timestamp for the discount to end. Must be in the future.
1305
        Timestamp *int64 `form:"timestamp"`
1306
        // The type of calculation made to determine when the discount ends.
1307
        Type *string `form:"type"`
1308
}
1309

1310
// The coupons to redeem into discounts for the subscription item.
1311
type InvoiceUpcomingScheduleDetailsPhaseItemDiscountParams struct {
1312
        // ID of the coupon to create a new discount for.
1313
        Coupon *string `form:"coupon"`
1314
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1315
        Discount *string `form:"discount"`
1316
        // Details to determine how long the discount should be applied for.
1317
        DiscountEnd *InvoiceUpcomingScheduleDetailsPhaseItemDiscountDiscountEndParams `form:"discount_end"`
1318
        // ID of the promotion code to create a new discount for.
1319
        PromotionCode *string `form:"promotion_code"`
1320
}
1321

1322
// The recurring components of a price such as `interval` and `interval_count`.
1323
type InvoiceUpcomingScheduleDetailsPhaseItemPriceDataRecurringParams struct {
1324
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1325
        Interval *string `form:"interval"`
1326
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1327
        IntervalCount *int64 `form:"interval_count"`
1328
}
1329

1330
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
1331
type InvoiceUpcomingScheduleDetailsPhaseItemPriceDataParams struct {
1332
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1333
        Currency *string `form:"currency"`
1334
        // The ID of the product that this price will belong to.
1335
        Product *string `form:"product"`
1336
        // The recurring components of a price such as `interval` and `interval_count`.
1337
        Recurring *InvoiceUpcomingScheduleDetailsPhaseItemPriceDataRecurringParams `form:"recurring"`
1338
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1339
        TaxBehavior *string `form:"tax_behavior"`
1340
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1341
        UnitAmount *int64 `form:"unit_amount"`
1342
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1343
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
1344
}
1345

1346
// Options that configure the trial on the subscription item.
1347
type InvoiceUpcomingScheduleDetailsPhaseItemTrialParams struct {
1348
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
1349
        ConvertsTo []*string `form:"converts_to"`
1350
        // Determines the type of trial for this item.
1351
        Type *string `form:"type"`
1352
}
1353

1354
// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
1355
type InvoiceUpcomingScheduleDetailsPhaseItemParams struct {
1356
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1357
        BillingThresholds *InvoiceUpcomingScheduleDetailsPhaseItemBillingThresholdsParams `form:"billing_thresholds"`
1358
        // The coupons to redeem into discounts for the subscription item.
1359
        Discounts []*InvoiceUpcomingScheduleDetailsPhaseItemDiscountParams `form:"discounts"`
1360
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
1361
        Metadata map[string]string `form:"metadata"`
1362
        // The plan ID to subscribe to. You may specify the same ID in `plan` and `price`.
1363
        Plan *string `form:"plan"`
1364
        // The ID of the price object.
1365
        Price *string `form:"price"`
1366
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
1367
        PriceData *InvoiceUpcomingScheduleDetailsPhaseItemPriceDataParams `form:"price_data"`
1368
        // Quantity for the given price. Can be set only if the price's `usage_type` is `licensed` and not `metered`.
1369
        Quantity *int64 `form:"quantity"`
1370
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
1371
        TaxRates []*string `form:"tax_rates"`
1372
        // Options that configure the trial on the subscription item.
1373
        Trial *InvoiceUpcomingScheduleDetailsPhaseItemTrialParams `form:"trial"`
1374
}
1375

1376
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
1377
func (p *InvoiceUpcomingScheduleDetailsPhaseItemParams) AddMetadata(key string, value string) {
×
UNCOV
1378
        if p.Metadata == nil {
×
UNCOV
1379
                p.Metadata = make(map[string]string)
×
UNCOV
1380
        }
×
1381

1382
        p.Metadata[key] = value
×
1383
}
1384

1385
// If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
1386
type InvoiceUpcomingScheduleDetailsPhasePauseCollectionParams struct {
1387
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
1388
        Behavior *string `form:"behavior"`
1389
}
1390

1391
// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
1392
type InvoiceUpcomingScheduleDetailsPhaseTransferDataParams struct {
1393
        // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
1394
        AmountPercent *float64 `form:"amount_percent"`
1395
        // ID of an existing, connected Stripe account.
1396
        Destination *string `form:"destination"`
1397
}
1398

1399
// Defines how the subscription should behave when a trial ends.
1400
type InvoiceUpcomingScheduleDetailsPhaseTrialSettingsEndBehaviorParams struct {
1401
        // Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
1402
        ProrateUpFront *string `form:"prorate_up_front"`
1403
}
1404

1405
// Settings related to subscription trials.
1406
type InvoiceUpcomingScheduleDetailsPhaseTrialSettingsParams struct {
1407
        // Defines how the subscription should behave when a trial ends.
1408
        EndBehavior *InvoiceUpcomingScheduleDetailsPhaseTrialSettingsEndBehaviorParams `form:"end_behavior"`
1409
}
1410

1411
// List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
1412
type InvoiceUpcomingScheduleDetailsPhaseParams struct {
1413
        // A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
1414
        AddInvoiceItems []*InvoiceUpcomingScheduleDetailsPhaseAddInvoiceItemParams `form:"add_invoice_items"`
1415
        // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
1416
        ApplicationFeePercent *float64 `form:"application_fee_percent"`
1417
        // Automatic tax settings for this phase.
1418
        AutomaticTax *InvoiceUpcomingScheduleDetailsPhaseAutomaticTaxParams `form:"automatic_tax"`
1419
        // Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
1420
        BillingCycleAnchor *string `form:"billing_cycle_anchor"`
1421
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
1422
        BillingThresholds *InvoiceUpcomingScheduleDetailsPhaseBillingThresholdsParams `form:"billing_thresholds"`
1423
        // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
1424
        CollectionMethod *string `form:"collection_method"`
1425
        // The ID of the coupon to apply to this phase of the subscription schedule. This field has been deprecated and will be removed in a future API version. Use `discounts` instead.
1426
        Coupon *string `form:"coupon"`
1427
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1428
        Currency *string `form:"currency"`
1429
        // ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
1430
        DefaultPaymentMethod *string `form:"default_payment_method"`
1431
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
1432
        DefaultTaxRates []*string `form:"default_tax_rates"`
1433
        // Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
1434
        Description *string `form:"description"`
1435
        // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
1436
        Discounts []*InvoiceUpcomingScheduleDetailsPhaseDiscountParams `form:"discounts"`
1437
        // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set.
1438
        EndDate    *int64 `form:"end_date"`
1439
        EndDateNow *bool  `form:"-"` // See custom AppendTo
1440
        // All invoices will be billed using the specified settings.
1441
        InvoiceSettings *InvoiceUpcomingScheduleDetailsPhaseInvoiceSettingsParams `form:"invoice_settings"`
1442
        // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
1443
        Items []*InvoiceUpcomingScheduleDetailsPhaseItemParams `form:"items"`
1444
        // Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set.
1445
        Iterations *int64 `form:"iterations"`
1446
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`. Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`. To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
1447
        Metadata map[string]string `form:"metadata"`
1448
        // The account on behalf of which to charge, for each of the associated subscription's invoices.
1449
        OnBehalfOf *string `form:"on_behalf_of"`
1450
        // If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
1451
        PauseCollection *InvoiceUpcomingScheduleDetailsPhasePauseCollectionParams `form:"pause_collection"`
1452
        // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
1453
        ProrationBehavior *string `form:"proration_behavior"`
1454
        // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
1455
        StartDate    *int64 `form:"start_date"`
1456
        StartDateNow *bool  `form:"-"` // See custom AppendTo
1457
        // The data with which to automatically create a Transfer for each of the associated subscription's invoices.
1458
        TransferData *InvoiceUpcomingScheduleDetailsPhaseTransferDataParams `form:"transfer_data"`
1459
        // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
1460
        Trial *bool `form:"trial"`
1461
        // Specify trial behavior when crossing phase boundaries
1462
        TrialContinuation *string `form:"trial_continuation"`
1463
        // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
1464
        TrialEnd    *int64 `form:"trial_end"`
1465
        TrialEndNow *bool  `form:"-"` // See custom AppendTo
1466
        // Settings related to subscription trials.
1467
        TrialSettings *InvoiceUpcomingScheduleDetailsPhaseTrialSettingsParams `form:"trial_settings"`
1468
}
1469

1470
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
1471
func (p *InvoiceUpcomingScheduleDetailsPhaseParams) AddMetadata(key string, value string) {
×
UNCOV
1472
        if p.Metadata == nil {
×
UNCOV
1473
                p.Metadata = make(map[string]string)
×
UNCOV
1474
        }
×
1475

1476
        p.Metadata[key] = value
×
1477
}
1478

1479
// AppendTo implements custom encoding logic for InvoiceUpcomingScheduleDetailsPhaseParams.
UNCOV
1480
func (p *InvoiceUpcomingScheduleDetailsPhaseParams) AppendTo(body *form.Values, keyParts []string) {
×
1481
        if BoolValue(p.EndDateNow) {
×
UNCOV
1482
                body.Add(form.FormatKey(append(keyParts, "end_date")), "now")
×
UNCOV
1483
        }
×
UNCOV
1484
        if BoolValue(p.StartDateNow) {
×
1485
                body.Add(form.FormatKey(append(keyParts, "start_date")), "now")
×
1486
        }
×
1487
        if BoolValue(p.TrialEndNow) {
×
1488
                body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")
×
1489
        }
×
1490
}
1491

1492
// End the prebilled period when a specified amendment ends.
1493
type InvoiceUpcomingScheduleDetailsPrebillingBillUntilAmendmentEndParams struct {
1494
        // The position of the amendment in the `amendments` array at which prebilling should end. Indexes start from 0 and must be less than the total number of supplied amendments.
1495
        Index *int64 `form:"index"`
1496
}
1497

1498
// Time span for prebilling, starting from `bill_from`.
1499
type InvoiceUpcomingScheduleDetailsPrebillingBillUntilDurationParams struct {
1500
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1501
        Interval *string `form:"interval"`
1502
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1503
        IntervalCount *int64 `form:"interval_count"`
1504
}
1505

1506
// The end of the prebilled time period.
1507
type InvoiceUpcomingScheduleDetailsPrebillingBillUntilParams struct {
1508
        // End the prebilled period when a specified amendment ends.
1509
        AmendmentEnd *InvoiceUpcomingScheduleDetailsPrebillingBillUntilAmendmentEndParams `form:"amendment_end"`
1510
        // Time span for prebilling, starting from `bill_from`.
1511
        Duration *InvoiceUpcomingScheduleDetailsPrebillingBillUntilDurationParams `form:"duration"`
1512
        // End the prebilled period at a precise integer timestamp, starting from the Unix epoch.
1513
        Timestamp *int64 `form:"timestamp"`
1514
        // Select one of several ways to pass the `bill_until` value.
1515
        Type *string `form:"type"`
1516
}
1517

1518
// Provide any time periods to bill in advance.
1519
type InvoiceUpcomingScheduleDetailsPrebillingParams struct {
1520
        // The end of the prebilled time period.
1521
        BillUntil *InvoiceUpcomingScheduleDetailsPrebillingBillUntilParams `form:"bill_until"`
1522
        // This is used to determine the number of billing cycles to prebill.
1523
        Iterations *int64 `form:"iterations"`
1524
}
1525

1526
// The schedule creation or modification params to apply as a preview. Cannot be used with `subscription` or `subscription_` prefixed fields.
1527
type InvoiceUpcomingScheduleDetailsParams struct {
1528
        // Changes to apply to the phases of the subscription schedule, in the order provided.
1529
        Amendments []*InvoiceUpcomingScheduleDetailsAmendmentParams `form:"amendments"`
1530
        // Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
1531
        BillingBehavior *string `form:"billing_behavior"`
1532
        // Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running. `cancel` will end the subscription schedule and cancel the underlying subscription.
1533
        EndBehavior *string `form:"end_behavior"`
1534
        // List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
1535
        Phases []*InvoiceUpcomingScheduleDetailsPhaseParams `form:"phases"`
1536
        // Provide any time periods to bill in advance.
1537
        Prebilling []*InvoiceUpcomingScheduleDetailsPrebillingParams `form:"prebilling"`
1538
        // In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request.
1539
        ProrationBehavior *string `form:"proration_behavior"`
1540
}
1541

1542
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1543
type InvoiceUpcomingSubscriptionDetailsItemBillingThresholdsParams struct {
1544
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
1545
        UsageGTE *int64 `form:"usage_gte"`
1546
}
1547

1548
// Time span for the redeemed discount.
1549
type InvoiceUpcomingSubscriptionDetailsItemDiscountDiscountEndDurationParams struct {
1550
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1551
        Interval *string `form:"interval"`
1552
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1553
        IntervalCount *int64 `form:"interval_count"`
1554
}
1555

1556
// Details to determine how long the discount should be applied for.
1557
type InvoiceUpcomingSubscriptionDetailsItemDiscountDiscountEndParams struct {
1558
        // Time span for the redeemed discount.
1559
        Duration *InvoiceUpcomingSubscriptionDetailsItemDiscountDiscountEndDurationParams `form:"duration"`
1560
        // A precise Unix timestamp for the discount to end. Must be in the future.
1561
        Timestamp *int64 `form:"timestamp"`
1562
        // The type of calculation made to determine when the discount ends.
1563
        Type *string `form:"type"`
1564
}
1565

1566
// The coupons to redeem into discounts for the subscription item.
1567
type InvoiceUpcomingSubscriptionDetailsItemDiscountParams struct {
1568
        // ID of the coupon to create a new discount for.
1569
        Coupon *string `form:"coupon"`
1570
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1571
        Discount *string `form:"discount"`
1572
        // Details to determine how long the discount should be applied for.
1573
        DiscountEnd *InvoiceUpcomingSubscriptionDetailsItemDiscountDiscountEndParams `form:"discount_end"`
1574
        // ID of the promotion code to create a new discount for.
1575
        PromotionCode *string `form:"promotion_code"`
1576
}
1577

1578
// The recurring components of a price such as `interval` and `interval_count`.
1579
type InvoiceUpcomingSubscriptionDetailsItemPriceDataRecurringParams struct {
1580
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
1581
        Interval *string `form:"interval"`
1582
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
1583
        IntervalCount *int64 `form:"interval_count"`
1584
}
1585

1586
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1587
type InvoiceUpcomingSubscriptionDetailsItemPriceDataParams struct {
1588
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1589
        Currency *string `form:"currency"`
1590
        // The ID of the product that this price will belong to.
1591
        Product *string `form:"product"`
1592
        // The recurring components of a price such as `interval` and `interval_count`.
1593
        Recurring *InvoiceUpcomingSubscriptionDetailsItemPriceDataRecurringParams `form:"recurring"`
1594
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1595
        TaxBehavior *string `form:"tax_behavior"`
1596
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1597
        UnitAmount *int64 `form:"unit_amount"`
1598
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1599
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
1600
}
1601

1602
// A list of up to 20 subscription items, each with an attached price.
1603
type InvoiceUpcomingSubscriptionDetailsItemParams struct {
1604
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
1605
        BillingThresholds *InvoiceUpcomingSubscriptionDetailsItemBillingThresholdsParams `form:"billing_thresholds"`
1606
        // Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`.
1607
        ClearUsage *bool `form:"clear_usage"`
1608
        // A flag that, if set to `true`, will delete the specified item.
1609
        Deleted *bool `form:"deleted"`
1610
        // The coupons to redeem into discounts for the subscription item.
1611
        Discounts []*InvoiceUpcomingSubscriptionDetailsItemDiscountParams `form:"discounts"`
1612
        // Subscription item to update.
1613
        ID *string `form:"id"`
1614
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
1615
        Metadata map[string]string `form:"metadata"`
1616
        // Plan ID for this item, as a string.
1617
        Plan *string `form:"plan"`
1618
        // The ID of the price object. One of `price` or `price_data` is required. When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided.
1619
        Price *string `form:"price"`
1620
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1621
        PriceData *InvoiceUpcomingSubscriptionDetailsItemPriceDataParams `form:"price_data"`
1622
        // Quantity for this item.
1623
        Quantity *int64 `form:"quantity"`
1624
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
1625
        TaxRates []*string `form:"tax_rates"`
1626
}
1627

1628
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
1629
func (p *InvoiceUpcomingSubscriptionDetailsItemParams) AddMetadata(key string, value string) {
×
UNCOV
1630
        if p.Metadata == nil {
×
UNCOV
1631
                p.Metadata = make(map[string]string)
×
UNCOV
1632
        }
×
1633

1634
        p.Metadata[key] = value
×
1635
}
1636

1637
// The pre-billing to apply to the subscription as a preview.
1638
type InvoiceUpcomingSubscriptionDetailsPrebillingParams struct {
1639
        // This is used to determine the number of billing cycles to prebill.
1640
        Iterations *int64 `form:"iterations"`
1641
}
1642

1643
// The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields.
1644
type InvoiceUpcomingSubscriptionDetailsParams struct {
1645
        // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://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`.
1646
        BillingCycleAnchor          *int64 `form:"billing_cycle_anchor"`
1647
        BillingCycleAnchorNow       *bool  `form:"-"` // See custom AppendTo
1648
        BillingCycleAnchorUnchanged *bool  `form:"-"` // See custom AppendTo
1649
        // 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.
1650
        CancelAt *int64 `form:"cancel_at"`
1651
        // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
1652
        CancelAtPeriodEnd *bool `form:"cancel_at_period_end"`
1653
        // This simulates the subscription being canceled or expired immediately.
1654
        CancelNow *bool `form:"cancel_now"`
1655
        // 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.
1656
        DefaultTaxRates []*string `form:"default_tax_rates"`
1657
        // A list of up to 20 subscription items, each with an attached price.
1658
        Items []*InvoiceUpcomingSubscriptionDetailsItemParams `form:"items"`
1659
        // The pre-billing to apply to the subscription as a preview.
1660
        Prebilling *InvoiceUpcomingSubscriptionDetailsPrebillingParams `form:"prebilling"`
1661
        // Determines how to handle [prorations](https://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`.
1662
        ProrationBehavior *string `form:"proration_behavior"`
1663
        // 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'.
1664
        ProrationDate *int64 `form:"proration_date"`
1665
        // For paused subscriptions, setting `subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed.
1666
        ResumeAt *string `form:"resume_at"`
1667
        // Date a subscription is intended to start (can be future or past).
1668
        StartDate *int64 `form:"start_date"`
1669
        // 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.
1670
        TrialEnd    *int64 `form:"trial_end"`
1671
        TrialEndNow *bool  `form:"-"` // See custom AppendTo
1672
}
1673

1674
// AppendTo implements custom encoding logic for InvoiceUpcomingSubscriptionDetailsParams.
UNCOV
1675
func (p *InvoiceUpcomingSubscriptionDetailsParams) AppendTo(body *form.Values, keyParts []string) {
×
UNCOV
1676
        if BoolValue(p.BillingCycleAnchorNow) {
×
UNCOV
1677
                body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "now")
×
UNCOV
1678
        }
×
UNCOV
1679
        if BoolValue(p.BillingCycleAnchorUnchanged) {
×
1680
                body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "unchanged")
×
1681
        }
×
1682
        if BoolValue(p.TrialEndNow) {
×
1683
                body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")
×
1684
        }
×
1685
}
1686

1687
// The pre-billing to apply to the subscription as a preview. This field has been deprecated and will be removed in a future API version. Use `subscription_details.prebilling` instead.
1688
type InvoiceUpcomingSubscriptionPrebillingParams struct {
1689
        // This is used to determine the number of billing cycles to prebill.
1690
        Iterations *int64 `form:"iterations"`
1691
}
1692

1693
// At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
1694
//
1695
// Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
1696
//
1697
// You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_details.proration_date value passed in the request.
1698
//
1699
// Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. [Learn more](https://docs.stripe.com/currencies/conversions)
1700
type InvoiceUpcomingParams struct {
1701
        Params `form:"*"`
1702
        // Settings for automatic tax lookup for this invoice preview.
1703
        AutomaticTax *InvoiceAutomaticTaxParams `form:"automatic_tax"`
1704
        // The ID of the coupon to apply to this phase of the subscription schedule. This field has been deprecated and will be removed in a future API version. Use `discounts` instead.
1705
        Coupon *string `form:"coupon"`
1706
        // The currency to preview this invoice in. Defaults to that of `customer` if not specified.
1707
        Currency *string `form:"currency"`
1708
        // 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.
1709
        Customer *string `form:"customer"`
1710
        // 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.
1711
        CustomerDetails *InvoiceUpcomingCustomerDetailsParams `form:"customer_details"`
1712
        // 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.
1713
        Discounts []*InvoiceDiscountParams `form:"discounts"`
1714
        // Specifies which fields in the response should be expanded.
1715
        Expand []*string `form:"expand"`
1716
        // List of invoice items to add or update in the upcoming invoice preview (up to 250).
1717
        InvoiceItems []*InvoiceUpcomingInvoiceItemParams `form:"invoice_items"`
1718
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1719
        Issuer *InvoiceUpcomingIssuerParams `form:"issuer"`
1720
        // 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](https://stripe.com/docs/billing/invoices/connect) documentation for details.
1721
        OnBehalfOf *string `form:"on_behalf_of"`
1722
        // Customizes the types of values to include when calculating the invoice. Defaults to `next` if unspecified.
1723
        PreviewMode *string `form:"preview_mode"`
1724
        // The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields.
1725
        Schedule *string `form:"schedule"`
1726
        // The schedule creation or modification params to apply as a preview. Cannot be used with `subscription` or `subscription_` prefixed fields.
1727
        ScheduleDetails *InvoiceUpcomingScheduleDetailsParams `form:"schedule_details"`
1728
        // 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.
1729
        Subscription *string `form:"subscription"`
1730
        // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://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`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.billing_cycle_anchor` instead.
1731
        SubscriptionBillingCycleAnchor          *int64 `form:"subscription_billing_cycle_anchor"`
1732
        SubscriptionBillingCycleAnchorNow       *bool  `form:"-"` // See custom AppendTo
1733
        SubscriptionBillingCycleAnchorUnchanged *bool  `form:"-"` // See custom AppendTo
1734
        // 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. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at` instead.
1735
        SubscriptionCancelAt *int64 `form:"subscription_cancel_at"`
1736
        // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at_period_end` instead.
1737
        SubscriptionCancelAtPeriodEnd *bool `form:"subscription_cancel_at_period_end"`
1738
        // This simulates the subscription being canceled or expired immediately. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_now` instead.
1739
        SubscriptionCancelNow *bool `form:"subscription_cancel_now"`
1740
        // 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. This field has been deprecated and will be removed in a future API version. Use `subscription_details.default_tax_rates` instead.
1741
        SubscriptionDefaultTaxRates []*string `form:"subscription_default_tax_rates"`
1742
        // The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields.
1743
        SubscriptionDetails *InvoiceUpcomingSubscriptionDetailsParams `form:"subscription_details"`
1744
        // A list of up to 20 subscription items, each with an attached price. This field has been deprecated and will be removed in a future API version. Use `subscription_details.items` instead.
1745
        SubscriptionItems []*SubscriptionItemsParams `form:"subscription_items"`
1746
        // The pre-billing to apply to the subscription as a preview. This field has been deprecated and will be removed in a future API version. Use `subscription_details.prebilling` instead.
1747
        SubscriptionPrebilling *InvoiceUpcomingSubscriptionPrebillingParams `form:"subscription_prebilling"`
1748
        // Determines how to handle [prorations](https://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`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_behavior` instead.
1749
        SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"`
1750
        // If previewing an update to a subscription, and doing proration, `subscription_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_items`, or `subscription_trial_end` are required. Also, `subscription_proration_behavior` cannot be set to 'none'. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_date` instead.
1751
        SubscriptionProrationDate *int64 `form:"subscription_proration_date"`
1752
        // For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. This field has been deprecated and will be removed in a future API version. Use `subscription_details.resume_at` instead.
1753
        SubscriptionResumeAt *string `form:"subscription_resume_at"`
1754
        // Date a subscription is intended to start (can be future or past). This field has been deprecated and will be removed in a future API version. Use `subscription_details.start_date` instead.
1755
        SubscriptionStartDate *int64 `form:"subscription_start_date"`
1756
        // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_items` or `subscription` is required. This field has been deprecated and will be removed in a future API version. Use `subscription_details.trial_end` instead.
1757
        SubscriptionTrialEnd    *int64 `form:"subscription_trial_end"`
1758
        SubscriptionTrialEndNow *bool  `form:"-"` // See custom AppendTo
1759
        // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `subscription_trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
1760
        SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"`
1761
}
1762

1763
// AddExpand appends a new field to expand.
UNCOV
1764
func (p *InvoiceUpcomingParams) AddExpand(f string) {
×
UNCOV
1765
        p.Expand = append(p.Expand, &f)
×
UNCOV
1766
}
×
1767

1768
// AppendTo implements custom encoding logic for InvoiceUpcomingParams.
1769
func (p *InvoiceUpcomingParams) AppendTo(body *form.Values, keyParts []string) {
3✔
1770
        if BoolValue(p.SubscriptionBillingCycleAnchorNow) {
4✔
1771
                body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "now")
1✔
1772
        }
1✔
1773
        if BoolValue(p.SubscriptionBillingCycleAnchorUnchanged) {
4✔
1774
                body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "unchanged")
1✔
1775
        }
1✔
1776
        if BoolValue(p.SubscriptionTrialEndNow) {
4✔
1777
                body.Add(form.FormatKey(append(keyParts, "subscription_trial_end")), "now")
1✔
1778
        }
1✔
1779
}
1780

1781
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1782
type InvoiceUpcomingLinesAutomaticTaxLiabilityParams struct {
1783
        // The connected account being referenced when `type` is `account`.
1784
        Account *string `form:"account"`
1785
        // Type of the account referenced in the request.
1786
        Type *string `form:"type"`
1787
}
1788

1789
// Settings for automatic tax lookup for this invoice preview.
1790
type InvoiceUpcomingLinesAutomaticTaxParams struct {
1791
        // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices.
1792
        Enabled *bool `form:"enabled"`
1793
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
1794
        Liability *InvoiceUpcomingLinesAutomaticTaxLiabilityParams `form:"liability"`
1795
}
1796

1797
// The customer's shipping information. Appears on invoices emailed to this customer.
1798
type InvoiceUpcomingLinesCustomerDetailsShippingParams struct {
1799
        // Customer shipping address.
1800
        Address *AddressParams `form:"address"`
1801
        // Customer name.
1802
        Name *string `form:"name"`
1803
        // Customer phone (including extension).
1804
        Phone *string `form:"phone"`
1805
}
1806

1807
// Tax details about the customer.
1808
type InvoiceUpcomingLinesCustomerDetailsTaxParams struct {
1809
        // A recent IP address of the customer used for tax reporting and tax location inference. Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
1810
        IPAddress *string `form:"ip_address"`
1811
}
1812

1813
// The customer's tax IDs.
1814
type InvoiceUpcomingLinesCustomerDetailsTaxIDParams struct {
1815
        // Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `ma_vat`, `md_vat`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, or `za_vat`
1816
        Type *string `form:"type"`
1817
        // Value of the tax ID.
1818
        Value *string `form:"value"`
1819
}
1820

1821
// 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.
1822
type InvoiceUpcomingLinesCustomerDetailsParams struct {
1823
        // The customer's address.
1824
        Address *AddressParams `form:"address"`
1825
        // The customer's shipping information. Appears on invoices emailed to this customer.
1826
        Shipping *InvoiceUpcomingLinesCustomerDetailsShippingParams `form:"shipping"`
1827
        // Tax details about the customer.
1828
        Tax *InvoiceUpcomingLinesCustomerDetailsTaxParams `form:"tax"`
1829
        // The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
1830
        TaxExempt *string `form:"tax_exempt"`
1831
        // The customer's tax IDs.
1832
        TaxIDs []*InvoiceUpcomingLinesCustomerDetailsTaxIDParams `form:"tax_ids"`
1833
}
1834

1835
// Time span for the redeemed discount.
1836
type InvoiceUpcomingLinesDiscountDiscountEndDurationParams struct {
1837
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1838
        Interval *string `form:"interval"`
1839
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1840
        IntervalCount *int64 `form:"interval_count"`
1841
}
1842

1843
// Details to determine how long the discount should be applied for.
1844
type InvoiceUpcomingLinesDiscountDiscountEndParams struct {
1845
        // Time span for the redeemed discount.
1846
        Duration *InvoiceUpcomingLinesDiscountDiscountEndDurationParams `form:"duration"`
1847
        // A precise Unix timestamp for the discount to end. Must be in the future.
1848
        Timestamp *int64 `form:"timestamp"`
1849
        // The type of calculation made to determine when the discount ends.
1850
        Type *string `form:"type"`
1851
}
1852

1853
// 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.
1854
type InvoiceUpcomingLinesDiscountParams struct {
1855
        // ID of the coupon to create a new discount for.
1856
        Coupon *string `form:"coupon"`
1857
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1858
        Discount *string `form:"discount"`
1859
        // Details to determine how long the discount should be applied for.
1860
        DiscountEnd *InvoiceUpcomingLinesDiscountDiscountEndParams `form:"discount_end"`
1861
        // ID of the promotion code to create a new discount for.
1862
        PromotionCode *string `form:"promotion_code"`
1863
}
1864

1865
// Time span for the redeemed discount.
1866
type InvoiceUpcomingLinesInvoiceItemDiscountDiscountEndDurationParams struct {
1867
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1868
        Interval *string `form:"interval"`
1869
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1870
        IntervalCount *int64 `form:"interval_count"`
1871
}
1872

1873
// Details to determine how long the discount should be applied for.
1874
type InvoiceUpcomingLinesInvoiceItemDiscountDiscountEndParams struct {
1875
        // Time span for the redeemed discount.
1876
        Duration *InvoiceUpcomingLinesInvoiceItemDiscountDiscountEndDurationParams `form:"duration"`
1877
        // A precise Unix timestamp for the discount to end. Must be in the future.
1878
        Timestamp *int64 `form:"timestamp"`
1879
        // The type of calculation made to determine when the discount ends.
1880
        Type *string `form:"type"`
1881
}
1882

1883
// The coupons to redeem into discounts for the invoice item in the preview.
1884
type InvoiceUpcomingLinesInvoiceItemDiscountParams struct {
1885
        // ID of the coupon to create a new discount for.
1886
        Coupon *string `form:"coupon"`
1887
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
1888
        Discount *string `form:"discount"`
1889
        // Details to determine how long the discount should be applied for.
1890
        DiscountEnd *InvoiceUpcomingLinesInvoiceItemDiscountDiscountEndParams `form:"discount_end"`
1891
        // ID of the promotion code to create a new discount for.
1892
        PromotionCode *string `form:"promotion_code"`
1893
}
1894

1895
// The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
1896
type InvoiceUpcomingLinesInvoiceItemPeriodParams struct {
1897
        // The end of the period, which must be greater than or equal to the start. This value is inclusive.
1898
        End *int64 `form:"end"`
1899
        // The start of the period. This value is inclusive.
1900
        Start *int64 `form:"start"`
1901
}
1902

1903
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1904
type InvoiceUpcomingLinesInvoiceItemPriceDataParams struct {
1905
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
1906
        Currency *string `form:"currency"`
1907
        // The ID of the product that this price will belong to.
1908
        Product *string `form:"product"`
1909
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1910
        TaxBehavior *string `form:"tax_behavior"`
1911
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
1912
        UnitAmount *int64 `form:"unit_amount"`
1913
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1914
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
1915
}
1916

1917
// List of invoice items to add or update in the upcoming invoice preview (up to 250).
1918
type InvoiceUpcomingLinesInvoiceItemParams struct {
1919
        // The integer amount in cents (or local equivalent) of previewed invoice item.
1920
        Amount *int64 `form:"amount"`
1921
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Only applicable to new invoice items.
1922
        Currency *string `form:"currency"`
1923
        // An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
1924
        Description *string `form:"description"`
1925
        // Explicitly controls whether discounts apply to this invoice item. Defaults to true, except for negative invoice items.
1926
        Discountable *bool `form:"discountable"`
1927
        // The coupons to redeem into discounts for the invoice item in the preview.
1928
        Discounts []*InvoiceUpcomingLinesInvoiceItemDiscountParams `form:"discounts"`
1929
        // The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice.
1930
        InvoiceItem *string `form:"invoiceitem"`
1931
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
1932
        Metadata map[string]string `form:"metadata"`
1933
        // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
1934
        Period *InvoiceUpcomingLinesInvoiceItemPeriodParams `form:"period"`
1935
        // The ID of the price object. One of `price` or `price_data` is required.
1936
        Price *string `form:"price"`
1937
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
1938
        PriceData *InvoiceUpcomingLinesInvoiceItemPriceDataParams `form:"price_data"`
1939
        // Non-negative integer. The quantity of units for the invoice item.
1940
        Quantity *int64 `form:"quantity"`
1941
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
1942
        TaxBehavior *string `form:"tax_behavior"`
1943
        // A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
1944
        TaxCode *string `form:"tax_code"`
1945
        // The tax rates that apply to the item. When set, any `default_tax_rates` do not apply to this item.
1946
        TaxRates []*string `form:"tax_rates"`
1947
        // The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount.
1948
        UnitAmount *int64 `form:"unit_amount"`
1949
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
1950
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
1951
}
1952

1953
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
1954
func (p *InvoiceUpcomingLinesInvoiceItemParams) AddMetadata(key string, value string) {
×
UNCOV
1955
        if p.Metadata == nil {
×
UNCOV
1956
                p.Metadata = make(map[string]string)
×
UNCOV
1957
        }
×
1958

1959
        p.Metadata[key] = value
×
1960
}
1961

1962
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
1963
type InvoiceUpcomingLinesIssuerParams struct {
1964
        // The connected account being referenced when `type` is `account`.
1965
        Account *string `form:"account"`
1966
        // Type of the account referenced in the request.
1967
        Type *string `form:"type"`
1968
}
1969

1970
// Use the `end` time of a given discount.
1971
type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndDiscountEndParams struct {
1972
        // The ID of a specific discount.
1973
        Discount *string `form:"discount"`
1974
}
1975

1976
// Time span for the amendment starting from the `amendment_start`.
1977
type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndDurationParams struct {
1978
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
1979
        Interval *string `form:"interval"`
1980
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
1981
        IntervalCount *int64 `form:"interval_count"`
1982
}
1983

1984
// Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
1985
type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndParams struct {
1986
        // Use the `end` time of a given discount.
1987
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndDiscountEndParams `form:"discount_end"`
1988
        // Time span for the amendment starting from the `amendment_start`.
1989
        Duration *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndDurationParams `form:"duration"`
1990
        // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`.
1991
        Timestamp *int64 `form:"timestamp"`
1992
        // Select one of three ways to pass the `amendment_end`.
1993
        Type *string `form:"type"`
1994
}
1995

1996
// Details of another amendment in the same array, immediately after which this amendment should begin.
1997
type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartAmendmentEndParams struct {
1998
        // The position of the previous amendment in the `amendments` array after which this amendment should begin. Indexes start from 0 and must be less than the index of the current amendment in the array.
1999
        Index *int64 `form:"index"`
2000
}
2001

2002
// Use the `end` time of a given discount.
2003
type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartDiscountEndParams struct {
2004
        // The ID of a specific discount.
2005
        Discount *string `form:"discount"`
2006
}
2007

2008
// Details to identify the earliest timestamp where the proposed change should take effect.
2009
type InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartParams struct {
2010
        // Details of another amendment in the same array, immediately after which this amendment should begin.
2011
        AmendmentEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartAmendmentEndParams `form:"amendment_end"`
2012
        // Use the `end` time of a given discount.
2013
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartDiscountEndParams `form:"discount_end"`
2014
        // A precise Unix timestamp for the amendment to start.
2015
        Timestamp *int64 `form:"timestamp"`
2016
        // Select one of three ways to pass the `amendment_start`.
2017
        Type *string `form:"type"`
2018
}
2019

2020
// Details to determine how long the discount should be applied for.
2021
type InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionAddDiscountEndParams struct {
2022
        // The type of calculation made to determine when the discount ends.
2023
        Type *string `form:"type"`
2024
}
2025

2026
// Details of the discount to add.
2027
type InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionAddParams struct {
2028
        // The coupon code to redeem.
2029
        Coupon *string `form:"coupon"`
2030
        // An ID of an existing discount for a coupon that was already redeemed.
2031
        Discount *string `form:"discount"`
2032
        // Details to determine how long the discount should be applied for.
2033
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionAddDiscountEndParams `form:"discount_end"`
2034
        // The index, starting at 0, at which to position the new discount. When not supplied, Stripe defaults to appending the discount to the end of the `discounts` array.
2035
        Index *int64 `form:"index"`
2036
        // The promotion code to redeem.
2037
        PromotionCode *string `form:"promotion_code"`
2038
}
2039

2040
// Details of the discount to remove.
2041
type InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionRemoveParams struct {
2042
        // The coupon code to remove from the `discounts` array.
2043
        Coupon *string `form:"coupon"`
2044
        // The ID of a discount to remove from the `discounts` array.
2045
        Discount *string `form:"discount"`
2046
        // The ID of a promotion code to remove from the `discounts` array.
2047
        PromotionCode *string `form:"promotion_code"`
2048
}
2049

2050
// Details of the discount to replace the existing discounts with.
2051
type InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionSetParams struct {
2052
        // The coupon code to replace the `discounts` array with.
2053
        Coupon *string `form:"coupon"`
2054
        // An ID of an existing discount to replace the `discounts` array with.
2055
        Discount *string `form:"discount"`
2056
        // An ID of an existing promotion code to replace the `discounts` array with.
2057
        PromotionCode *string `form:"promotion_code"`
2058
}
2059

2060
// Changes to the coupons being redeemed or discounts being applied during the amendment time span.
2061
type InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionParams struct {
2062
        // Details of the discount to add.
2063
        Add *InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionAddParams `form:"add"`
2064
        // Details of the discount to remove.
2065
        Remove *InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionRemoveParams `form:"remove"`
2066
        // Details of the discount to replace the existing discounts with.
2067
        Set *InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionSetParams `form:"set"`
2068
        // Determines the type of discount action.
2069
        Type *string `form:"type"`
2070
}
2071

2072
// Time span for the redeemed discount.
2073
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams struct {
2074
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2075
        Interval *string `form:"interval"`
2076
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2077
        IntervalCount *int64 `form:"interval_count"`
2078
}
2079

2080
// Details to determine how long the discount should be applied for.
2081
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountDiscountEndParams struct {
2082
        // Time span for the redeemed discount.
2083
        Duration *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"`
2084
        // A precise Unix timestamp for the discount to end. Must be in the future.
2085
        Timestamp *int64 `form:"timestamp"`
2086
        // The type of calculation made to determine when the discount ends.
2087
        Type *string `form:"type"`
2088
}
2089

2090
// The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
2091
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountParams struct {
2092
        // ID of the coupon to create a new discount for.
2093
        Coupon *string `form:"coupon"`
2094
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2095
        Discount *string `form:"discount"`
2096
        // Details to determine how long the discount should be applied for.
2097
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountDiscountEndParams `form:"discount_end"`
2098
        // ID of the promotion code to create a new discount for.
2099
        PromotionCode *string `form:"promotion_code"`
2100
}
2101

2102
// Options that configure the trial on the subscription item.
2103
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddTrialParams struct {
2104
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
2105
        ConvertsTo []*string `form:"converts_to"`
2106
        // Determines the type of trial for this item.
2107
        Type *string `form:"type"`
2108
}
2109

2110
// Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
2111
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddParams struct {
2112
        // The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
2113
        Discounts []*InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddDiscountParams `form:"discounts"`
2114
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
2115
        Metadata map[string]string `form:"metadata"`
2116
        // The ID of the price object.
2117
        Price *string `form:"price"`
2118
        // Quantity for this item.
2119
        Quantity *int64 `form:"quantity"`
2120
        // The tax rates that apply to this subscription item. When set, the `default_tax_rates` on the subscription do not apply to this `subscription_item`.
2121
        TaxRates []*string `form:"tax_rates"`
2122
        // Options that configure the trial on the subscription item.
2123
        Trial *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddTrialParams `form:"trial"`
2124
}
2125

2126
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
2127
func (p *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddParams) AddMetadata(key string, value string) {
×
UNCOV
2128
        if p.Metadata == nil {
×
UNCOV
2129
                p.Metadata = make(map[string]string)
×
UNCOV
2130
        }
×
2131

2132
        p.Metadata[key] = value
×
2133
}
2134

2135
// Details of the subscription item to remove.
2136
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionRemoveParams struct {
2137
        // ID of a price to remove.
2138
        Price *string `form:"price"`
2139
}
2140

2141
// Time span for the redeemed discount.
2142
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams struct {
2143
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2144
        Interval *string `form:"interval"`
2145
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2146
        IntervalCount *int64 `form:"interval_count"`
2147
}
2148

2149
// Details to determine how long the discount should be applied for.
2150
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountDiscountEndParams struct {
2151
        // Time span for the redeemed discount.
2152
        Duration *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"`
2153
        // A precise Unix timestamp for the discount to end. Must be in the future.
2154
        Timestamp *int64 `form:"timestamp"`
2155
        // The type of calculation made to determine when the discount ends.
2156
        Type *string `form:"type"`
2157
}
2158

2159
// If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
2160
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountParams struct {
2161
        // ID of the coupon to create a new discount for.
2162
        Coupon *string `form:"coupon"`
2163
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2164
        Discount *string `form:"discount"`
2165
        // Details to determine how long the discount should be applied for.
2166
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountDiscountEndParams `form:"discount_end"`
2167
        // ID of the promotion code to create a new discount for.
2168
        PromotionCode *string `form:"promotion_code"`
2169
}
2170

2171
// If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
2172
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetTrialParams struct {
2173
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
2174
        ConvertsTo []*string `form:"converts_to"`
2175
        // Determines the type of trial for this item.
2176
        Type *string `form:"type"`
2177
}
2178

2179
// Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
2180
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetParams struct {
2181
        // If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
2182
        Discounts []*InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetDiscountParams `form:"discounts"`
2183
        // If an item with the `price` already exists, passing this will override the `metadata` on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `metadata`.
2184
        Metadata map[string]string `form:"metadata"`
2185
        // The ID of the price object.
2186
        Price *string `form:"price"`
2187
        // If an item with the `price` already exists, passing this will override the quantity on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `quantity`.
2188
        Quantity *int64 `form:"quantity"`
2189
        // If an item with the `price` already exists, passing this will override the `tax_rates` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `tax_rates`.
2190
        TaxRates []*string `form:"tax_rates"`
2191
        // If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
2192
        Trial *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetTrialParams `form:"trial"`
2193
}
2194

2195
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
2196
func (p *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetParams) AddMetadata(key string, value string) {
×
UNCOV
2197
        if p.Metadata == nil {
×
UNCOV
2198
                p.Metadata = make(map[string]string)
×
UNCOV
2199
        }
×
2200

2201
        p.Metadata[key] = value
×
2202
}
2203

2204
// Changes to the subscription items during the amendment time span.
2205
type InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionParams struct {
2206
        // Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
2207
        Add *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionAddParams `form:"add"`
2208
        // Details of the subscription item to remove.
2209
        Remove *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionRemoveParams `form:"remove"`
2210
        // Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
2211
        Set *InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionSetParams `form:"set"`
2212
        // Determines the type of item action.
2213
        Type *string `form:"type"`
2214
}
2215

2216
// Instructions for how to modify phase metadata
2217
type InvoiceUpcomingLinesScheduleDetailsAmendmentMetadataActionParams struct {
2218
        // Key-value pairs to add to schedule phase metadata. These values will merge with existing schedule phase metadata.
2219
        Add map[string]string `form:"add"`
2220
        // Keys to remove from schedule phase metadata.
2221
        Remove []*string `form:"remove"`
2222
        // Key-value pairs to set as schedule phase metadata. Existing schedule phase metadata will be overwritten.
2223
        Set map[string]string `form:"set"`
2224
        // Select one of three ways to update phase-level `metadata` on subscription schedules.
2225
        Type *string `form:"type"`
2226
}
2227

2228
// Details of the pause_collection behavior to apply to the amendment.
2229
type InvoiceUpcomingLinesScheduleDetailsAmendmentSetPauseCollectionSetParams struct {
2230
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
2231
        Behavior *string `form:"behavior"`
2232
}
2233

2234
// Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
2235
type InvoiceUpcomingLinesScheduleDetailsAmendmentSetPauseCollectionParams struct {
2236
        // Details of the pause_collection behavior to apply to the amendment.
2237
        Set *InvoiceUpcomingLinesScheduleDetailsAmendmentSetPauseCollectionSetParams `form:"set"`
2238
        // Determines the type of the pause_collection amendment.
2239
        Type *string `form:"type"`
2240
}
2241

2242
// Defines how the subscription should behave when a trial ends.
2243
type InvoiceUpcomingLinesScheduleDetailsAmendmentTrialSettingsEndBehaviorParams struct {
2244
        // Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
2245
        ProrateUpFront *string `form:"prorate_up_front"`
2246
}
2247

2248
// Settings related to subscription trials.
2249
type InvoiceUpcomingLinesScheduleDetailsAmendmentTrialSettingsParams struct {
2250
        // Defines how the subscription should behave when a trial ends.
2251
        EndBehavior *InvoiceUpcomingLinesScheduleDetailsAmendmentTrialSettingsEndBehaviorParams `form:"end_behavior"`
2252
}
2253

2254
// Changes to apply to the phases of the subscription schedule, in the order provided.
2255
type InvoiceUpcomingLinesScheduleDetailsAmendmentParams struct {
2256
        // Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
2257
        AmendmentEnd *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentEndParams `form:"amendment_end"`
2258
        // Details to identify the earliest timestamp where the proposed change should take effect.
2259
        AmendmentStart *InvoiceUpcomingLinesScheduleDetailsAmendmentAmendmentStartParams `form:"amendment_start"`
2260
        // For point-in-time amendments (having no `amendment_end`), this attribute lets you set or remove whether the subscription's billing cycle anchor is reset at the `amendment_start` timestamp.For time-span based amendments (having both `amendment_start` and `amendment_end`), the only value valid is `automatic`, which removes any previously configured billing cycle anchor resets scheduled to occur during the window of time spanned by the amendment.
2261
        BillingCycleAnchor *string `form:"billing_cycle_anchor"`
2262
        // Changes to the coupons being redeemed or discounts being applied during the amendment time span.
2263
        DiscountActions []*InvoiceUpcomingLinesScheduleDetailsAmendmentDiscountActionParams `form:"discount_actions"`
2264
        // Changes to the subscription items during the amendment time span.
2265
        ItemActions []*InvoiceUpcomingLinesScheduleDetailsAmendmentItemActionParams `form:"item_actions"`
2266
        // Instructions for how to modify phase metadata
2267
        MetadataActions []*InvoiceUpcomingLinesScheduleDetailsAmendmentMetadataActionParams `form:"metadata_actions"`
2268
        // Changes to how Stripe handles prorations during the amendment time span. Affects if and how prorations are created when a future phase starts. In cases where the amendment changes the currently active phase, it is used to determine whether or how to prorate now, at the time of the request. Also supported as a point-in-time operation when `amendment_end` is `null`.
2269
        ProrationBehavior *string `form:"proration_behavior"`
2270
        // Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
2271
        SetPauseCollection *InvoiceUpcomingLinesScheduleDetailsAmendmentSetPauseCollectionParams `form:"set_pause_collection"`
2272
        // Ends the subscription schedule early as dictated by either the accompanying amendment's start or end.
2273
        SetScheduleEnd *string `form:"set_schedule_end"`
2274
        // Settings related to subscription trials.
2275
        TrialSettings *InvoiceUpcomingLinesScheduleDetailsAmendmentTrialSettingsParams `form:"trial_settings"`
2276
}
2277

2278
// Time span for the redeemed discount.
2279
type InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams struct {
2280
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2281
        Interval *string `form:"interval"`
2282
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2283
        IntervalCount *int64 `form:"interval_count"`
2284
}
2285

2286
// Details to determine how long the discount should be applied for.
2287
type InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams struct {
2288
        // Time span for the redeemed discount.
2289
        Duration *InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"`
2290
        // A precise Unix timestamp for the discount to end. Must be in the future.
2291
        Timestamp *int64 `form:"timestamp"`
2292
        // The type of calculation made to determine when the discount ends.
2293
        Type *string `form:"type"`
2294
}
2295

2296
// The coupons to redeem into discounts for the item.
2297
type InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountParams struct {
2298
        // ID of the coupon to create a new discount for.
2299
        Coupon *string `form:"coupon"`
2300
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2301
        Discount *string `form:"discount"`
2302
        // Details to determine how long the discount should be applied for.
2303
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams `form:"discount_end"`
2304
        // ID of the promotion code to create a new discount for.
2305
        PromotionCode *string `form:"promotion_code"`
2306
}
2307

2308
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
2309
type InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemPriceDataParams struct {
2310
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
2311
        Currency *string `form:"currency"`
2312
        // The ID of the product that this price will belong to.
2313
        Product *string `form:"product"`
2314
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
2315
        TaxBehavior *string `form:"tax_behavior"`
2316
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer.
2317
        UnitAmount *int64 `form:"unit_amount"`
2318
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
2319
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
2320
}
2321

2322
// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
2323
type InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemParams struct {
2324
        // The coupons to redeem into discounts for the item.
2325
        Discounts []*InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemDiscountParams `form:"discounts"`
2326
        // The ID of the price object. One of `price` or `price_data` is required.
2327
        Price *string `form:"price"`
2328
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
2329
        PriceData *InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemPriceDataParams `form:"price_data"`
2330
        // Quantity for this item. Defaults to 1.
2331
        Quantity *int64 `form:"quantity"`
2332
        // The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
2333
        TaxRates []*string `form:"tax_rates"`
2334
}
2335

2336
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
2337
type InvoiceUpcomingLinesScheduleDetailsPhaseAutomaticTaxLiabilityParams struct {
2338
        // The connected account being referenced when `type` is `account`.
2339
        Account *string `form:"account"`
2340
        // Type of the account referenced in the request.
2341
        Type *string `form:"type"`
2342
}
2343

2344
// Automatic tax settings for this phase.
2345
type InvoiceUpcomingLinesScheduleDetailsPhaseAutomaticTaxParams struct {
2346
        // Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
2347
        Enabled *bool `form:"enabled"`
2348
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
2349
        Liability *InvoiceUpcomingLinesScheduleDetailsPhaseAutomaticTaxLiabilityParams `form:"liability"`
2350
}
2351

2352
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
2353
type InvoiceUpcomingLinesScheduleDetailsPhaseBillingThresholdsParams struct {
2354
        // Monetary threshold that triggers the subscription to advance to a new billing period
2355
        AmountGTE *int64 `form:"amount_gte"`
2356
        // Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
2357
        ResetBillingCycleAnchor *bool `form:"reset_billing_cycle_anchor"`
2358
}
2359

2360
// Time span for the redeemed discount.
2361
type InvoiceUpcomingLinesScheduleDetailsPhaseDiscountDiscountEndDurationParams struct {
2362
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2363
        Interval *string `form:"interval"`
2364
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2365
        IntervalCount *int64 `form:"interval_count"`
2366
}
2367

2368
// Details to determine how long the discount should be applied for.
2369
type InvoiceUpcomingLinesScheduleDetailsPhaseDiscountDiscountEndParams struct {
2370
        // Time span for the redeemed discount.
2371
        Duration *InvoiceUpcomingLinesScheduleDetailsPhaseDiscountDiscountEndDurationParams `form:"duration"`
2372
        // A precise Unix timestamp for the discount to end. Must be in the future.
2373
        Timestamp *int64 `form:"timestamp"`
2374
        // The type of calculation made to determine when the discount ends.
2375
        Type *string `form:"type"`
2376
}
2377

2378
// The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
2379
type InvoiceUpcomingLinesScheduleDetailsPhaseDiscountParams struct {
2380
        // ID of the coupon to create a new discount for.
2381
        Coupon *string `form:"coupon"`
2382
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2383
        Discount *string `form:"discount"`
2384
        // Details to determine how long the discount should be applied for.
2385
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsPhaseDiscountDiscountEndParams `form:"discount_end"`
2386
        // ID of the promotion code to create a new discount for.
2387
        PromotionCode *string `form:"promotion_code"`
2388
}
2389

2390
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
2391
type InvoiceUpcomingLinesScheduleDetailsPhaseInvoiceSettingsIssuerParams struct {
2392
        // The connected account being referenced when `type` is `account`.
2393
        Account *string `form:"account"`
2394
        // Type of the account referenced in the request.
2395
        Type *string `form:"type"`
2396
}
2397

2398
// All invoices will be billed using the specified settings.
2399
type InvoiceUpcomingLinesScheduleDetailsPhaseInvoiceSettingsParams struct {
2400
        // The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
2401
        AccountTaxIDs []*string `form:"account_tax_ids"`
2402
        // Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
2403
        DaysUntilDue *int64 `form:"days_until_due"`
2404
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
2405
        Issuer *InvoiceUpcomingLinesScheduleDetailsPhaseInvoiceSettingsIssuerParams `form:"issuer"`
2406
}
2407

2408
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
2409
type InvoiceUpcomingLinesScheduleDetailsPhaseItemBillingThresholdsParams struct {
2410
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
2411
        UsageGTE *int64 `form:"usage_gte"`
2412
}
2413

2414
// Time span for the redeemed discount.
2415
type InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountDiscountEndDurationParams struct {
2416
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2417
        Interval *string `form:"interval"`
2418
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2419
        IntervalCount *int64 `form:"interval_count"`
2420
}
2421

2422
// Details to determine how long the discount should be applied for.
2423
type InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountDiscountEndParams struct {
2424
        // Time span for the redeemed discount.
2425
        Duration *InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountDiscountEndDurationParams `form:"duration"`
2426
        // A precise Unix timestamp for the discount to end. Must be in the future.
2427
        Timestamp *int64 `form:"timestamp"`
2428
        // The type of calculation made to determine when the discount ends.
2429
        Type *string `form:"type"`
2430
}
2431

2432
// The coupons to redeem into discounts for the subscription item.
2433
type InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountParams struct {
2434
        // ID of the coupon to create a new discount for.
2435
        Coupon *string `form:"coupon"`
2436
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2437
        Discount *string `form:"discount"`
2438
        // Details to determine how long the discount should be applied for.
2439
        DiscountEnd *InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountDiscountEndParams `form:"discount_end"`
2440
        // ID of the promotion code to create a new discount for.
2441
        PromotionCode *string `form:"promotion_code"`
2442
}
2443

2444
// The recurring components of a price such as `interval` and `interval_count`.
2445
type InvoiceUpcomingLinesScheduleDetailsPhaseItemPriceDataRecurringParams struct {
2446
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
2447
        Interval *string `form:"interval"`
2448
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
2449
        IntervalCount *int64 `form:"interval_count"`
2450
}
2451

2452
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
2453
type InvoiceUpcomingLinesScheduleDetailsPhaseItemPriceDataParams struct {
2454
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
2455
        Currency *string `form:"currency"`
2456
        // The ID of the product that this price will belong to.
2457
        Product *string `form:"product"`
2458
        // The recurring components of a price such as `interval` and `interval_count`.
2459
        Recurring *InvoiceUpcomingLinesScheduleDetailsPhaseItemPriceDataRecurringParams `form:"recurring"`
2460
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
2461
        TaxBehavior *string `form:"tax_behavior"`
2462
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
2463
        UnitAmount *int64 `form:"unit_amount"`
2464
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
2465
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
2466
}
2467

2468
// Options that configure the trial on the subscription item.
2469
type InvoiceUpcomingLinesScheduleDetailsPhaseItemTrialParams struct {
2470
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
2471
        ConvertsTo []*string `form:"converts_to"`
2472
        // Determines the type of trial for this item.
2473
        Type *string `form:"type"`
2474
}
2475

2476
// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
2477
type InvoiceUpcomingLinesScheduleDetailsPhaseItemParams struct {
2478
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
2479
        BillingThresholds *InvoiceUpcomingLinesScheduleDetailsPhaseItemBillingThresholdsParams `form:"billing_thresholds"`
2480
        // The coupons to redeem into discounts for the subscription item.
2481
        Discounts []*InvoiceUpcomingLinesScheduleDetailsPhaseItemDiscountParams `form:"discounts"`
2482
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
2483
        Metadata map[string]string `form:"metadata"`
2484
        // The plan ID to subscribe to. You may specify the same ID in `plan` and `price`.
2485
        Plan *string `form:"plan"`
2486
        // The ID of the price object.
2487
        Price *string `form:"price"`
2488
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
2489
        PriceData *InvoiceUpcomingLinesScheduleDetailsPhaseItemPriceDataParams `form:"price_data"`
2490
        // Quantity for the given price. Can be set only if the price's `usage_type` is `licensed` and not `metered`.
2491
        Quantity *int64 `form:"quantity"`
2492
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
2493
        TaxRates []*string `form:"tax_rates"`
2494
        // Options that configure the trial on the subscription item.
2495
        Trial *InvoiceUpcomingLinesScheduleDetailsPhaseItemTrialParams `form:"trial"`
2496
}
2497

2498
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
2499
func (p *InvoiceUpcomingLinesScheduleDetailsPhaseItemParams) AddMetadata(key string, value string) {
×
UNCOV
2500
        if p.Metadata == nil {
×
UNCOV
2501
                p.Metadata = make(map[string]string)
×
UNCOV
2502
        }
×
2503

2504
        p.Metadata[key] = value
×
2505
}
2506

2507
// If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
2508
type InvoiceUpcomingLinesScheduleDetailsPhasePauseCollectionParams struct {
2509
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
2510
        Behavior *string `form:"behavior"`
2511
}
2512

2513
// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
2514
type InvoiceUpcomingLinesScheduleDetailsPhaseTransferDataParams struct {
2515
        // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
2516
        AmountPercent *float64 `form:"amount_percent"`
2517
        // ID of an existing, connected Stripe account.
2518
        Destination *string `form:"destination"`
2519
}
2520

2521
// Defines how the subscription should behave when a trial ends.
2522
type InvoiceUpcomingLinesScheduleDetailsPhaseTrialSettingsEndBehaviorParams struct {
2523
        // Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
2524
        ProrateUpFront *string `form:"prorate_up_front"`
2525
}
2526

2527
// Settings related to subscription trials.
2528
type InvoiceUpcomingLinesScheduleDetailsPhaseTrialSettingsParams struct {
2529
        // Defines how the subscription should behave when a trial ends.
2530
        EndBehavior *InvoiceUpcomingLinesScheduleDetailsPhaseTrialSettingsEndBehaviorParams `form:"end_behavior"`
2531
}
2532

2533
// List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
2534
type InvoiceUpcomingLinesScheduleDetailsPhaseParams struct {
2535
        // A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
2536
        AddInvoiceItems []*InvoiceUpcomingLinesScheduleDetailsPhaseAddInvoiceItemParams `form:"add_invoice_items"`
2537
        // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
2538
        ApplicationFeePercent *float64 `form:"application_fee_percent"`
2539
        // Automatic tax settings for this phase.
2540
        AutomaticTax *InvoiceUpcomingLinesScheduleDetailsPhaseAutomaticTaxParams `form:"automatic_tax"`
2541
        // Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
2542
        BillingCycleAnchor *string `form:"billing_cycle_anchor"`
2543
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
2544
        BillingThresholds *InvoiceUpcomingLinesScheduleDetailsPhaseBillingThresholdsParams `form:"billing_thresholds"`
2545
        // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
2546
        CollectionMethod *string `form:"collection_method"`
2547
        // The ID of the coupon to apply to this phase of the subscription schedule. This field has been deprecated and will be removed in a future API version. Use `discounts` instead.
2548
        Coupon *string `form:"coupon"`
2549
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
2550
        Currency *string `form:"currency"`
2551
        // ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
2552
        DefaultPaymentMethod *string `form:"default_payment_method"`
2553
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
2554
        DefaultTaxRates []*string `form:"default_tax_rates"`
2555
        // Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
2556
        Description *string `form:"description"`
2557
        // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
2558
        Discounts []*InvoiceUpcomingLinesScheduleDetailsPhaseDiscountParams `form:"discounts"`
2559
        // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set.
2560
        EndDate    *int64 `form:"end_date"`
2561
        EndDateNow *bool  `form:"-"` // See custom AppendTo
2562
        // All invoices will be billed using the specified settings.
2563
        InvoiceSettings *InvoiceUpcomingLinesScheduleDetailsPhaseInvoiceSettingsParams `form:"invoice_settings"`
2564
        // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
2565
        Items []*InvoiceUpcomingLinesScheduleDetailsPhaseItemParams `form:"items"`
2566
        // Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set.
2567
        Iterations *int64 `form:"iterations"`
2568
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`. Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`. To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
2569
        Metadata map[string]string `form:"metadata"`
2570
        // The account on behalf of which to charge, for each of the associated subscription's invoices.
2571
        OnBehalfOf *string `form:"on_behalf_of"`
2572
        // If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
2573
        PauseCollection *InvoiceUpcomingLinesScheduleDetailsPhasePauseCollectionParams `form:"pause_collection"`
2574
        // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
2575
        ProrationBehavior *string `form:"proration_behavior"`
2576
        // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
2577
        StartDate    *int64 `form:"start_date"`
2578
        StartDateNow *bool  `form:"-"` // See custom AppendTo
2579
        // The data with which to automatically create a Transfer for each of the associated subscription's invoices.
2580
        TransferData *InvoiceUpcomingLinesScheduleDetailsPhaseTransferDataParams `form:"transfer_data"`
2581
        // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
2582
        Trial *bool `form:"trial"`
2583
        // Specify trial behavior when crossing phase boundaries
2584
        TrialContinuation *string `form:"trial_continuation"`
2585
        // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
2586
        TrialEnd    *int64 `form:"trial_end"`
2587
        TrialEndNow *bool  `form:"-"` // See custom AppendTo
2588
        // Settings related to subscription trials.
2589
        TrialSettings *InvoiceUpcomingLinesScheduleDetailsPhaseTrialSettingsParams `form:"trial_settings"`
2590
}
2591

2592
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
2593
func (p *InvoiceUpcomingLinesScheduleDetailsPhaseParams) AddMetadata(key string, value string) {
×
UNCOV
2594
        if p.Metadata == nil {
×
UNCOV
2595
                p.Metadata = make(map[string]string)
×
UNCOV
2596
        }
×
2597

2598
        p.Metadata[key] = value
×
2599
}
2600

2601
// AppendTo implements custom encoding logic for InvoiceUpcomingLinesScheduleDetailsPhaseParams.
UNCOV
2602
func (p *InvoiceUpcomingLinesScheduleDetailsPhaseParams) AppendTo(body *form.Values, keyParts []string) {
×
2603
        if BoolValue(p.EndDateNow) {
×
UNCOV
2604
                body.Add(form.FormatKey(append(keyParts, "end_date")), "now")
×
UNCOV
2605
        }
×
UNCOV
2606
        if BoolValue(p.StartDateNow) {
×
2607
                body.Add(form.FormatKey(append(keyParts, "start_date")), "now")
×
2608
        }
×
2609
        if BoolValue(p.TrialEndNow) {
×
2610
                body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")
×
2611
        }
×
2612
}
2613

2614
// End the prebilled period when a specified amendment ends.
2615
type InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilAmendmentEndParams struct {
2616
        // The position of the amendment in the `amendments` array at which prebilling should end. Indexes start from 0 and must be less than the total number of supplied amendments.
2617
        Index *int64 `form:"index"`
2618
}
2619

2620
// Time span for prebilling, starting from `bill_from`.
2621
type InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilDurationParams struct {
2622
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2623
        Interval *string `form:"interval"`
2624
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2625
        IntervalCount *int64 `form:"interval_count"`
2626
}
2627

2628
// The end of the prebilled time period.
2629
type InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilParams struct {
2630
        // End the prebilled period when a specified amendment ends.
2631
        AmendmentEnd *InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilAmendmentEndParams `form:"amendment_end"`
2632
        // Time span for prebilling, starting from `bill_from`.
2633
        Duration *InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilDurationParams `form:"duration"`
2634
        // End the prebilled period at a precise integer timestamp, starting from the Unix epoch.
2635
        Timestamp *int64 `form:"timestamp"`
2636
        // Select one of several ways to pass the `bill_until` value.
2637
        Type *string `form:"type"`
2638
}
2639

2640
// Provide any time periods to bill in advance.
2641
type InvoiceUpcomingLinesScheduleDetailsPrebillingParams struct {
2642
        // The end of the prebilled time period.
2643
        BillUntil *InvoiceUpcomingLinesScheduleDetailsPrebillingBillUntilParams `form:"bill_until"`
2644
        // This is used to determine the number of billing cycles to prebill.
2645
        Iterations *int64 `form:"iterations"`
2646
}
2647

2648
// The schedule creation or modification params to apply as a preview. Cannot be used with `subscription` or `subscription_` prefixed fields.
2649
type InvoiceUpcomingLinesScheduleDetailsParams struct {
2650
        // Changes to apply to the phases of the subscription schedule, in the order provided.
2651
        Amendments []*InvoiceUpcomingLinesScheduleDetailsAmendmentParams `form:"amendments"`
2652
        // Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
2653
        BillingBehavior *string `form:"billing_behavior"`
2654
        // Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running. `cancel` will end the subscription schedule and cancel the underlying subscription.
2655
        EndBehavior *string `form:"end_behavior"`
2656
        // List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
2657
        Phases []*InvoiceUpcomingLinesScheduleDetailsPhaseParams `form:"phases"`
2658
        // Provide any time periods to bill in advance.
2659
        Prebilling []*InvoiceUpcomingLinesScheduleDetailsPrebillingParams `form:"prebilling"`
2660
        // In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request.
2661
        ProrationBehavior *string `form:"proration_behavior"`
2662
}
2663

2664
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
2665
type InvoiceUpcomingLinesSubscriptionDetailsItemBillingThresholdsParams struct {
2666
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
2667
        UsageGTE *int64 `form:"usage_gte"`
2668
}
2669

2670
// Time span for the redeemed discount.
2671
type InvoiceUpcomingLinesSubscriptionDetailsItemDiscountDiscountEndDurationParams struct {
2672
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2673
        Interval *string `form:"interval"`
2674
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2675
        IntervalCount *int64 `form:"interval_count"`
2676
}
2677

2678
// Details to determine how long the discount should be applied for.
2679
type InvoiceUpcomingLinesSubscriptionDetailsItemDiscountDiscountEndParams struct {
2680
        // Time span for the redeemed discount.
2681
        Duration *InvoiceUpcomingLinesSubscriptionDetailsItemDiscountDiscountEndDurationParams `form:"duration"`
2682
        // A precise Unix timestamp for the discount to end. Must be in the future.
2683
        Timestamp *int64 `form:"timestamp"`
2684
        // The type of calculation made to determine when the discount ends.
2685
        Type *string `form:"type"`
2686
}
2687

2688
// The coupons to redeem into discounts for the subscription item.
2689
type InvoiceUpcomingLinesSubscriptionDetailsItemDiscountParams struct {
2690
        // ID of the coupon to create a new discount for.
2691
        Coupon *string `form:"coupon"`
2692
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2693
        Discount *string `form:"discount"`
2694
        // Details to determine how long the discount should be applied for.
2695
        DiscountEnd *InvoiceUpcomingLinesSubscriptionDetailsItemDiscountDiscountEndParams `form:"discount_end"`
2696
        // ID of the promotion code to create a new discount for.
2697
        PromotionCode *string `form:"promotion_code"`
2698
}
2699

2700
// The recurring components of a price such as `interval` and `interval_count`.
2701
type InvoiceUpcomingLinesSubscriptionDetailsItemPriceDataRecurringParams struct {
2702
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
2703
        Interval *string `form:"interval"`
2704
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
2705
        IntervalCount *int64 `form:"interval_count"`
2706
}
2707

2708
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
2709
type InvoiceUpcomingLinesSubscriptionDetailsItemPriceDataParams struct {
2710
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
2711
        Currency *string `form:"currency"`
2712
        // The ID of the product that this price will belong to.
2713
        Product *string `form:"product"`
2714
        // The recurring components of a price such as `interval` and `interval_count`.
2715
        Recurring *InvoiceUpcomingLinesSubscriptionDetailsItemPriceDataRecurringParams `form:"recurring"`
2716
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
2717
        TaxBehavior *string `form:"tax_behavior"`
2718
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
2719
        UnitAmount *int64 `form:"unit_amount"`
2720
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
2721
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
2722
}
2723

2724
// A list of up to 20 subscription items, each with an attached price.
2725
type InvoiceUpcomingLinesSubscriptionDetailsItemParams struct {
2726
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
2727
        BillingThresholds *InvoiceUpcomingLinesSubscriptionDetailsItemBillingThresholdsParams `form:"billing_thresholds"`
2728
        // Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`.
2729
        ClearUsage *bool `form:"clear_usage"`
2730
        // A flag that, if set to `true`, will delete the specified item.
2731
        Deleted *bool `form:"deleted"`
2732
        // The coupons to redeem into discounts for the subscription item.
2733
        Discounts []*InvoiceUpcomingLinesSubscriptionDetailsItemDiscountParams `form:"discounts"`
2734
        // Subscription item to update.
2735
        ID *string `form:"id"`
2736
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
2737
        Metadata map[string]string `form:"metadata"`
2738
        // Plan ID for this item, as a string.
2739
        Plan *string `form:"plan"`
2740
        // The ID of the price object. One of `price` or `price_data` is required. When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided.
2741
        Price *string `form:"price"`
2742
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
2743
        PriceData *InvoiceUpcomingLinesSubscriptionDetailsItemPriceDataParams `form:"price_data"`
2744
        // Quantity for this item.
2745
        Quantity *int64 `form:"quantity"`
2746
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
2747
        TaxRates []*string `form:"tax_rates"`
2748
}
2749

2750
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
2751
func (p *InvoiceUpcomingLinesSubscriptionDetailsItemParams) AddMetadata(key string, value string) {
×
UNCOV
2752
        if p.Metadata == nil {
×
UNCOV
2753
                p.Metadata = make(map[string]string)
×
UNCOV
2754
        }
×
2755

2756
        p.Metadata[key] = value
×
2757
}
2758

2759
// The pre-billing to apply to the subscription as a preview.
2760
type InvoiceUpcomingLinesSubscriptionDetailsPrebillingParams struct {
2761
        // This is used to determine the number of billing cycles to prebill.
2762
        Iterations *int64 `form:"iterations"`
2763
}
2764

2765
// The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields.
2766
type InvoiceUpcomingLinesSubscriptionDetailsParams struct {
2767
        // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://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`.
2768
        BillingCycleAnchor          *int64 `form:"billing_cycle_anchor"`
2769
        BillingCycleAnchorNow       *bool  `form:"-"` // See custom AppendTo
2770
        BillingCycleAnchorUnchanged *bool  `form:"-"` // See custom AppendTo
2771
        // 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.
2772
        CancelAt *int64 `form:"cancel_at"`
2773
        // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
2774
        CancelAtPeriodEnd *bool `form:"cancel_at_period_end"`
2775
        // This simulates the subscription being canceled or expired immediately.
2776
        CancelNow *bool `form:"cancel_now"`
2777
        // 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.
2778
        DefaultTaxRates []*string `form:"default_tax_rates"`
2779
        // A list of up to 20 subscription items, each with an attached price.
2780
        Items []*InvoiceUpcomingLinesSubscriptionDetailsItemParams `form:"items"`
2781
        // The pre-billing to apply to the subscription as a preview.
2782
        Prebilling *InvoiceUpcomingLinesSubscriptionDetailsPrebillingParams `form:"prebilling"`
2783
        // Determines how to handle [prorations](https://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`.
2784
        ProrationBehavior *string `form:"proration_behavior"`
2785
        // 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'.
2786
        ProrationDate *int64 `form:"proration_date"`
2787
        // For paused subscriptions, setting `subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed.
2788
        ResumeAt *string `form:"resume_at"`
2789
        // Date a subscription is intended to start (can be future or past).
2790
        StartDate *int64 `form:"start_date"`
2791
        // 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.
2792
        TrialEnd    *int64 `form:"trial_end"`
2793
        TrialEndNow *bool  `form:"-"` // See custom AppendTo
2794
}
2795

2796
// AppendTo implements custom encoding logic for InvoiceUpcomingLinesSubscriptionDetailsParams.
UNCOV
2797
func (p *InvoiceUpcomingLinesSubscriptionDetailsParams) AppendTo(body *form.Values, keyParts []string) {
×
UNCOV
2798
        if BoolValue(p.BillingCycleAnchorNow) {
×
UNCOV
2799
                body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "now")
×
UNCOV
2800
        }
×
UNCOV
2801
        if BoolValue(p.BillingCycleAnchorUnchanged) {
×
2802
                body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "unchanged")
×
2803
        }
×
2804
        if BoolValue(p.TrialEndNow) {
×
2805
                body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")
×
2806
        }
×
2807
}
2808

2809
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
2810
type InvoiceUpcomingLinesSubscriptionItemBillingThresholdsParams struct {
2811
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
2812
        UsageGTE *int64 `form:"usage_gte"`
2813
}
2814

2815
// Time span for the redeemed discount.
2816
type InvoiceUpcomingLinesSubscriptionItemDiscountDiscountEndDurationParams struct {
2817
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2818
        Interval *string `form:"interval"`
2819
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2820
        IntervalCount *int64 `form:"interval_count"`
2821
}
2822

2823
// Details to determine how long the discount should be applied for.
2824
type InvoiceUpcomingLinesSubscriptionItemDiscountDiscountEndParams struct {
2825
        // Time span for the redeemed discount.
2826
        Duration *InvoiceUpcomingLinesSubscriptionItemDiscountDiscountEndDurationParams `form:"duration"`
2827
        // A precise Unix timestamp for the discount to end. Must be in the future.
2828
        Timestamp *int64 `form:"timestamp"`
2829
        // The type of calculation made to determine when the discount ends.
2830
        Type *string `form:"type"`
2831
}
2832

2833
// The coupons to redeem into discounts for the subscription item.
2834
type InvoiceUpcomingLinesSubscriptionItemDiscountParams struct {
2835
        // ID of the coupon to create a new discount for.
2836
        Coupon *string `form:"coupon"`
2837
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
2838
        Discount *string `form:"discount"`
2839
        // Details to determine how long the discount should be applied for.
2840
        DiscountEnd *InvoiceUpcomingLinesSubscriptionItemDiscountDiscountEndParams `form:"discount_end"`
2841
        // ID of the promotion code to create a new discount for.
2842
        PromotionCode *string `form:"promotion_code"`
2843
}
2844

2845
// The recurring components of a price such as `interval` and `interval_count`.
2846
type InvoiceUpcomingLinesSubscriptionItemPriceDataRecurringParams struct {
2847
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
2848
        Interval *string `form:"interval"`
2849
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
2850
        IntervalCount *int64 `form:"interval_count"`
2851
}
2852

2853
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
2854
type InvoiceUpcomingLinesSubscriptionItemPriceDataParams struct {
2855
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
2856
        Currency *string `form:"currency"`
2857
        // The ID of the product that this price will belong to.
2858
        Product *string `form:"product"`
2859
        // The recurring components of a price such as `interval` and `interval_count`.
2860
        Recurring *InvoiceUpcomingLinesSubscriptionItemPriceDataRecurringParams `form:"recurring"`
2861
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
2862
        TaxBehavior *string `form:"tax_behavior"`
2863
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
2864
        UnitAmount *int64 `form:"unit_amount"`
2865
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
2866
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
2867
}
2868

2869
// A list of up to 20 subscription items, each with an attached price. This field has been deprecated and will be removed in a future API version. Use `subscription_details.items` instead.
2870
type InvoiceUpcomingLinesSubscriptionItemParams struct {
2871
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
2872
        BillingThresholds *InvoiceUpcomingLinesSubscriptionItemBillingThresholdsParams `form:"billing_thresholds"`
2873
        // Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`.
2874
        ClearUsage *bool `form:"clear_usage"`
2875
        // A flag that, if set to `true`, will delete the specified item.
2876
        Deleted *bool `form:"deleted"`
2877
        // The coupons to redeem into discounts for the subscription item.
2878
        Discounts []*InvoiceUpcomingLinesSubscriptionItemDiscountParams `form:"discounts"`
2879
        // Subscription item to update.
2880
        ID *string `form:"id"`
2881
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
2882
        Metadata map[string]string `form:"metadata"`
2883
        // Plan ID for this item, as a string.
2884
        Plan *string `form:"plan"`
2885
        // The ID of the price object. One of `price` or `price_data` is required. When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided.
2886
        Price *string `form:"price"`
2887
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
2888
        PriceData *InvoiceUpcomingLinesSubscriptionItemPriceDataParams `form:"price_data"`
2889
        // Quantity for this item.
2890
        Quantity *int64 `form:"quantity"`
2891
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
2892
        TaxRates []*string `form:"tax_rates"`
2893
}
2894

2895
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
2896
func (p *InvoiceUpcomingLinesSubscriptionItemParams) AddMetadata(key string, value string) {
×
UNCOV
2897
        if p.Metadata == nil {
×
UNCOV
2898
                p.Metadata = make(map[string]string)
×
UNCOV
2899
        }
×
2900

2901
        p.Metadata[key] = value
×
2902
}
2903

2904
// The pre-billing to apply to the subscription as a preview. This field has been deprecated and will be removed in a future API version. Use `subscription_details.prebilling` instead.
2905
type InvoiceUpcomingLinesSubscriptionPrebillingParams struct {
2906
        // This is used to determine the number of billing cycles to prebill.
2907
        Iterations *int64 `form:"iterations"`
2908
}
2909

2910
// When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
2911
type InvoiceUpcomingLinesParams struct {
2912
        ListParams `form:"*"`
2913
        // Settings for automatic tax lookup for this invoice preview.
2914
        AutomaticTax *InvoiceUpcomingLinesAutomaticTaxParams `form:"automatic_tax"`
2915
        // The ID of the coupon to apply to this phase of the subscription schedule. This field has been deprecated and will be removed in a future API version. Use `discounts` instead.
2916
        Coupon *string `form:"coupon"`
2917
        // The currency to preview this invoice in. Defaults to that of `customer` if not specified.
2918
        Currency *string `form:"currency"`
2919
        // 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.
2920
        Customer *string `form:"customer"`
2921
        // 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.
2922
        CustomerDetails *InvoiceUpcomingLinesCustomerDetailsParams `form:"customer_details"`
2923
        // 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.
2924
        Discounts []*InvoiceUpcomingLinesDiscountParams `form:"discounts"`
2925
        // Specifies which fields in the response should be expanded.
2926
        Expand []*string `form:"expand"`
2927
        // List of invoice items to add or update in the upcoming invoice preview (up to 250).
2928
        InvoiceItems []*InvoiceUpcomingLinesInvoiceItemParams `form:"invoice_items"`
2929
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
2930
        Issuer *InvoiceUpcomingLinesIssuerParams `form:"issuer"`
2931
        // 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](https://stripe.com/docs/billing/invoices/connect) documentation for details.
2932
        OnBehalfOf *string `form:"on_behalf_of"`
2933
        // Customizes the types of values to include when calculating the invoice. Defaults to `next` if unspecified.
2934
        PreviewMode *string `form:"preview_mode"`
2935
        // The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields.
2936
        Schedule *string `form:"schedule"`
2937
        // The schedule creation or modification params to apply as a preview. Cannot be used with `subscription` or `subscription_` prefixed fields.
2938
        ScheduleDetails *InvoiceUpcomingLinesScheduleDetailsParams `form:"schedule_details"`
2939
        // 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.
2940
        Subscription *string `form:"subscription"`
2941
        // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://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`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.billing_cycle_anchor` instead.
2942
        SubscriptionBillingCycleAnchor          *int64 `form:"subscription_billing_cycle_anchor"`
2943
        SubscriptionBillingCycleAnchorNow       *bool  `form:"-"` // See custom AppendTo
2944
        SubscriptionBillingCycleAnchorUnchanged *bool  `form:"-"` // See custom AppendTo
2945
        // 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. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at` instead.
2946
        SubscriptionCancelAt *int64 `form:"subscription_cancel_at"`
2947
        // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_at_period_end` instead.
2948
        SubscriptionCancelAtPeriodEnd *bool `form:"subscription_cancel_at_period_end"`
2949
        // This simulates the subscription being canceled or expired immediately. This field has been deprecated and will be removed in a future API version. Use `subscription_details.cancel_now` instead.
2950
        SubscriptionCancelNow *bool `form:"subscription_cancel_now"`
2951
        // 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. This field has been deprecated and will be removed in a future API version. Use `subscription_details.default_tax_rates` instead.
2952
        SubscriptionDefaultTaxRates []*string `form:"subscription_default_tax_rates"`
2953
        // The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields.
2954
        SubscriptionDetails *InvoiceUpcomingLinesSubscriptionDetailsParams `form:"subscription_details"`
2955
        // A list of up to 20 subscription items, each with an attached price. This field has been deprecated and will be removed in a future API version. Use `subscription_details.items` instead.
2956
        SubscriptionItems []*InvoiceUpcomingLinesSubscriptionItemParams `form:"subscription_items"`
2957
        // The pre-billing to apply to the subscription as a preview. This field has been deprecated and will be removed in a future API version. Use `subscription_details.prebilling` instead.
2958
        SubscriptionPrebilling *InvoiceUpcomingLinesSubscriptionPrebillingParams `form:"subscription_prebilling"`
2959
        // Determines how to handle [prorations](https://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`. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_behavior` instead.
2960
        SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"`
2961
        // If previewing an update to a subscription, and doing proration, `subscription_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_items`, or `subscription_trial_end` are required. Also, `subscription_proration_behavior` cannot be set to 'none'. This field has been deprecated and will be removed in a future API version. Use `subscription_details.proration_date` instead.
2962
        SubscriptionProrationDate *int64 `form:"subscription_proration_date"`
2963
        // For paused subscriptions, setting `subscription_resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed. This field has been deprecated and will be removed in a future API version. Use `subscription_details.resume_at` instead.
2964
        SubscriptionResumeAt *string `form:"subscription_resume_at"`
2965
        // Date a subscription is intended to start (can be future or past). This field has been deprecated and will be removed in a future API version. Use `subscription_details.start_date` instead.
2966
        SubscriptionStartDate *int64 `form:"subscription_start_date"`
2967
        // If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of `subscription_items` or `subscription` is required. This field has been deprecated and will be removed in a future API version. Use `subscription_details.trial_end` instead.
2968
        SubscriptionTrialEnd    *int64 `form:"subscription_trial_end"`
2969
        SubscriptionTrialEndNow *bool  `form:"-"` // See custom AppendTo
2970
        // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `subscription_trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `subscription_trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more.
2971
        SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"`
2972
}
2973

2974
// AddExpand appends a new field to expand.
UNCOV
2975
func (p *InvoiceUpcomingLinesParams) AddExpand(f string) {
×
UNCOV
2976
        p.Expand = append(p.Expand, &f)
×
UNCOV
2977
}
×
2978

2979
// AppendTo implements custom encoding logic for InvoiceUpcomingLinesParams.
2980
func (p *InvoiceUpcomingLinesParams) AppendTo(body *form.Values, keyParts []string) {
×
2981
        if BoolValue(p.SubscriptionBillingCycleAnchorNow) {
×
2982
                body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "now")
×
UNCOV
2983
        }
×
UNCOV
2984
        if BoolValue(p.SubscriptionBillingCycleAnchorUnchanged) {
×
2985
                body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "unchanged")
×
2986
        }
×
2987
        if BoolValue(p.SubscriptionTrialEndNow) {
×
2988
                body.Add(form.FormatKey(append(keyParts, "subscription_trial_end")), "now")
×
2989
        }
×
2990
}
2991

2992
// Time span for the redeemed discount.
2993
type InvoiceAddLinesLineDiscountDiscountEndDurationParams struct {
2994
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
2995
        Interval *string `form:"interval"`
2996
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
2997
        IntervalCount *int64 `form:"interval_count"`
2998
}
2999

3000
// Details to determine how long the discount should be applied for.
3001
type InvoiceAddLinesLineDiscountDiscountEndParams struct {
3002
        // Time span for the redeemed discount.
3003
        Duration *InvoiceAddLinesLineDiscountDiscountEndDurationParams `form:"duration"`
3004
        // A precise Unix timestamp for the discount to end. Must be in the future.
3005
        Timestamp *int64 `form:"timestamp"`
3006
        // The type of calculation made to determine when the discount ends.
3007
        Type *string `form:"type"`
3008
}
3009

3010
// The coupons, promotion codes & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts.
3011
type InvoiceAddLinesLineDiscountParams struct {
3012
        // ID of the coupon to create a new discount for.
3013
        Coupon *string `form:"coupon"`
3014
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
3015
        Discount *string `form:"discount"`
3016
        // Details to determine how long the discount should be applied for.
3017
        DiscountEnd *InvoiceAddLinesLineDiscountDiscountEndParams `form:"discount_end"`
3018
        // ID of the promotion code to create a new discount for.
3019
        PromotionCode *string `form:"promotion_code"`
3020
}
3021

3022
// The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
3023
type InvoiceAddLinesLinePeriodParams struct {
3024
        // The end of the period, which must be greater than or equal to the start. This value is inclusive.
3025
        End *int64 `form:"end"`
3026
        // The start of the period. This value is inclusive.
3027
        Start *int64 `form:"start"`
3028
}
3029

3030
// Data used to generate a new product object inline. One of `product` or `product_data` is required.
3031
type InvoiceAddLinesLinePriceDataProductDataParams struct {
3032
        // The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
3033
        Description *string `form:"description"`
3034
        // A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
3035
        Images []*string `form:"images"`
3036
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3037
        Metadata map[string]string `form:"metadata"`
3038
        // The product's name, meant to be displayable to the customer.
3039
        Name *string `form:"name"`
3040
        // A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
3041
        TaxCode *string `form:"tax_code"`
3042
}
3043

3044
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3045
func (p *InvoiceAddLinesLinePriceDataProductDataParams) AddMetadata(key string, value string) {
×
UNCOV
3046
        if p.Metadata == nil {
×
UNCOV
3047
                p.Metadata = make(map[string]string)
×
UNCOV
3048
        }
×
3049

3050
        p.Metadata[key] = value
×
3051
}
3052

3053
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
3054
type InvoiceAddLinesLinePriceDataParams struct {
3055
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
3056
        Currency *string `form:"currency"`
3057
        // The ID of the product that this price will belong to. One of `product` or `product_data` is required.
3058
        Product *string `form:"product"`
3059
        // Data used to generate a new product object inline. One of `product` or `product_data` is required.
3060
        ProductData *InvoiceAddLinesLinePriceDataProductDataParams `form:"product_data"`
3061
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
3062
        TaxBehavior *string `form:"tax_behavior"`
3063
        // A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required.
3064
        UnitAmount *int64 `form:"unit_amount"`
3065
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
3066
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
3067
}
3068

3069
// Data to find or create a TaxRate object.
3070
//
3071
// Stripe automatically creates or reuses a TaxRate object for each tax amount. If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item's `tax_rates`, and cannot be directly added to invoices, payments, or line items.
3072
type InvoiceAddLinesLineTaxAmountTaxRateDataParams struct {
3073
        // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
3074
        Country *string `form:"country"`
3075
        // An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
3076
        Description *string `form:"description"`
3077
        // The display name of the tax rate, which will be shown to users.
3078
        DisplayName *string `form:"display_name"`
3079
        // This specifies if the tax rate is inclusive or exclusive.
3080
        Inclusive *bool `form:"inclusive"`
3081
        // The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer's invoice.
3082
        Jurisdiction *string `form:"jurisdiction"`
3083
        // The statutory tax rate percent. This field accepts decimal values between 0 and 100 inclusive with at most 4 decimal places. To accommodate fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages on the invoice unless the `amount` of the tax is also zero.
3084
        Percentage *float64 `form:"percentage"`
3085
        // [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States.
3086
        State *string `form:"state"`
3087
        // The high-level tax type, such as `vat` or `sales_tax`.
3088
        TaxType *string `form:"tax_type"`
3089
}
3090

3091
// A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on your own or use a third-party to calculate them. You cannot set tax amounts if any line item has [tax_rates](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://stripe.com/docs/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://stripe.com/docs/tax/invoicing). Pass an empty string to remove previously defined tax amounts.
3092
type InvoiceAddLinesLineTaxAmountParams struct {
3093
        // The amount, in cents (or local equivalent), of the tax.
3094
        Amount *int64 `form:"amount"`
3095
        // The amount on which tax is calculated, in cents (or local equivalent).
3096
        TaxableAmount *int64 `form:"taxable_amount"`
3097
        // Data to find or create a TaxRate object.
3098
        //
3099
        // Stripe automatically creates or reuses a TaxRate object for each tax amount. If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item's `tax_rates`, and cannot be directly added to invoices, payments, or line items.
3100
        TaxRateData *InvoiceAddLinesLineTaxAmountTaxRateDataParams `form:"tax_rate_data"`
3101
}
3102

3103
// The line items to add.
3104
type InvoiceAddLinesLineParams struct {
3105
        // The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer's account, pass a negative amount.
3106
        Amount *int64 `form:"amount"`
3107
        // An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
3108
        Description *string `form:"description"`
3109
        // Controls whether discounts apply to this line item. Defaults to false for prorations or negative line items, and true for all other line items. Cannot be set to true for prorations.
3110
        Discountable *bool `form:"discountable"`
3111
        // The coupons, promotion codes & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts.
3112
        Discounts []*InvoiceAddLinesLineDiscountParams `form:"discounts"`
3113
        // ID of an unassigned invoice item to assign to this invoice. If not provided, a new item will be created.
3114
        InvoiceItem *string `form:"invoice_item"`
3115
        // The IDs of the margins to apply to the line item. When set, the `default_margins` on the invoice do not apply to this line item.
3116
        Margins []*string `form:"margins"`
3117
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3118
        Metadata map[string]string `form:"metadata"`
3119
        // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
3120
        Period *InvoiceAddLinesLinePeriodParams `form:"period"`
3121
        // The ID of the price object. One of `price` or `price_data` is required.
3122
        Price *string `form:"price"`
3123
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
3124
        PriceData *InvoiceAddLinesLinePriceDataParams `form:"price_data"`
3125
        // Non-negative integer. The quantity of units for the line item.
3126
        Quantity *int64 `form:"quantity"`
3127
        // A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on your own or use a third-party to calculate them. You cannot set tax amounts if any line item has [tax_rates](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://stripe.com/docs/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://stripe.com/docs/tax/invoicing). Pass an empty string to remove previously defined tax amounts.
3128
        TaxAmounts []*InvoiceAddLinesLineTaxAmountParams `form:"tax_amounts"`
3129
        // The tax rates which apply to the line item. When set, the `default_tax_rates` on the invoice do not apply to this line item. Pass an empty string to remove previously-defined tax rates.
3130
        TaxRates []*string `form:"tax_rates"`
3131
}
3132

3133
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3134
func (p *InvoiceAddLinesLineParams) AddMetadata(key string, value string) {
×
UNCOV
3135
        if p.Metadata == nil {
×
UNCOV
3136
                p.Metadata = make(map[string]string)
×
UNCOV
3137
        }
×
3138

3139
        p.Metadata[key] = value
×
3140
}
3141

3142
// Adds multiple line items to an invoice. This is only possible when an invoice is still a draft.
3143
type InvoiceAddLinesParams struct {
3144
        Params `form:"*"`
3145
        // Specifies which fields in the response should be expanded.
3146
        Expand []*string `form:"expand"`
3147
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3148
        InvoiceMetadata map[string]string `form:"invoice_metadata"`
3149
        // The line items to add.
3150
        Lines []*InvoiceAddLinesLineParams `form:"lines"`
3151
}
3152

3153
// AddExpand appends a new field to expand.
UNCOV
3154
func (p *InvoiceAddLinesParams) AddExpand(f string) {
×
UNCOV
3155
        p.Expand = append(p.Expand, &f)
×
UNCOV
3156
}
×
3157

3158
// The out of band payment to attach to the invoice.
3159
type InvoiceAttachPaymentOutOfBandPaymentParams struct {
3160
        // The amount that was paid out of band.
3161
        Amount *int64 `form:"amount"`
3162
        // The currency that was paid out of band.
3163
        Currency *string `form:"currency"`
3164
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3165
        Metadata map[string]string `form:"metadata"`
3166
        // The type of money movement for this out of band payment record.
3167
        MoneyMovementType *string `form:"money_movement_type"`
3168
        // The timestamp when this out of band payment was paid.
3169
        PaidAt *int64 `form:"paid_at"`
3170
        // The reference for this out of band payment record.
3171
        PaymentReference *string `form:"payment_reference"`
3172
}
3173

3174
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3175
func (p *InvoiceAttachPaymentOutOfBandPaymentParams) AddMetadata(key string, value string) {
×
UNCOV
3176
        if p.Metadata == nil {
×
UNCOV
3177
                p.Metadata = make(map[string]string)
×
UNCOV
3178
        }
×
3179

3180
        p.Metadata[key] = value
×
3181
}
3182

3183
// Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of payments.
3184
//
3185
// For Out of Band Payment, the payment is credited to the invoice immediately, increasing the amount_paid
3186
// of the invoice and subsequently transitioning the status of the invoice to paid if necessary.
3187
//
3188
// For the PaymentIntent, when the PaymentIntent's status changes to succeeded, the payment is credited
3189
// to the invoice, increasing its amount_paid. When the invoice is fully paid, the
3190
// invoice's status becomes paid.
3191
//
3192
// If the PaymentIntent's status is already succeeded when it's attached, it's
3193
// credited to the invoice immediately.
3194
//
3195
// See: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create) to learn more.
3196
type InvoiceAttachPaymentParams struct {
3197
        Params `form:"*"`
3198
        // The portion of the `amount` on the PaymentIntent or out of band payment to apply to this invoice. It defaults to the entire amount.
3199
        AmountRequested *int64 `form:"amount_requested"`
3200
        // Specifies which fields in the response should be expanded.
3201
        Expand []*string `form:"expand"`
3202
        // The out of band payment to attach to the invoice.
3203
        OutOfBandPayment *InvoiceAttachPaymentOutOfBandPaymentParams `form:"out_of_band_payment"`
3204
        // The ID of the PaymentIntent to attach to the invoice.
3205
        PaymentIntent *string `form:"payment_intent"`
3206
}
3207

3208
// AddExpand appends a new field to expand.
UNCOV
3209
func (p *InvoiceAttachPaymentParams) AddExpand(f string) {
×
UNCOV
3210
        p.Expand = append(p.Expand, &f)
×
UNCOV
3211
}
×
3212

3213
// Attaches a PaymentIntent to the invoice, adding it to the list of payments.
3214
// When the PaymentIntent's status changes to succeeded, the payment is credited
3215
// to the invoice, increasing its amount_paid. When the invoice is fully paid, the
3216
// invoice's status becomes paid.
3217
//
3218
// If the PaymentIntent's status is already succeeded when it is attached, it is
3219
// credited to the invoice immediately.
3220
//
3221
// Related guide: [Create an invoice payment](https://stripe.com/docs/invoicing/payments/create)
3222
type InvoiceAttachPaymentIntentParams struct {
3223
        Params `form:"*"`
3224
        // The portion of the PaymentIntent's `amount` that should be applied to thisinvoice. Defaults to the entire amount.
3225
        AmountRequested *int64 `form:"amount_requested"`
3226
        // Specifies which fields in the response should be expanded.
3227
        Expand []*string `form:"expand"`
3228
        // The ID of the PaymentIntent to attach to the invoice.
3229
        PaymentIntent *string `form:"payment_intent"`
3230
}
3231

3232
// AddExpand appends a new field to expand.
UNCOV
3233
func (p *InvoiceAttachPaymentIntentParams) AddExpand(f string) {
×
UNCOV
3234
        p.Expand = append(p.Expand, &f)
×
UNCOV
3235
}
×
3236

3237
// Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method.
3238
type InvoiceFinalizeInvoiceParams struct {
3239
        Params `form:"*"`
3240
        // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action.
3241
        AutoAdvance *bool `form:"auto_advance"`
3242
        // Specifies which fields in the response should be expanded.
3243
        Expand []*string `form:"expand"`
3244
}
3245

3246
// AddExpand appends a new field to expand.
UNCOV
3247
func (p *InvoiceFinalizeInvoiceParams) AddExpand(f string) {
×
UNCOV
3248
        p.Expand = append(p.Expand, &f)
×
UNCOV
3249
}
×
3250

3251
// Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes.
3252
type InvoiceMarkUncollectibleParams struct {
3253
        Params `form:"*"`
3254
        // Specifies which fields in the response should be expanded.
3255
        Expand []*string `form:"expand"`
3256
}
3257

3258
// AddExpand appends a new field to expand.
UNCOV
3259
func (p *InvoiceMarkUncollectibleParams) AddExpand(f string) {
×
UNCOV
3260
        p.Expand = append(p.Expand, &f)
×
UNCOV
3261
}
×
3262

3263
// Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so.
3264
type InvoicePayParams struct {
3265
        Params `form:"*"`
3266
        // Specifies which fields in the response should be expanded.
3267
        Expand []*string `form:"expand"`
3268
        // In cases where the source used to pay the invoice has insufficient funds, passing `forgive=true` controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. This effectively forgives the difference between the amount available on the source and the amount due.
3269
        //
3270
        // Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the right amount. An example for this case is with ACH Credit Transfers and wires: if the amount wired is less than the amount due by a small amount, you might want to forgive the difference. Defaults to `false`.
3271
        Forgive *bool `form:"forgive"`
3272
        // ID of the mandate to be used for this invoice. It must correspond to the payment method used to pay the invoice, including the payment_method param or the invoice's default_payment_method or default_source, if set.
3273
        Mandate *string `form:"mandate"`
3274
        // Indicates if a customer is on or off-session while an invoice payment is attempted. Defaults to `true` (off-session).
3275
        OffSession *bool `form:"off_session"`
3276
        // Boolean representing whether an invoice is paid outside of Stripe. This will result in no charge being made. Defaults to `false`.
3277
        PaidOutOfBand *bool `form:"paid_out_of_band"`
3278
        // A PaymentMethod to be charged. The PaymentMethod must be the ID of a PaymentMethod belonging to the customer associated with the invoice being paid.
3279
        PaymentMethod *string `form:"payment_method"`
3280
        // A payment source to be charged. The source must be the ID of a source belonging to the customer associated with the invoice being paid.
3281
        Source *string `form:"source"`
3282
}
3283

3284
// AddExpand appends a new field to expand.
UNCOV
3285
func (p *InvoicePayParams) AddExpand(f string) {
×
UNCOV
3286
        p.Expand = append(p.Expand, &f)
×
UNCOV
3287
}
×
3288

3289
// The line items to remove.
3290
type InvoiceRemoveLinesLineParams struct {
3291
        // Either `delete` or `unassign`. Deleted line items are permanently deleted. Unassigned line items can be reassigned to an invoice.
3292
        Behavior *string `form:"behavior"`
3293
        // ID of an existing line item to remove from this invoice.
3294
        ID *string `form:"id"`
3295
}
3296

3297
// Removes multiple line items from an invoice. This is only possible when an invoice is still a draft.
3298
type InvoiceRemoveLinesParams struct {
3299
        Params `form:"*"`
3300
        // Specifies which fields in the response should be expanded.
3301
        Expand []*string `form:"expand"`
3302
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3303
        InvoiceMetadata map[string]string `form:"invoice_metadata"`
3304
        // The line items to remove.
3305
        Lines []*InvoiceRemoveLinesLineParams `form:"lines"`
3306
}
3307

3308
// AddExpand appends a new field to expand.
UNCOV
3309
func (p *InvoiceRemoveLinesParams) AddExpand(f string) {
×
UNCOV
3310
        p.Expand = append(p.Expand, &f)
×
UNCOV
3311
}
×
3312

3313
// Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email.
3314
//
3315
// Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event.
3316
type InvoiceSendInvoiceParams struct {
3317
        Params `form:"*"`
3318
        // Specifies which fields in the response should be expanded.
3319
        Expand []*string `form:"expand"`
3320
}
3321

3322
// AddExpand appends a new field to expand.
UNCOV
3323
func (p *InvoiceSendInvoiceParams) AddExpand(f string) {
×
UNCOV
3324
        p.Expand = append(p.Expand, &f)
×
UNCOV
3325
}
×
3326

3327
// Time span for the redeemed discount.
3328
type InvoiceUpdateLinesLineDiscountDiscountEndDurationParams struct {
3329
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
3330
        Interval *string `form:"interval"`
3331
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
3332
        IntervalCount *int64 `form:"interval_count"`
3333
}
3334

3335
// Details to determine how long the discount should be applied for.
3336
type InvoiceUpdateLinesLineDiscountDiscountEndParams struct {
3337
        // Time span for the redeemed discount.
3338
        Duration *InvoiceUpdateLinesLineDiscountDiscountEndDurationParams `form:"duration"`
3339
        // A precise Unix timestamp for the discount to end. Must be in the future.
3340
        Timestamp *int64 `form:"timestamp"`
3341
        // The type of calculation made to determine when the discount ends.
3342
        Type *string `form:"type"`
3343
}
3344

3345
// The coupons, promotion codes & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts.
3346
type InvoiceUpdateLinesLineDiscountParams struct {
3347
        // ID of the coupon to create a new discount for.
3348
        Coupon *string `form:"coupon"`
3349
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
3350
        Discount *string `form:"discount"`
3351
        // Details to determine how long the discount should be applied for.
3352
        DiscountEnd *InvoiceUpdateLinesLineDiscountDiscountEndParams `form:"discount_end"`
3353
        // ID of the promotion code to create a new discount for.
3354
        PromotionCode *string `form:"promotion_code"`
3355
}
3356

3357
// The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
3358
type InvoiceUpdateLinesLinePeriodParams struct {
3359
        // The end of the period, which must be greater than or equal to the start. This value is inclusive.
3360
        End *int64 `form:"end"`
3361
        // The start of the period. This value is inclusive.
3362
        Start *int64 `form:"start"`
3363
}
3364

3365
// Data used to generate a new product object inline. One of `product` or `product_data` is required.
3366
type InvoiceUpdateLinesLinePriceDataProductDataParams struct {
3367
        // The product's description, meant to be displayable to the customer. Use this field to optionally store a long form explanation of the product being sold for your own rendering purposes.
3368
        Description *string `form:"description"`
3369
        // A list of up to 8 URLs of images for this product, meant to be displayable to the customer.
3370
        Images []*string `form:"images"`
3371
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3372
        Metadata map[string]string `form:"metadata"`
3373
        // The product's name, meant to be displayable to the customer.
3374
        Name *string `form:"name"`
3375
        // A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
3376
        TaxCode *string `form:"tax_code"`
3377
}
3378

3379
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3380
func (p *InvoiceUpdateLinesLinePriceDataProductDataParams) AddMetadata(key string, value string) {
×
UNCOV
3381
        if p.Metadata == nil {
×
UNCOV
3382
                p.Metadata = make(map[string]string)
×
UNCOV
3383
        }
×
3384

3385
        p.Metadata[key] = value
×
3386
}
3387

3388
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
3389
type InvoiceUpdateLinesLinePriceDataParams struct {
3390
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
3391
        Currency *string `form:"currency"`
3392
        // The ID of the product that this price will belong to. One of `product` or `product_data` is required.
3393
        Product *string `form:"product"`
3394
        // Data used to generate a new product object inline. One of `product` or `product_data` is required.
3395
        ProductData *InvoiceUpdateLinesLinePriceDataProductDataParams `form:"product_data"`
3396
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
3397
        TaxBehavior *string `form:"tax_behavior"`
3398
        // A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required.
3399
        UnitAmount *int64 `form:"unit_amount"`
3400
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
3401
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
3402
}
3403

3404
// Data to find or create a TaxRate object.
3405
//
3406
// Stripe automatically creates or reuses a TaxRate object for each tax amount. If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item's `tax_rates`, and cannot be directly added to invoices, payments, or line items.
3407
type InvoiceUpdateLinesLineTaxAmountTaxRateDataParams struct {
3408
        // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
3409
        Country *string `form:"country"`
3410
        // An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers.
3411
        Description *string `form:"description"`
3412
        // The display name of the tax rate, which will be shown to users.
3413
        DisplayName *string `form:"display_name"`
3414
        // This specifies if the tax rate is inclusive or exclusive.
3415
        Inclusive *bool `form:"inclusive"`
3416
        // The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer's invoice.
3417
        Jurisdiction *string `form:"jurisdiction"`
3418
        // The statutory tax rate percent. This field accepts decimal values between 0 and 100 inclusive with at most 4 decimal places. To accommodate fixed-amount taxes, set the percentage to zero. Stripe will not display zero percentages on the invoice unless the `amount` of the tax is also zero.
3419
        Percentage *float64 `form:"percentage"`
3420
        // [ISO 3166-2 subdivision code](https://en.wikipedia.org/wiki/ISO_3166-2:US), without country prefix. For example, "NY" for New York, United States.
3421
        State *string `form:"state"`
3422
        // The high-level tax type, such as `vat` or `sales_tax`.
3423
        TaxType *string `form:"tax_type"`
3424
}
3425

3426
// A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on your own or use a third-party to calculate them. You cannot set tax amounts if any line item has [tax_rates](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://stripe.com/docs/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://stripe.com/docs/tax/invoicing). Pass an empty string to remove previously defined tax amounts.
3427
type InvoiceUpdateLinesLineTaxAmountParams struct {
3428
        // The amount, in cents (or local equivalent), of the tax.
3429
        Amount *int64 `form:"amount"`
3430
        // The amount on which tax is calculated, in cents (or local equivalent).
3431
        TaxableAmount *int64 `form:"taxable_amount"`
3432
        // Data to find or create a TaxRate object.
3433
        //
3434
        // Stripe automatically creates or reuses a TaxRate object for each tax amount. If the `tax_rate_data` exactly matches a previous value, Stripe will reuse the TaxRate object. TaxRate objects created automatically by Stripe are immediately archived, do not appear in the line item's `tax_rates`, and cannot be directly added to invoices, payments, or line items.
3435
        TaxRateData *InvoiceUpdateLinesLineTaxAmountTaxRateDataParams `form:"tax_rate_data"`
3436
}
3437

3438
// The line items to update.
3439
type InvoiceUpdateLinesLineParams struct {
3440
        // The integer amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. If you want to apply a credit to the customer's account, pass a negative amount.
3441
        Amount *int64 `form:"amount"`
3442
        // An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
3443
        Description *string `form:"description"`
3444
        // Controls whether discounts apply to this line item. Defaults to false for prorations or negative line items, and true for all other line items. Cannot be set to true for prorations.
3445
        Discountable *bool `form:"discountable"`
3446
        // The coupons, promotion codes & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts.
3447
        Discounts []*InvoiceUpdateLinesLineDiscountParams `form:"discounts"`
3448
        // ID of an existing line item on the invoice.
3449
        ID *string `form:"id"`
3450
        // The IDs of the margins to apply to the line item. When set, the `default_margins` on the invoice do not apply to this line item.
3451
        Margins []*string `form:"margins"`
3452
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. For [type=subscription](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-type) line items, the incoming metadata specified on the request is directly used to set this value, in contrast to [type=invoiceitem](api/invoices/line_item#invoice_line_item_object-type) line items, where any existing metadata on the invoice line is merged with the incoming data.
3453
        Metadata map[string]string `form:"metadata"`
3454
        // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
3455
        Period *InvoiceUpdateLinesLinePeriodParams `form:"period"`
3456
        // The ID of the price object. One of `price` or `price_data` is required.
3457
        Price *string `form:"price"`
3458
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
3459
        PriceData *InvoiceUpdateLinesLinePriceDataParams `form:"price_data"`
3460
        // Non-negative integer. The quantity of units for the line item.
3461
        Quantity *int64 `form:"quantity"`
3462
        // A list of up to 10 tax amounts for this line item. This can be useful if you calculate taxes on your own or use a third-party to calculate them. You cannot set tax amounts if any line item has [tax_rates](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-tax_rates) or if the invoice has [default_tax_rates](https://stripe.com/docs/api/invoices/object#invoice_object-default_tax_rates) or uses [automatic tax](https://stripe.com/docs/tax/invoicing). Pass an empty string to remove previously defined tax amounts.
3463
        TaxAmounts []*InvoiceUpdateLinesLineTaxAmountParams `form:"tax_amounts"`
3464
        // The tax rates which apply to the line item. When set, the `default_tax_rates` on the invoice do not apply to this line item. Pass an empty string to remove previously-defined tax rates.
3465
        TaxRates []*string `form:"tax_rates"`
3466
}
3467

3468
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3469
func (p *InvoiceUpdateLinesLineParams) AddMetadata(key string, value string) {
×
UNCOV
3470
        if p.Metadata == nil {
×
UNCOV
3471
                p.Metadata = make(map[string]string)
×
UNCOV
3472
        }
×
3473

3474
        p.Metadata[key] = value
×
3475
}
3476

3477
// Updates multiple line items on an invoice. This is only possible when an invoice is still a draft.
3478
type InvoiceUpdateLinesParams struct {
3479
        Params `form:"*"`
3480
        // Specifies which fields in the response should be expanded.
3481
        Expand []*string `form:"expand"`
3482
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`. For [type=subscription](https://stripe.com/docs/api/invoices/line_item#invoice_line_item_object-type) line items, the incoming metadata specified on the request is directly used to set this value, in contrast to [type=invoiceitem](api/invoices/line_item#invoice_line_item_object-type) line items, where any existing metadata on the invoice line is merged with the incoming data.
3483
        InvoiceMetadata map[string]string `form:"invoice_metadata"`
3484
        // The line items to update.
3485
        Lines []*InvoiceUpdateLinesLineParams `form:"lines"`
3486
}
3487

3488
// AddExpand appends a new field to expand.
UNCOV
3489
func (p *InvoiceUpdateLinesParams) AddExpand(f string) {
×
UNCOV
3490
        p.Expand = append(p.Expand, &f)
×
UNCOV
3491
}
×
3492

3493
// Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
3494
//
3495
// Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you're doing business in. You might need to [issue another invoice or <a href="#create_credit_note">credit note](https://stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.
3496
type InvoiceVoidInvoiceParams struct {
3497
        Params `form:"*"`
3498
        // Specifies which fields in the response should be expanded.
3499
        Expand []*string `form:"expand"`
3500
}
3501

3502
// AddExpand appends a new field to expand.
UNCOV
3503
func (p *InvoiceVoidInvoiceParams) AddExpand(f string) {
×
UNCOV
3504
        p.Expand = append(p.Expand, &f)
×
UNCOV
3505
}
×
3506

3507
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
3508
type InvoiceCreatePreviewAutomaticTaxLiabilityParams struct {
3509
        // The connected account being referenced when `type` is `account`.
3510
        Account *string `form:"account"`
3511
        // Type of the account referenced in the request.
3512
        Type *string `form:"type"`
3513
}
3514

3515
// Settings for automatic tax lookup for this invoice preview.
3516
type InvoiceCreatePreviewAutomaticTaxParams struct {
3517
        // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices.
3518
        Enabled *bool `form:"enabled"`
3519
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
3520
        Liability *InvoiceCreatePreviewAutomaticTaxLiabilityParams `form:"liability"`
3521
}
3522

3523
// The customer's shipping information. Appears on invoices emailed to this customer.
3524
type InvoiceCreatePreviewCustomerDetailsShippingParams struct {
3525
        // Customer shipping address.
3526
        Address *AddressParams `form:"address"`
3527
        // Customer name.
3528
        Name *string `form:"name"`
3529
        // Customer phone (including extension).
3530
        Phone *string `form:"phone"`
3531
}
3532

3533
// Tax details about the customer.
3534
type InvoiceCreatePreviewCustomerDetailsTaxParams struct {
3535
        // A recent IP address of the customer used for tax reporting and tax location inference. Stripe recommends updating the IP address when a new PaymentMethod is attached or the address field on the customer is updated. We recommend against updating this field more frequently since it could result in unexpected tax location/reporting outcomes.
3536
        IPAddress *string `form:"ip_address"`
3537
}
3538

3539
// The customer's tax IDs.
3540
type InvoiceCreatePreviewCustomerDetailsTaxIDParams struct {
3541
        // Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bh_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `by_tin`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_uid`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `de_stn`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hr_oib`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `kz_bin`, `li_uid`, `ma_vat`, `md_vat`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `ng_tin`, `no_vat`, `no_voec`, `nz_gst`, `om_vat`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `tz_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `uz_tin`, `uz_vat`, `ve_rif`, `vn_tin`, or `za_vat`
3542
        Type *string `form:"type"`
3543
        // Value of the tax ID.
3544
        Value *string `form:"value"`
3545
}
3546

3547
// 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.
3548
type InvoiceCreatePreviewCustomerDetailsParams struct {
3549
        // The customer's address.
3550
        Address *AddressParams `form:"address"`
3551
        // The customer's shipping information. Appears on invoices emailed to this customer.
3552
        Shipping *InvoiceCreatePreviewCustomerDetailsShippingParams `form:"shipping"`
3553
        // Tax details about the customer.
3554
        Tax *InvoiceCreatePreviewCustomerDetailsTaxParams `form:"tax"`
3555
        // The customer's tax exemption. One of `none`, `exempt`, or `reverse`.
3556
        TaxExempt *string `form:"tax_exempt"`
3557
        // The customer's tax IDs.
3558
        TaxIDs []*InvoiceCreatePreviewCustomerDetailsTaxIDParams `form:"tax_ids"`
3559
}
3560

3561
// Time span for the redeemed discount.
3562
type InvoiceCreatePreviewDiscountDiscountEndDurationParams struct {
3563
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
3564
        Interval *string `form:"interval"`
3565
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
3566
        IntervalCount *int64 `form:"interval_count"`
3567
}
3568

3569
// Details to determine how long the discount should be applied for.
3570
type InvoiceCreatePreviewDiscountDiscountEndParams struct {
3571
        // Time span for the redeemed discount.
3572
        Duration *InvoiceCreatePreviewDiscountDiscountEndDurationParams `form:"duration"`
3573
        // A precise Unix timestamp for the discount to end. Must be in the future.
3574
        Timestamp *int64 `form:"timestamp"`
3575
        // The type of calculation made to determine when the discount ends.
3576
        Type *string `form:"type"`
3577
}
3578

3579
// 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.
3580
type InvoiceCreatePreviewDiscountParams struct {
3581
        // ID of the coupon to create a new discount for.
3582
        Coupon *string `form:"coupon"`
3583
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
3584
        Discount *string `form:"discount"`
3585
        // Details to determine how long the discount should be applied for.
3586
        DiscountEnd *InvoiceCreatePreviewDiscountDiscountEndParams `form:"discount_end"`
3587
        // ID of the promotion code to create a new discount for.
3588
        PromotionCode *string `form:"promotion_code"`
3589
}
3590

3591
// Time span for the redeemed discount.
3592
type InvoiceCreatePreviewInvoiceItemDiscountDiscountEndDurationParams struct {
3593
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
3594
        Interval *string `form:"interval"`
3595
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
3596
        IntervalCount *int64 `form:"interval_count"`
3597
}
3598

3599
// Details to determine how long the discount should be applied for.
3600
type InvoiceCreatePreviewInvoiceItemDiscountDiscountEndParams struct {
3601
        // Time span for the redeemed discount.
3602
        Duration *InvoiceCreatePreviewInvoiceItemDiscountDiscountEndDurationParams `form:"duration"`
3603
        // A precise Unix timestamp for the discount to end. Must be in the future.
3604
        Timestamp *int64 `form:"timestamp"`
3605
        // The type of calculation made to determine when the discount ends.
3606
        Type *string `form:"type"`
3607
}
3608

3609
// The coupons to redeem into discounts for the invoice item in the preview.
3610
type InvoiceCreatePreviewInvoiceItemDiscountParams struct {
3611
        // ID of the coupon to create a new discount for.
3612
        Coupon *string `form:"coupon"`
3613
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
3614
        Discount *string `form:"discount"`
3615
        // Details to determine how long the discount should be applied for.
3616
        DiscountEnd *InvoiceCreatePreviewInvoiceItemDiscountDiscountEndParams `form:"discount_end"`
3617
        // ID of the promotion code to create a new discount for.
3618
        PromotionCode *string `form:"promotion_code"`
3619
}
3620

3621
// The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
3622
type InvoiceCreatePreviewInvoiceItemPeriodParams struct {
3623
        // The end of the period, which must be greater than or equal to the start. This value is inclusive.
3624
        End *int64 `form:"end"`
3625
        // The start of the period. This value is inclusive.
3626
        Start *int64 `form:"start"`
3627
}
3628

3629
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
3630
type InvoiceCreatePreviewInvoiceItemPriceDataParams struct {
3631
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
3632
        Currency *string `form:"currency"`
3633
        // The ID of the product that this price will belong to.
3634
        Product *string `form:"product"`
3635
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
3636
        TaxBehavior *string `form:"tax_behavior"`
3637
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
3638
        UnitAmount *int64 `form:"unit_amount"`
3639
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
3640
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
3641
}
3642

3643
// List of invoice items to add or update in the upcoming invoice preview (up to 250).
3644
type InvoiceCreatePreviewInvoiceItemParams struct {
3645
        // The integer amount in cents (or local equivalent) of previewed invoice item.
3646
        Amount *int64 `form:"amount"`
3647
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies). Only applicable to new invoice items.
3648
        Currency *string `form:"currency"`
3649
        // An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking.
3650
        Description *string `form:"description"`
3651
        // Explicitly controls whether discounts apply to this invoice item. Defaults to true, except for negative invoice items.
3652
        Discountable *bool `form:"discountable"`
3653
        // The coupons to redeem into discounts for the invoice item in the preview.
3654
        Discounts []*InvoiceCreatePreviewInvoiceItemDiscountParams `form:"discounts"`
3655
        // The ID of the invoice item to update in preview. If not specified, a new invoice item will be added to the preview of the upcoming invoice.
3656
        InvoiceItem *string `form:"invoiceitem"`
3657
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3658
        Metadata map[string]string `form:"metadata"`
3659
        // The period associated with this invoice item. When set to different values, the period will be rendered on the invoice. If you have [Stripe Revenue Recognition](https://stripe.com/docs/revenue-recognition) enabled, the period will be used to recognize and defer revenue. See the [Revenue Recognition documentation](https://stripe.com/docs/revenue-recognition/methodology/subscriptions-and-invoicing) for details.
3660
        Period *InvoiceCreatePreviewInvoiceItemPeriodParams `form:"period"`
3661
        // The ID of the price object. One of `price` or `price_data` is required.
3662
        Price *string `form:"price"`
3663
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
3664
        PriceData *InvoiceCreatePreviewInvoiceItemPriceDataParams `form:"price_data"`
3665
        // Non-negative integer. The quantity of units for the invoice item.
3666
        Quantity *int64 `form:"quantity"`
3667
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
3668
        TaxBehavior *string `form:"tax_behavior"`
3669
        // A [tax code](https://stripe.com/docs/tax/tax-categories) ID.
3670
        TaxCode *string `form:"tax_code"`
3671
        // The tax rates that apply to the item. When set, any `default_tax_rates` do not apply to this item.
3672
        TaxRates []*string `form:"tax_rates"`
3673
        // The integer unit amount in cents (or local equivalent) of the charge to be applied to the upcoming invoice. This unit_amount will be multiplied by the quantity to get the full amount. If you want to apply a credit to the customer's account, pass a negative unit_amount.
3674
        UnitAmount *int64 `form:"unit_amount"`
3675
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
3676
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
3677
}
3678

3679
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3680
func (p *InvoiceCreatePreviewInvoiceItemParams) AddMetadata(key string, value string) {
×
UNCOV
3681
        if p.Metadata == nil {
×
UNCOV
3682
                p.Metadata = make(map[string]string)
×
UNCOV
3683
        }
×
3684

3685
        p.Metadata[key] = value
×
3686
}
3687

3688
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
3689
type InvoiceCreatePreviewIssuerParams struct {
3690
        // The connected account being referenced when `type` is `account`.
3691
        Account *string `form:"account"`
3692
        // Type of the account referenced in the request.
3693
        Type *string `form:"type"`
3694
}
3695

3696
// Use the `end` time of a given discount.
3697
type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndDiscountEndParams struct {
3698
        // The ID of a specific discount.
3699
        Discount *string `form:"discount"`
3700
}
3701

3702
// Time span for the amendment starting from the `amendment_start`.
3703
type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndDurationParams struct {
3704
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
3705
        Interval *string `form:"interval"`
3706
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
3707
        IntervalCount *int64 `form:"interval_count"`
3708
}
3709

3710
// Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
3711
type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndParams struct {
3712
        // Use the `end` time of a given discount.
3713
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndDiscountEndParams `form:"discount_end"`
3714
        // Time span for the amendment starting from the `amendment_start`.
3715
        Duration *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndDurationParams `form:"duration"`
3716
        // A precise Unix timestamp for the amendment to end. Must be after the `amendment_start`.
3717
        Timestamp *int64 `form:"timestamp"`
3718
        // Select one of three ways to pass the `amendment_end`.
3719
        Type *string `form:"type"`
3720
}
3721

3722
// Details of another amendment in the same array, immediately after which this amendment should begin.
3723
type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartAmendmentEndParams struct {
3724
        // The position of the previous amendment in the `amendments` array after which this amendment should begin. Indexes start from 0 and must be less than the index of the current amendment in the array.
3725
        Index *int64 `form:"index"`
3726
}
3727

3728
// Use the `end` time of a given discount.
3729
type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartDiscountEndParams struct {
3730
        // The ID of a specific discount.
3731
        Discount *string `form:"discount"`
3732
}
3733

3734
// Details to identify the earliest timestamp where the proposed change should take effect.
3735
type InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartParams struct {
3736
        // Details of another amendment in the same array, immediately after which this amendment should begin.
3737
        AmendmentEnd *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartAmendmentEndParams `form:"amendment_end"`
3738
        // Use the `end` time of a given discount.
3739
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartDiscountEndParams `form:"discount_end"`
3740
        // A precise Unix timestamp for the amendment to start.
3741
        Timestamp *int64 `form:"timestamp"`
3742
        // Select one of three ways to pass the `amendment_start`.
3743
        Type *string `form:"type"`
3744
}
3745

3746
// Details to determine how long the discount should be applied for.
3747
type InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionAddDiscountEndParams struct {
3748
        // The type of calculation made to determine when the discount ends.
3749
        Type *string `form:"type"`
3750
}
3751

3752
// Details of the discount to add.
3753
type InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionAddParams struct {
3754
        // The coupon code to redeem.
3755
        Coupon *string `form:"coupon"`
3756
        // An ID of an existing discount for a coupon that was already redeemed.
3757
        Discount *string `form:"discount"`
3758
        // Details to determine how long the discount should be applied for.
3759
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionAddDiscountEndParams `form:"discount_end"`
3760
        // The index, starting at 0, at which to position the new discount. When not supplied, Stripe defaults to appending the discount to the end of the `discounts` array.
3761
        Index *int64 `form:"index"`
3762
        // The promotion code to redeem.
3763
        PromotionCode *string `form:"promotion_code"`
3764
}
3765

3766
// Details of the discount to remove.
3767
type InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionRemoveParams struct {
3768
        // The coupon code to remove from the `discounts` array.
3769
        Coupon *string `form:"coupon"`
3770
        // The ID of a discount to remove from the `discounts` array.
3771
        Discount *string `form:"discount"`
3772
        // The ID of a promotion code to remove from the `discounts` array.
3773
        PromotionCode *string `form:"promotion_code"`
3774
}
3775

3776
// Details of the discount to replace the existing discounts with.
3777
type InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionSetParams struct {
3778
        // The coupon code to replace the `discounts` array with.
3779
        Coupon *string `form:"coupon"`
3780
        // An ID of an existing discount to replace the `discounts` array with.
3781
        Discount *string `form:"discount"`
3782
        // An ID of an existing promotion code to replace the `discounts` array with.
3783
        PromotionCode *string `form:"promotion_code"`
3784
}
3785

3786
// Changes to the coupons being redeemed or discounts being applied during the amendment time span.
3787
type InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionParams struct {
3788
        // Details of the discount to add.
3789
        Add *InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionAddParams `form:"add"`
3790
        // Details of the discount to remove.
3791
        Remove *InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionRemoveParams `form:"remove"`
3792
        // Details of the discount to replace the existing discounts with.
3793
        Set *InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionSetParams `form:"set"`
3794
        // Determines the type of discount action.
3795
        Type *string `form:"type"`
3796
}
3797

3798
// Time span for the redeemed discount.
3799
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams struct {
3800
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
3801
        Interval *string `form:"interval"`
3802
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
3803
        IntervalCount *int64 `form:"interval_count"`
3804
}
3805

3806
// Details to determine how long the discount should be applied for.
3807
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountDiscountEndParams struct {
3808
        // Time span for the redeemed discount.
3809
        Duration *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountDiscountEndDurationParams `form:"duration"`
3810
        // A precise Unix timestamp for the discount to end. Must be in the future.
3811
        Timestamp *int64 `form:"timestamp"`
3812
        // The type of calculation made to determine when the discount ends.
3813
        Type *string `form:"type"`
3814
}
3815

3816
// The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
3817
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountParams struct {
3818
        // ID of the coupon to create a new discount for.
3819
        Coupon *string `form:"coupon"`
3820
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
3821
        Discount *string `form:"discount"`
3822
        // Details to determine how long the discount should be applied for.
3823
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountDiscountEndParams `form:"discount_end"`
3824
        // ID of the promotion code to create a new discount for.
3825
        PromotionCode *string `form:"promotion_code"`
3826
}
3827

3828
// Options that configure the trial on the subscription item.
3829
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddTrialParams struct {
3830
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
3831
        ConvertsTo []*string `form:"converts_to"`
3832
        // Determines the type of trial for this item.
3833
        Type *string `form:"type"`
3834
}
3835

3836
// Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
3837
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddParams struct {
3838
        // The discounts applied to the item. Subscription item discounts are applied before subscription discounts.
3839
        Discounts []*InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddDiscountParams `form:"discounts"`
3840
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
3841
        Metadata map[string]string `form:"metadata"`
3842
        // The ID of the price object.
3843
        Price *string `form:"price"`
3844
        // Quantity for this item.
3845
        Quantity *int64 `form:"quantity"`
3846
        // The tax rates that apply to this subscription item. When set, the `default_tax_rates` on the subscription do not apply to this `subscription_item`.
3847
        TaxRates []*string `form:"tax_rates"`
3848
        // Options that configure the trial on the subscription item.
3849
        Trial *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddTrialParams `form:"trial"`
3850
}
3851

3852
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3853
func (p *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddParams) AddMetadata(key string, value string) {
×
UNCOV
3854
        if p.Metadata == nil {
×
UNCOV
3855
                p.Metadata = make(map[string]string)
×
UNCOV
3856
        }
×
3857

3858
        p.Metadata[key] = value
×
3859
}
3860

3861
// Details of the subscription item to remove.
3862
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionRemoveParams struct {
3863
        // ID of a price to remove.
3864
        Price *string `form:"price"`
3865
}
3866

3867
// Time span for the redeemed discount.
3868
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams struct {
3869
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
3870
        Interval *string `form:"interval"`
3871
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
3872
        IntervalCount *int64 `form:"interval_count"`
3873
}
3874

3875
// Details to determine how long the discount should be applied for.
3876
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountDiscountEndParams struct {
3877
        // Time span for the redeemed discount.
3878
        Duration *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountDiscountEndDurationParams `form:"duration"`
3879
        // A precise Unix timestamp for the discount to end. Must be in the future.
3880
        Timestamp *int64 `form:"timestamp"`
3881
        // The type of calculation made to determine when the discount ends.
3882
        Type *string `form:"type"`
3883
}
3884

3885
// If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
3886
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountParams struct {
3887
        // ID of the coupon to create a new discount for.
3888
        Coupon *string `form:"coupon"`
3889
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
3890
        Discount *string `form:"discount"`
3891
        // Details to determine how long the discount should be applied for.
3892
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountDiscountEndParams `form:"discount_end"`
3893
        // ID of the promotion code to create a new discount for.
3894
        PromotionCode *string `form:"promotion_code"`
3895
}
3896

3897
// If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
3898
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetTrialParams struct {
3899
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
3900
        ConvertsTo []*string `form:"converts_to"`
3901
        // Determines the type of trial for this item.
3902
        Type *string `form:"type"`
3903
}
3904

3905
// Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
3906
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetParams struct {
3907
        // If an item with the `price` already exists, passing this will override the `discounts` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `discounts`.
3908
        Discounts []*InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetDiscountParams `form:"discounts"`
3909
        // If an item with the `price` already exists, passing this will override the `metadata` on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `metadata`.
3910
        Metadata map[string]string `form:"metadata"`
3911
        // The ID of the price object.
3912
        Price *string `form:"price"`
3913
        // If an item with the `price` already exists, passing this will override the quantity on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `quantity`.
3914
        Quantity *int64 `form:"quantity"`
3915
        // If an item with the `price` already exists, passing this will override the `tax_rates` array on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `tax_rates`.
3916
        TaxRates []*string `form:"tax_rates"`
3917
        // If an item with the `price` already exists, passing this will override the `trial` configuration on the subscription item that matches that price. Otherwise, the `items` array is cleared and a single new item is added with the supplied `trial`.
3918
        Trial *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetTrialParams `form:"trial"`
3919
}
3920

3921
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
3922
func (p *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetParams) AddMetadata(key string, value string) {
×
UNCOV
3923
        if p.Metadata == nil {
×
UNCOV
3924
                p.Metadata = make(map[string]string)
×
UNCOV
3925
        }
×
3926

3927
        p.Metadata[key] = value
×
3928
}
3929

3930
// Changes to the subscription items during the amendment time span.
3931
type InvoiceCreatePreviewScheduleDetailsAmendmentItemActionParams struct {
3932
        // Details of the subscription item to add. If an item with the same `price` exists, it will be replaced by this new item. Otherwise, it adds the new item.
3933
        Add *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionAddParams `form:"add"`
3934
        // Details of the subscription item to remove.
3935
        Remove *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionRemoveParams `form:"remove"`
3936
        // Details of the subscription item to replace the existing items with. If an item with the `set[price]` already exists, the `items` array is not cleared. Instead, all of the other `set` properties that are passed in this request will replace the existing values for the configuration item.
3937
        Set *InvoiceCreatePreviewScheduleDetailsAmendmentItemActionSetParams `form:"set"`
3938
        // Determines the type of item action.
3939
        Type *string `form:"type"`
3940
}
3941

3942
// Instructions for how to modify phase metadata
3943
type InvoiceCreatePreviewScheduleDetailsAmendmentMetadataActionParams struct {
3944
        // Key-value pairs to add to schedule phase metadata. These values will merge with existing schedule phase metadata.
3945
        Add map[string]string `form:"add"`
3946
        // Keys to remove from schedule phase metadata.
3947
        Remove []*string `form:"remove"`
3948
        // Key-value pairs to set as schedule phase metadata. Existing schedule phase metadata will be overwritten.
3949
        Set map[string]string `form:"set"`
3950
        // Select one of three ways to update phase-level `metadata` on subscription schedules.
3951
        Type *string `form:"type"`
3952
}
3953

3954
// Details of the pause_collection behavior to apply to the amendment.
3955
type InvoiceCreatePreviewScheduleDetailsAmendmentSetPauseCollectionSetParams struct {
3956
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
3957
        Behavior *string `form:"behavior"`
3958
}
3959

3960
// Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
3961
type InvoiceCreatePreviewScheduleDetailsAmendmentSetPauseCollectionParams struct {
3962
        // Details of the pause_collection behavior to apply to the amendment.
3963
        Set *InvoiceCreatePreviewScheduleDetailsAmendmentSetPauseCollectionSetParams `form:"set"`
3964
        // Determines the type of the pause_collection amendment.
3965
        Type *string `form:"type"`
3966
}
3967

3968
// Defines how the subscription should behave when a trial ends.
3969
type InvoiceCreatePreviewScheduleDetailsAmendmentTrialSettingsEndBehaviorParams struct {
3970
        // Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
3971
        ProrateUpFront *string `form:"prorate_up_front"`
3972
}
3973

3974
// Settings related to subscription trials.
3975
type InvoiceCreatePreviewScheduleDetailsAmendmentTrialSettingsParams struct {
3976
        // Defines how the subscription should behave when a trial ends.
3977
        EndBehavior *InvoiceCreatePreviewScheduleDetailsAmendmentTrialSettingsEndBehaviorParams `form:"end_behavior"`
3978
}
3979

3980
// Changes to apply to the phases of the subscription schedule, in the order provided.
3981
type InvoiceCreatePreviewScheduleDetailsAmendmentParams struct {
3982
        // Details to identify the end of the time range modified by the proposed change. If not supplied, the amendment is considered a point-in-time operation that only affects the exact timestamp at `amendment_start`, and a restricted set of attributes is supported on the amendment.
3983
        AmendmentEnd *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentEndParams `form:"amendment_end"`
3984
        // Details to identify the earliest timestamp where the proposed change should take effect.
3985
        AmendmentStart *InvoiceCreatePreviewScheduleDetailsAmendmentAmendmentStartParams `form:"amendment_start"`
3986
        // For point-in-time amendments (having no `amendment_end`), this attribute lets you set or remove whether the subscription's billing cycle anchor is reset at the `amendment_start` timestamp.For time-span based amendments (having both `amendment_start` and `amendment_end`), the only value valid is `automatic`, which removes any previously configured billing cycle anchor resets scheduled to occur during the window of time spanned by the amendment.
3987
        BillingCycleAnchor *string `form:"billing_cycle_anchor"`
3988
        // Changes to the coupons being redeemed or discounts being applied during the amendment time span.
3989
        DiscountActions []*InvoiceCreatePreviewScheduleDetailsAmendmentDiscountActionParams `form:"discount_actions"`
3990
        // Changes to the subscription items during the amendment time span.
3991
        ItemActions []*InvoiceCreatePreviewScheduleDetailsAmendmentItemActionParams `form:"item_actions"`
3992
        // Instructions for how to modify phase metadata
3993
        MetadataActions []*InvoiceCreatePreviewScheduleDetailsAmendmentMetadataActionParams `form:"metadata_actions"`
3994
        // Changes to how Stripe handles prorations during the amendment time span. Affects if and how prorations are created when a future phase starts. In cases where the amendment changes the currently active phase, it is used to determine whether or how to prorate now, at the time of the request. Also supported as a point-in-time operation when `amendment_end` is `null`.
3995
        ProrationBehavior *string `form:"proration_behavior"`
3996
        // Defines how to pause collection for the underlying subscription throughout the duration of the amendment.
3997
        SetPauseCollection *InvoiceCreatePreviewScheduleDetailsAmendmentSetPauseCollectionParams `form:"set_pause_collection"`
3998
        // Ends the subscription schedule early as dictated by either the accompanying amendment's start or end.
3999
        SetScheduleEnd *string `form:"set_schedule_end"`
4000
        // Settings related to subscription trials.
4001
        TrialSettings *InvoiceCreatePreviewScheduleDetailsAmendmentTrialSettingsParams `form:"trial_settings"`
4002
}
4003

4004
// Time span for the redeemed discount.
4005
type InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams struct {
4006
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
4007
        Interval *string `form:"interval"`
4008
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
4009
        IntervalCount *int64 `form:"interval_count"`
4010
}
4011

4012
// Details to determine how long the discount should be applied for.
4013
type InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams struct {
4014
        // Time span for the redeemed discount.
4015
        Duration *InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndDurationParams `form:"duration"`
4016
        // A precise Unix timestamp for the discount to end. Must be in the future.
4017
        Timestamp *int64 `form:"timestamp"`
4018
        // The type of calculation made to determine when the discount ends.
4019
        Type *string `form:"type"`
4020
}
4021

4022
// The coupons to redeem into discounts for the item.
4023
type InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountParams struct {
4024
        // ID of the coupon to create a new discount for.
4025
        Coupon *string `form:"coupon"`
4026
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
4027
        Discount *string `form:"discount"`
4028
        // Details to determine how long the discount should be applied for.
4029
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountDiscountEndParams `form:"discount_end"`
4030
        // ID of the promotion code to create a new discount for.
4031
        PromotionCode *string `form:"promotion_code"`
4032
}
4033

4034
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
4035
type InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemPriceDataParams struct {
4036
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
4037
        Currency *string `form:"currency"`
4038
        // The ID of the product that this price will belong to.
4039
        Product *string `form:"product"`
4040
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
4041
        TaxBehavior *string `form:"tax_behavior"`
4042
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge or a negative integer representing the amount to credit to the customer.
4043
        UnitAmount *int64 `form:"unit_amount"`
4044
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
4045
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
4046
}
4047

4048
// A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
4049
type InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemParams struct {
4050
        // The coupons to redeem into discounts for the item.
4051
        Discounts []*InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemDiscountParams `form:"discounts"`
4052
        // The ID of the price object. One of `price` or `price_data` is required.
4053
        Price *string `form:"price"`
4054
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
4055
        PriceData *InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemPriceDataParams `form:"price_data"`
4056
        // Quantity for this item. Defaults to 1.
4057
        Quantity *int64 `form:"quantity"`
4058
        // The tax rates which apply to the item. When set, the `default_tax_rates` do not apply to this item.
4059
        TaxRates []*string `form:"tax_rates"`
4060
}
4061

4062
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
4063
type InvoiceCreatePreviewScheduleDetailsPhaseAutomaticTaxLiabilityParams struct {
4064
        // The connected account being referenced when `type` is `account`.
4065
        Account *string `form:"account"`
4066
        // Type of the account referenced in the request.
4067
        Type *string `form:"type"`
4068
}
4069

4070
// Automatic tax settings for this phase.
4071
type InvoiceCreatePreviewScheduleDetailsPhaseAutomaticTaxParams struct {
4072
        // Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription.
4073
        Enabled *bool `form:"enabled"`
4074
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
4075
        Liability *InvoiceCreatePreviewScheduleDetailsPhaseAutomaticTaxLiabilityParams `form:"liability"`
4076
}
4077

4078
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
4079
type InvoiceCreatePreviewScheduleDetailsPhaseBillingThresholdsParams struct {
4080
        // Monetary threshold that triggers the subscription to advance to a new billing period
4081
        AmountGTE *int64 `form:"amount_gte"`
4082
        // Indicates if the `billing_cycle_anchor` should be reset when a threshold is reached. If true, `billing_cycle_anchor` will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged.
4083
        ResetBillingCycleAnchor *bool `form:"reset_billing_cycle_anchor"`
4084
}
4085

4086
// Time span for the redeemed discount.
4087
type InvoiceCreatePreviewScheduleDetailsPhaseDiscountDiscountEndDurationParams struct {
4088
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
4089
        Interval *string `form:"interval"`
4090
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
4091
        IntervalCount *int64 `form:"interval_count"`
4092
}
4093

4094
// Details to determine how long the discount should be applied for.
4095
type InvoiceCreatePreviewScheduleDetailsPhaseDiscountDiscountEndParams struct {
4096
        // Time span for the redeemed discount.
4097
        Duration *InvoiceCreatePreviewScheduleDetailsPhaseDiscountDiscountEndDurationParams `form:"duration"`
4098
        // A precise Unix timestamp for the discount to end. Must be in the future.
4099
        Timestamp *int64 `form:"timestamp"`
4100
        // The type of calculation made to determine when the discount ends.
4101
        Type *string `form:"type"`
4102
}
4103

4104
// The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
4105
type InvoiceCreatePreviewScheduleDetailsPhaseDiscountParams struct {
4106
        // ID of the coupon to create a new discount for.
4107
        Coupon *string `form:"coupon"`
4108
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
4109
        Discount *string `form:"discount"`
4110
        // Details to determine how long the discount should be applied for.
4111
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsPhaseDiscountDiscountEndParams `form:"discount_end"`
4112
        // ID of the promotion code to create a new discount for.
4113
        PromotionCode *string `form:"promotion_code"`
4114
}
4115

4116
// The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
4117
type InvoiceCreatePreviewScheduleDetailsPhaseInvoiceSettingsIssuerParams struct {
4118
        // The connected account being referenced when `type` is `account`.
4119
        Account *string `form:"account"`
4120
        // Type of the account referenced in the request.
4121
        Type *string `form:"type"`
4122
}
4123

4124
// All invoices will be billed using the specified settings.
4125
type InvoiceCreatePreviewScheduleDetailsPhaseInvoiceSettingsParams struct {
4126
        // The account tax IDs associated with this phase of the subscription schedule. Will be set on invoices generated by this phase of the subscription schedule.
4127
        AccountTaxIDs []*string `form:"account_tax_ids"`
4128
        // Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `billing=charge_automatically`.
4129
        DaysUntilDue *int64 `form:"days_until_due"`
4130
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
4131
        Issuer *InvoiceCreatePreviewScheduleDetailsPhaseInvoiceSettingsIssuerParams `form:"issuer"`
4132
}
4133

4134
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
4135
type InvoiceCreatePreviewScheduleDetailsPhaseItemBillingThresholdsParams struct {
4136
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
4137
        UsageGTE *int64 `form:"usage_gte"`
4138
}
4139

4140
// Time span for the redeemed discount.
4141
type InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountDiscountEndDurationParams struct {
4142
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
4143
        Interval *string `form:"interval"`
4144
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
4145
        IntervalCount *int64 `form:"interval_count"`
4146
}
4147

4148
// Details to determine how long the discount should be applied for.
4149
type InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountDiscountEndParams struct {
4150
        // Time span for the redeemed discount.
4151
        Duration *InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountDiscountEndDurationParams `form:"duration"`
4152
        // A precise Unix timestamp for the discount to end. Must be in the future.
4153
        Timestamp *int64 `form:"timestamp"`
4154
        // The type of calculation made to determine when the discount ends.
4155
        Type *string `form:"type"`
4156
}
4157

4158
// The coupons to redeem into discounts for the subscription item.
4159
type InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountParams struct {
4160
        // ID of the coupon to create a new discount for.
4161
        Coupon *string `form:"coupon"`
4162
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
4163
        Discount *string `form:"discount"`
4164
        // Details to determine how long the discount should be applied for.
4165
        DiscountEnd *InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountDiscountEndParams `form:"discount_end"`
4166
        // ID of the promotion code to create a new discount for.
4167
        PromotionCode *string `form:"promotion_code"`
4168
}
4169

4170
// The recurring components of a price such as `interval` and `interval_count`.
4171
type InvoiceCreatePreviewScheduleDetailsPhaseItemPriceDataRecurringParams struct {
4172
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
4173
        Interval *string `form:"interval"`
4174
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
4175
        IntervalCount *int64 `form:"interval_count"`
4176
}
4177

4178
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
4179
type InvoiceCreatePreviewScheduleDetailsPhaseItemPriceDataParams struct {
4180
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
4181
        Currency *string `form:"currency"`
4182
        // The ID of the product that this price will belong to.
4183
        Product *string `form:"product"`
4184
        // The recurring components of a price such as `interval` and `interval_count`.
4185
        Recurring *InvoiceCreatePreviewScheduleDetailsPhaseItemPriceDataRecurringParams `form:"recurring"`
4186
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
4187
        TaxBehavior *string `form:"tax_behavior"`
4188
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
4189
        UnitAmount *int64 `form:"unit_amount"`
4190
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
4191
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
4192
}
4193

4194
// Options that configure the trial on the subscription item.
4195
type InvoiceCreatePreviewScheduleDetailsPhaseItemTrialParams struct {
4196
        // List of price IDs which, if present on the subscription following a paid trial, constitute opting-in to the paid trial. Currently only supports at most 1 price ID.
4197
        ConvertsTo []*string `form:"converts_to"`
4198
        // Determines the type of trial for this item.
4199
        Type *string `form:"type"`
4200
}
4201

4202
// List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
4203
type InvoiceCreatePreviewScheduleDetailsPhaseItemParams struct {
4204
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
4205
        BillingThresholds *InvoiceCreatePreviewScheduleDetailsPhaseItemBillingThresholdsParams `form:"billing_thresholds"`
4206
        // The coupons to redeem into discounts for the subscription item.
4207
        Discounts []*InvoiceCreatePreviewScheduleDetailsPhaseItemDiscountParams `form:"discounts"`
4208
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a configuration item. Metadata on a configuration item will update the underlying subscription item's `metadata` when the phase is entered, adding new keys and replacing existing keys. Individual keys in the subscription item's `metadata` can be unset by posting an empty value to them in the configuration item's `metadata`. To unset all keys in the subscription item's `metadata`, update the subscription item directly or unset every key individually from the configuration item's `metadata`.
4209
        Metadata map[string]string `form:"metadata"`
4210
        // The plan ID to subscribe to. You may specify the same ID in `plan` and `price`.
4211
        Plan *string `form:"plan"`
4212
        // The ID of the price object.
4213
        Price *string `form:"price"`
4214
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline.
4215
        PriceData *InvoiceCreatePreviewScheduleDetailsPhaseItemPriceDataParams `form:"price_data"`
4216
        // Quantity for the given price. Can be set only if the price's `usage_type` is `licensed` and not `metered`.
4217
        Quantity *int64 `form:"quantity"`
4218
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
4219
        TaxRates []*string `form:"tax_rates"`
4220
        // Options that configure the trial on the subscription item.
4221
        Trial *InvoiceCreatePreviewScheduleDetailsPhaseItemTrialParams `form:"trial"`
4222
}
4223

4224
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
4225
func (p *InvoiceCreatePreviewScheduleDetailsPhaseItemParams) AddMetadata(key string, value string) {
×
UNCOV
4226
        if p.Metadata == nil {
×
UNCOV
4227
                p.Metadata = make(map[string]string)
×
UNCOV
4228
        }
×
4229

4230
        p.Metadata[key] = value
×
4231
}
4232

4233
// If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
4234
type InvoiceCreatePreviewScheduleDetailsPhasePauseCollectionParams struct {
4235
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
4236
        Behavior *string `form:"behavior"`
4237
}
4238

4239
// The data with which to automatically create a Transfer for each of the associated subscription's invoices.
4240
type InvoiceCreatePreviewScheduleDetailsPhaseTransferDataParams struct {
4241
        // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the destination account. By default, the entire amount is transferred to the destination.
4242
        AmountPercent *float64 `form:"amount_percent"`
4243
        // ID of an existing, connected Stripe account.
4244
        Destination *string `form:"destination"`
4245
}
4246

4247
// Defines how the subscription should behave when a trial ends.
4248
type InvoiceCreatePreviewScheduleDetailsPhaseTrialSettingsEndBehaviorParams struct {
4249
        // Configure how an opt-in following a paid trial is billed when using `billing_behavior: prorate_up_front`.
4250
        ProrateUpFront *string `form:"prorate_up_front"`
4251
}
4252

4253
// Settings related to subscription trials.
4254
type InvoiceCreatePreviewScheduleDetailsPhaseTrialSettingsParams struct {
4255
        // Defines how the subscription should behave when a trial ends.
4256
        EndBehavior *InvoiceCreatePreviewScheduleDetailsPhaseTrialSettingsEndBehaviorParams `form:"end_behavior"`
4257
}
4258

4259
// List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
4260
type InvoiceCreatePreviewScheduleDetailsPhaseParams struct {
4261
        // A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items.
4262
        AddInvoiceItems []*InvoiceCreatePreviewScheduleDetailsPhaseAddInvoiceItemParams `form:"add_invoice_items"`
4263
        // A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice total that will be transferred to the application owner's Stripe account. The request must be made by a platform account on a connected account in order to set an application fee percentage. For more information, see the application fees [documentation](https://stripe.com/docs/connect/subscriptions#collecting-fees-on-subscriptions).
4264
        ApplicationFeePercent *float64 `form:"application_fee_percent"`
4265
        // Automatic tax settings for this phase.
4266
        AutomaticTax *InvoiceCreatePreviewScheduleDetailsPhaseAutomaticTaxParams `form:"automatic_tax"`
4267
        // Can be set to `phase_start` to set the anchor to the start of the phase or `automatic` to automatically change it if needed. Cannot be set to `phase_start` if this phase specifies a trial. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle).
4268
        BillingCycleAnchor *string `form:"billing_cycle_anchor"`
4269
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. Pass an empty string to remove previously-defined thresholds.
4270
        BillingThresholds *InvoiceCreatePreviewScheduleDetailsPhaseBillingThresholdsParams `form:"billing_thresholds"`
4271
        // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions and mark the subscription as `active`. Defaults to `charge_automatically` on creation.
4272
        CollectionMethod *string `form:"collection_method"`
4273
        // The ID of the coupon to apply to this phase of the subscription schedule. This field has been deprecated and will be removed in a future API version. Use `discounts` instead.
4274
        Coupon *string `form:"coupon"`
4275
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
4276
        Currency *string `form:"currency"`
4277
        // ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer's invoice settings.
4278
        DefaultPaymentMethod *string `form:"default_payment_method"`
4279
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will set the Subscription's [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates), which means they will be the Invoice's [`default_tax_rates`](https://stripe.com/docs/api/invoices/create#create_invoice-default_tax_rates) for any Invoices issued by the Subscription during this Phase.
4280
        DefaultTaxRates []*string `form:"default_tax_rates"`
4281
        // Subscription description, meant to be displayable to the customer. Use this field to optionally store an explanation of the subscription for rendering in Stripe surfaces and certain local payment methods UIs.
4282
        Description *string `form:"description"`
4283
        // The coupons to redeem into discounts for the schedule phase. If not specified, inherits the discount from the subscription's customer. Pass an empty string to avoid inheriting any discounts.
4284
        Discounts []*InvoiceCreatePreviewScheduleDetailsPhaseDiscountParams `form:"discounts"`
4285
        // The date at which this phase of the subscription schedule ends. If set, `iterations` must not be set.
4286
        EndDate    *int64 `form:"end_date"`
4287
        EndDateNow *bool  `form:"-"` // See custom AppendTo
4288
        // All invoices will be billed using the specified settings.
4289
        InvoiceSettings *InvoiceCreatePreviewScheduleDetailsPhaseInvoiceSettingsParams `form:"invoice_settings"`
4290
        // List of configuration items, each with an attached price, to apply during this phase of the subscription schedule.
4291
        Items []*InvoiceCreatePreviewScheduleDetailsPhaseItemParams `form:"items"`
4292
        // Integer representing the multiplier applied to the price interval. For example, `iterations=2` applied to a price with `interval=month` and `interval_count=3` results in a phase of duration `2 * 3 months = 6 months`. If set, `end_date` must not be set.
4293
        Iterations *int64 `form:"iterations"`
4294
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to a phase. Metadata on a schedule's phase will update the underlying subscription's `metadata` when the phase is entered, adding new keys and replacing existing keys in the subscription's `metadata`. Individual keys in the subscription's `metadata` can be unset by posting an empty value to them in the phase's `metadata`. To unset all keys in the subscription's `metadata`, update the subscription directly or unset every key individually from the phase's `metadata`.
4295
        Metadata map[string]string `form:"metadata"`
4296
        // The account on behalf of which to charge, for each of the associated subscription's invoices.
4297
        OnBehalfOf *string `form:"on_behalf_of"`
4298
        // If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
4299
        PauseCollection *InvoiceCreatePreviewScheduleDetailsPhasePauseCollectionParams `form:"pause_collection"`
4300
        // Whether the subscription schedule will create [prorations](https://stripe.com/docs/billing/subscriptions/prorations) when transitioning to this phase. The default value is `create_prorations`. This setting controls prorations when a phase is started asynchronously and it is persisted as a field on the phase. It's different from the request-level [proration_behavior](https://stripe.com/docs/api/subscription_schedules/update#update_subscription_schedule-proration_behavior) parameter which controls what happens if the update request affects the billing configuration of the current phase.
4301
        ProrationBehavior *string `form:"proration_behavior"`
4302
        // The date at which this phase of the subscription schedule starts or `now`. Must be set on the first phase.
4303
        StartDate    *int64 `form:"start_date"`
4304
        StartDateNow *bool  `form:"-"` // See custom AppendTo
4305
        // The data with which to automatically create a Transfer for each of the associated subscription's invoices.
4306
        TransferData *InvoiceCreatePreviewScheduleDetailsPhaseTransferDataParams `form:"transfer_data"`
4307
        // If set to true the entire phase is counted as a trial and the customer will not be charged for any fees.
4308
        Trial *bool `form:"trial"`
4309
        // Specify trial behavior when crossing phase boundaries
4310
        TrialContinuation *string `form:"trial_continuation"`
4311
        // Sets the phase to trialing from the start date to this date. Must be before the phase end date, can not be combined with `trial`
4312
        TrialEnd    *int64 `form:"trial_end"`
4313
        TrialEndNow *bool  `form:"-"` // See custom AppendTo
4314
        // Settings related to subscription trials.
4315
        TrialSettings *InvoiceCreatePreviewScheduleDetailsPhaseTrialSettingsParams `form:"trial_settings"`
4316
}
4317

4318
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
4319
func (p *InvoiceCreatePreviewScheduleDetailsPhaseParams) AddMetadata(key string, value string) {
×
UNCOV
4320
        if p.Metadata == nil {
×
UNCOV
4321
                p.Metadata = make(map[string]string)
×
UNCOV
4322
        }
×
4323

4324
        p.Metadata[key] = value
×
4325
}
4326

4327
// AppendTo implements custom encoding logic for InvoiceCreatePreviewScheduleDetailsPhaseParams.
UNCOV
4328
func (p *InvoiceCreatePreviewScheduleDetailsPhaseParams) AppendTo(body *form.Values, keyParts []string) {
×
4329
        if BoolValue(p.EndDateNow) {
×
UNCOV
4330
                body.Add(form.FormatKey(append(keyParts, "end_date")), "now")
×
UNCOV
4331
        }
×
UNCOV
4332
        if BoolValue(p.StartDateNow) {
×
4333
                body.Add(form.FormatKey(append(keyParts, "start_date")), "now")
×
4334
        }
×
4335
        if BoolValue(p.TrialEndNow) {
×
4336
                body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")
×
4337
        }
×
4338
}
4339

4340
// End the prebilled period when a specified amendment ends.
4341
type InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilAmendmentEndParams struct {
4342
        // The position of the amendment in the `amendments` array at which prebilling should end. Indexes start from 0 and must be less than the total number of supplied amendments.
4343
        Index *int64 `form:"index"`
4344
}
4345

4346
// Time span for prebilling, starting from `bill_from`.
4347
type InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilDurationParams struct {
4348
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
4349
        Interval *string `form:"interval"`
4350
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
4351
        IntervalCount *int64 `form:"interval_count"`
4352
}
4353

4354
// The end of the prebilled time period.
4355
type InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilParams struct {
4356
        // End the prebilled period when a specified amendment ends.
4357
        AmendmentEnd *InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilAmendmentEndParams `form:"amendment_end"`
4358
        // Time span for prebilling, starting from `bill_from`.
4359
        Duration *InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilDurationParams `form:"duration"`
4360
        // End the prebilled period at a precise integer timestamp, starting from the Unix epoch.
4361
        Timestamp *int64 `form:"timestamp"`
4362
        // Select one of several ways to pass the `bill_until` value.
4363
        Type *string `form:"type"`
4364
}
4365

4366
// Provide any time periods to bill in advance.
4367
type InvoiceCreatePreviewScheduleDetailsPrebillingParams struct {
4368
        // The end of the prebilled time period.
4369
        BillUntil *InvoiceCreatePreviewScheduleDetailsPrebillingBillUntilParams `form:"bill_until"`
4370
        // This is used to determine the number of billing cycles to prebill.
4371
        Iterations *int64 `form:"iterations"`
4372
}
4373

4374
// The schedule creation or modification params to apply as a preview. Cannot be used with `subscription` or `subscription_` prefixed fields.
4375
type InvoiceCreatePreviewScheduleDetailsParams struct {
4376
        // Changes to apply to the phases of the subscription schedule, in the order provided.
4377
        Amendments []*InvoiceCreatePreviewScheduleDetailsAmendmentParams `form:"amendments"`
4378
        // Configures when the subscription schedule generates prorations for phase transitions. Possible values are `prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
4379
        BillingBehavior *string `form:"billing_behavior"`
4380
        // Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running. `cancel` will end the subscription schedule and cancel the underlying subscription.
4381
        EndBehavior *string `form:"end_behavior"`
4382
        // List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase.
4383
        Phases []*InvoiceCreatePreviewScheduleDetailsPhaseParams `form:"phases"`
4384
        // Provide any time periods to bill in advance.
4385
        Prebilling []*InvoiceCreatePreviewScheduleDetailsPrebillingParams `form:"prebilling"`
4386
        // In cases where the `schedule_details` params update the currently active phase, specifies if and how to prorate at the time of the request.
4387
        ProrationBehavior *string `form:"proration_behavior"`
4388
}
4389

4390
// Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
4391
type InvoiceCreatePreviewSubscriptionDetailsItemBillingThresholdsParams struct {
4392
        // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte))
4393
        UsageGTE *int64 `form:"usage_gte"`
4394
}
4395

4396
// Time span for the redeemed discount.
4397
type InvoiceCreatePreviewSubscriptionDetailsItemDiscountDiscountEndDurationParams struct {
4398
        // Specifies a type of interval unit. Either `day`, `week`, `month` or `year`.
4399
        Interval *string `form:"interval"`
4400
        // The number of intervals, as an whole number greater than 0. Stripe multiplies this by the interval type to get the overall duration.
4401
        IntervalCount *int64 `form:"interval_count"`
4402
}
4403

4404
// Details to determine how long the discount should be applied for.
4405
type InvoiceCreatePreviewSubscriptionDetailsItemDiscountDiscountEndParams struct {
4406
        // Time span for the redeemed discount.
4407
        Duration *InvoiceCreatePreviewSubscriptionDetailsItemDiscountDiscountEndDurationParams `form:"duration"`
4408
        // A precise Unix timestamp for the discount to end. Must be in the future.
4409
        Timestamp *int64 `form:"timestamp"`
4410
        // The type of calculation made to determine when the discount ends.
4411
        Type *string `form:"type"`
4412
}
4413

4414
// The coupons to redeem into discounts for the subscription item.
4415
type InvoiceCreatePreviewSubscriptionDetailsItemDiscountParams struct {
4416
        // ID of the coupon to create a new discount for.
4417
        Coupon *string `form:"coupon"`
4418
        // ID of an existing discount on the object (or one of its ancestors) to reuse.
4419
        Discount *string `form:"discount"`
4420
        // Details to determine how long the discount should be applied for.
4421
        DiscountEnd *InvoiceCreatePreviewSubscriptionDetailsItemDiscountDiscountEndParams `form:"discount_end"`
4422
        // ID of the promotion code to create a new discount for.
4423
        PromotionCode *string `form:"promotion_code"`
4424
}
4425

4426
// The recurring components of a price such as `interval` and `interval_count`.
4427
type InvoiceCreatePreviewSubscriptionDetailsItemPriceDataRecurringParams struct {
4428
        // Specifies billing frequency. Either `day`, `week`, `month` or `year`.
4429
        Interval *string `form:"interval"`
4430
        // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).
4431
        IntervalCount *int64 `form:"interval_count"`
4432
}
4433

4434
// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
4435
type InvoiceCreatePreviewSubscriptionDetailsItemPriceDataParams struct {
4436
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
4437
        Currency *string `form:"currency"`
4438
        // The ID of the product that this price will belong to.
4439
        Product *string `form:"product"`
4440
        // The recurring components of a price such as `interval` and `interval_count`.
4441
        Recurring *InvoiceCreatePreviewSubscriptionDetailsItemPriceDataRecurringParams `form:"recurring"`
4442
        // Only required if a [default tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
4443
        TaxBehavior *string `form:"tax_behavior"`
4444
        // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
4445
        UnitAmount *int64 `form:"unit_amount"`
4446
        // Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
4447
        UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"`
4448
}
4449

4450
// A list of up to 20 subscription items, each with an attached price.
4451
type InvoiceCreatePreviewSubscriptionDetailsItemParams struct {
4452
        // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds.
4453
        BillingThresholds *InvoiceCreatePreviewSubscriptionDetailsItemBillingThresholdsParams `form:"billing_thresholds"`
4454
        // Delete all usage for a given subscription item. Allowed only when `deleted` is set to `true` and the current plan's `usage_type` is `metered`.
4455
        ClearUsage *bool `form:"clear_usage"`
4456
        // A flag that, if set to `true`, will delete the specified item.
4457
        Deleted *bool `form:"deleted"`
4458
        // The coupons to redeem into discounts for the subscription item.
4459
        Discounts []*InvoiceCreatePreviewSubscriptionDetailsItemDiscountParams `form:"discounts"`
4460
        // Subscription item to update.
4461
        ID *string `form:"id"`
4462
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
4463
        Metadata map[string]string `form:"metadata"`
4464
        // Plan ID for this item, as a string.
4465
        Plan *string `form:"plan"`
4466
        // The ID of the price object. One of `price` or `price_data` is required. When changing a subscription item's price, `quantity` is set to 1 unless a `quantity` parameter is provided.
4467
        Price *string `form:"price"`
4468
        // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required.
4469
        PriceData *InvoiceCreatePreviewSubscriptionDetailsItemPriceDataParams `form:"price_data"`
4470
        // Quantity for this item.
4471
        Quantity *int64 `form:"quantity"`
4472
        // A list of [Tax Rate](https://stripe.com/docs/api/tax_rates) ids. These Tax Rates will override the [`default_tax_rates`](https://stripe.com/docs/api/subscriptions/create#create_subscription-default_tax_rates) on the Subscription. When updating, pass an empty string to remove previously-defined tax rates.
4473
        TaxRates []*string `form:"tax_rates"`
4474
}
4475

4476
// AddMetadata adds a new key-value pair to the Metadata.
UNCOV
4477
func (p *InvoiceCreatePreviewSubscriptionDetailsItemParams) AddMetadata(key string, value string) {
×
UNCOV
4478
        if p.Metadata == nil {
×
UNCOV
4479
                p.Metadata = make(map[string]string)
×
UNCOV
4480
        }
×
4481

4482
        p.Metadata[key] = value
×
4483
}
4484

4485
// The pre-billing to apply to the subscription as a preview.
4486
type InvoiceCreatePreviewSubscriptionDetailsPrebillingParams struct {
4487
        // This is used to determine the number of billing cycles to prebill.
4488
        Iterations *int64 `form:"iterations"`
4489
}
4490

4491
// The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields.
4492
type InvoiceCreatePreviewSubscriptionDetailsParams struct {
4493
        // For new subscriptions, a future timestamp to anchor the subscription's [billing cycle](https://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`.
4494
        BillingCycleAnchor          *int64 `form:"billing_cycle_anchor"`
4495
        BillingCycleAnchorNow       *bool  `form:"-"` // See custom AppendTo
4496
        BillingCycleAnchorUnchanged *bool  `form:"-"` // See custom AppendTo
4497
        // 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.
4498
        CancelAt *int64 `form:"cancel_at"`
4499
        // Indicate whether this subscription should cancel at the end of the current period (`current_period_end`). Defaults to `false`.
4500
        CancelAtPeriodEnd *bool `form:"cancel_at_period_end"`
4501
        // This simulates the subscription being canceled or expired immediately.
4502
        CancelNow *bool `form:"cancel_now"`
4503
        // 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.
4504
        DefaultTaxRates []*string `form:"default_tax_rates"`
4505
        // A list of up to 20 subscription items, each with an attached price.
4506
        Items []*InvoiceCreatePreviewSubscriptionDetailsItemParams `form:"items"`
4507
        // The pre-billing to apply to the subscription as a preview.
4508
        Prebilling *InvoiceCreatePreviewSubscriptionDetailsPrebillingParams `form:"prebilling"`
4509
        // Determines how to handle [prorations](https://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`.
4510
        ProrationBehavior *string `form:"proration_behavior"`
4511
        // 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'.
4512
        ProrationDate *int64 `form:"proration_date"`
4513
        // For paused subscriptions, setting `subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed.
4514
        ResumeAt *string `form:"resume_at"`
4515
        // Date a subscription is intended to start (can be future or past).
4516
        StartDate *int64 `form:"start_date"`
4517
        // 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.
4518
        TrialEnd    *int64 `form:"trial_end"`
4519
        TrialEndNow *bool  `form:"-"` // See custom AppendTo
4520
}
4521

4522
// AppendTo implements custom encoding logic for InvoiceCreatePreviewSubscriptionDetailsParams.
UNCOV
4523
func (p *InvoiceCreatePreviewSubscriptionDetailsParams) AppendTo(body *form.Values, keyParts []string) {
×
UNCOV
4524
        if BoolValue(p.BillingCycleAnchorNow) {
×
UNCOV
4525
                body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "now")
×
UNCOV
4526
        }
×
UNCOV
4527
        if BoolValue(p.BillingCycleAnchorUnchanged) {
×
4528
                body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "unchanged")
×
4529
        }
×
4530
        if BoolValue(p.TrialEndNow) {
×
4531
                body.Add(form.FormatKey(append(keyParts, "trial_end")), "now")
×
4532
        }
×
4533
}
4534

4535
// At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice.
4536
//
4537
// Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount.
4538
//
4539
// You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass the subscription_details.proration_date parameter when doing the actual subscription update. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_details.proration_date value passed in the request.
4540
//
4541
// Note: Currency conversion calculations use the latest exchange rates. Exchange rates may vary between the time of the preview and the time of the actual invoice creation. [Learn more](https://docs.stripe.com/currencies/conversions)
4542
type InvoiceCreatePreviewParams struct {
4543
        Params `form:"*"`
4544
        // Settings for automatic tax lookup for this invoice preview.
4545
        AutomaticTax *InvoiceCreatePreviewAutomaticTaxParams `form:"automatic_tax"`
4546
        // The ID of the coupon to apply to this phase of the subscription schedule. This field has been deprecated and will be removed in a future API version. Use `discounts` instead.
4547
        Coupon *string `form:"coupon"`
4548
        // The currency to preview this invoice in. Defaults to that of `customer` if not specified.
4549
        Currency *string `form:"currency"`
4550
        // 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.
4551
        Customer *string `form:"customer"`
4552
        // 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.
4553
        CustomerDetails *InvoiceCreatePreviewCustomerDetailsParams `form:"customer_details"`
4554
        // 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.
4555
        Discounts []*InvoiceCreatePreviewDiscountParams `form:"discounts"`
4556
        // Specifies which fields in the response should be expanded.
4557
        Expand []*string `form:"expand"`
4558
        // List of invoice items to add or update in the upcoming invoice preview (up to 250).
4559
        InvoiceItems []*InvoiceCreatePreviewInvoiceItemParams `form:"invoice_items"`
4560
        // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account.
4561
        Issuer *InvoiceCreatePreviewIssuerParams `form:"issuer"`
4562
        // 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](https://stripe.com/docs/billing/invoices/connect) documentation for details.
4563
        OnBehalfOf *string `form:"on_behalf_of"`
4564
        // Customizes the types of values to include when calculating the invoice. Defaults to `next` if unspecified.
4565
        PreviewMode *string `form:"preview_mode"`
4566
        // The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields.
4567
        Schedule *string `form:"schedule"`
4568
        // The schedule creation or modification params to apply as a preview. Cannot be used with `subscription` or `subscription_` prefixed fields.
4569
        ScheduleDetails *InvoiceCreatePreviewScheduleDetailsParams `form:"schedule_details"`
4570
        // 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.
4571
        Subscription *string `form:"subscription"`
4572
        // The subscription creation or modification params to apply as a preview. Cannot be used with `schedule` or `schedule_details` fields.
4573
        SubscriptionDetails *InvoiceCreatePreviewSubscriptionDetailsParams `form:"subscription_details"`
4574
}
4575

4576
// AddExpand appends a new field to expand.
UNCOV
4577
func (p *InvoiceCreatePreviewParams) AddExpand(f string) {
×
UNCOV
4578
        p.Expand = append(p.Expand, &f)
×
UNCOV
4579
}
×
4580

4581
// When retrieving an invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
4582
type InvoiceListLinesParams struct {
4583
        ListParams `form:"*"`
4584
        Invoice    *string `form:"-"` // Included in URL
4585
        // Specifies which fields in the response should be expanded.
4586
        Expand []*string `form:"expand"`
4587
}
4588

4589
// AddExpand appends a new field to expand.
UNCOV
4590
func (p *InvoiceListLinesParams) AddExpand(f string) {
×
UNCOV
4591
        p.Expand = append(p.Expand, &f)
×
UNCOV
4592
}
×
4593

4594
// List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically.
4595
type InvoiceAmountsDue struct {
4596
        // Incremental amount due for this payment in cents (or local equivalent).
4597
        Amount int64 `json:"amount"`
4598
        // The amount in cents (or local equivalent) that was paid for this payment.
4599
        AmountPaid int64 `json:"amount_paid"`
4600
        // The difference between the payment's amount and amount_paid, in cents (or local equivalent).
4601
        AmountRemaining int64 `json:"amount_remaining"`
4602
        // Number of days from when invoice is finalized until the payment is due.
4603
        DaysUntilDue int64 `json:"days_until_due"`
4604
        // An arbitrary string attached to the object. Often useful for displaying to users.
4605
        Description string `json:"description"`
4606
        // Date on which a payment plan's payment is due.
4607
        DueDate int64 `json:"due_date"`
4608
        // Timestamp when the payment was paid.
4609
        PaidAt int64 `json:"paid_at"`
4610
        // The status of the payment, one of `open`, `paid`, or `past_due`
4611
        Status InvoiceAmountsDueStatus `json:"status"`
4612
}
4613

4614
// The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
4615
type InvoiceAutomaticTaxLiability struct {
4616
        // The connected account being referenced when `type` is `account`.
4617
        Account *Account `json:"account"`
4618
        // Type of the account referenced.
4619
        Type InvoiceAutomaticTaxLiabilityType `json:"type"`
4620
}
4621
type InvoiceAutomaticTax struct {
4622
        // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices.
4623
        Enabled bool `json:"enabled"`
4624
        // The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
4625
        Liability *InvoiceAutomaticTaxLiability `json:"liability"`
4626
        // The status of the most recent automated tax calculation for this invoice.
4627
        Status InvoiceAutomaticTaxStatus `json:"status"`
4628
}
4629

4630
// Custom fields displayed on the invoice.
4631
type InvoiceCustomField struct {
4632
        // The name of the custom field.
4633
        Name string `json:"name"`
4634
        // The value of the custom field.
4635
        Value string `json:"value"`
4636
}
4637

4638
// The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as `customer.tax_ids`. Once the invoice is finalized, this field will no longer be updated.
4639
type InvoiceCustomerTaxID struct {
4640
        // The type of the tax ID, one of `ad_nrt`, `ar_cuit`, `eu_vat`, `bo_tin`, `br_cnpj`, `br_cpf`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eu_oss_vat`, `hr_oib`, `pe_ruc`, `ro_tin`, `rs_pib`, `sv_nit`, `uy_ruc`, `ve_rif`, `vn_tin`, `gb_vat`, `nz_gst`, `au_abn`, `au_arn`, `in_gst`, `no_vat`, `no_voec`, `za_vat`, `ch_vat`, `mx_rfc`, `sg_uen`, `ru_inn`, `ru_kpp`, `ca_bn`, `hk_br`, `es_cif`, `tw_vat`, `th_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `li_uid`, `my_itn`, `us_ein`, `kr_brn`, `ca_qst`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `my_sst`, `sg_gst`, `ae_trn`, `cl_tin`, `sa_vat`, `id_npwp`, `my_frp`, `il_vat`, `ge_vat`, `ua_vat`, `is_vat`, `bg_uic`, `hu_tin`, `si_tin`, `ke_pin`, `tr_tin`, `eg_tin`, `ph_tin`, `bh_vat`, `kz_bin`, `ng_tin`, `om_vat`, `de_stn`, `ch_uid`, `tz_vat`, `uz_vat`, `uz_tin`, `md_vat`, `ma_vat`, `by_tin`, or `unknown`
4641
        Type *TaxIDType `json:"type"`
4642
        // The value of the tax ID.
4643
        Value string `json:"value"`
4644
}
4645

4646
// Details of the invoice that was cloned. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
4647
type InvoiceFromInvoice struct {
4648
        // The relation between this invoice and the cloned invoice
4649
        Action string `json:"action"`
4650
        // The invoice that was cloned.
4651
        Invoice *Invoice `json:"invoice"`
4652
}
4653
type InvoiceIssuer struct {
4654
        // The connected account being referenced when `type` is `account`.
4655
        Account *Account `json:"account"`
4656
        // Type of the account referenced.
4657
        Type InvoiceIssuerType `json:"type"`
4658
}
4659
type InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptions struct {
4660
        // Transaction type of the mandate.
4661
        TransactionType InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsTransactionType `json:"transaction_type"`
4662
}
4663

4664
// If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice's PaymentIntent.
4665
type InvoicePaymentSettingsPaymentMethodOptionsACSSDebit struct {
4666
        MandateOptions *InvoicePaymentSettingsPaymentMethodOptionsACSSDebitMandateOptions `json:"mandate_options"`
4667
        // Bank account verification method.
4668
        VerificationMethod InvoicePaymentSettingsPaymentMethodOptionsACSSDebitVerificationMethod `json:"verification_method"`
4669
}
4670

4671
// If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent.
4672
type InvoicePaymentSettingsPaymentMethodOptionsBancontact struct {
4673
        // Preferred language of the Bancontact authorization page that the customer is redirected to.
4674
        PreferredLanguage string `json:"preferred_language"`
4675
}
4676
type InvoicePaymentSettingsPaymentMethodOptionsCardInstallments struct {
4677
        // Whether Installments are enabled for this Invoice.
4678
        Enabled bool `json:"enabled"`
4679
}
4680

4681
// If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice's PaymentIntent.
4682
type InvoicePaymentSettingsPaymentMethodOptionsCard struct {
4683
        Installments *InvoicePaymentSettingsPaymentMethodOptionsCardInstallments `json:"installments"`
4684
        // We strongly recommend that you rely on our SCA Engine to automatically prompt your customers for authentication based on risk level and [other requirements](https://stripe.com/docs/strong-customer-authentication). However, if you wish to request 3D Secure based on logic from your own fraud engine, provide this option. Read our guide on [manually requesting 3D Secure](https://stripe.com/docs/payments/3d-secure/authentication-flow#manual-three-ds) for more information on how this configuration interacts with Radar and our SCA Engine.
4685
        RequestThreeDSecure InvoicePaymentSettingsPaymentMethodOptionsCardRequestThreeDSecure `json:"request_three_d_secure"`
4686
}
4687
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEUBankTransfer struct {
4688
        // The desired country code of the bank account information. Permitted values include: `BE`, `DE`, `ES`, `FR`, `IE`, or `NL`.
4689
        Country string `json:"country"`
4690
}
4691
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer struct {
4692
        EUBankTransfer *InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransferEUBankTransfer `json:"eu_bank_transfer"`
4693
        // The bank transfer type that can be used for funding. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
4694
        Type string `json:"type"`
4695
}
4696

4697
// If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice's PaymentIntent.
4698
type InvoicePaymentSettingsPaymentMethodOptionsCustomerBalance struct {
4699
        BankTransfer *InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceBankTransfer `json:"bank_transfer"`
4700
        // The funding method type to be used when there are not enough funds in the customer balance. Permitted values include: `bank_transfer`.
4701
        FundingType InvoicePaymentSettingsPaymentMethodOptionsCustomerBalanceFundingType `json:"funding_type"`
4702
}
4703

4704
// If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice's PaymentIntent.
4705
type InvoicePaymentSettingsPaymentMethodOptionsKonbini struct{}
4706

4707
// If paying by `sepa_debit`, this sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice's PaymentIntent.
4708
type InvoicePaymentSettingsPaymentMethodOptionsSEPADebit struct{}
4709
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFilters struct {
4710
        // The account subcategories to use to filter for possible accounts to link. Valid subcategories are `checking` and `savings`.
4711
        AccountSubcategories []InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFiltersAccountSubcategory `json:"account_subcategories"`
4712
        // The institution to use to filter for possible accounts to link.
4713
        Institution string `json:"institution"`
4714
}
4715
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnections struct {
4716
        Filters *InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsFilters `json:"filters"`
4717
        // The list of permissions to request. The `payment_method` permission must be included.
4718
        Permissions []InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission `json:"permissions"`
4719
        // Data features requested to be retrieved upon account creation.
4720
        Prefetch []InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnectionsPrefetch `json:"prefetch"`
4721
}
4722

4723
// If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice's PaymentIntent.
4724
type InvoicePaymentSettingsPaymentMethodOptionsUSBankAccount struct {
4725
        FinancialConnections *InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountFinancialConnections `json:"financial_connections"`
4726
        // Bank account verification method.
4727
        VerificationMethod InvoicePaymentSettingsPaymentMethodOptionsUSBankAccountVerificationMethod `json:"verification_method"`
4728
}
4729

4730
// Payment-method-specific configuration to provide to the invoice's PaymentIntent.
4731
type InvoicePaymentSettingsPaymentMethodOptions struct {
4732
        // If paying by `acss_debit`, this sub-hash contains details about the Canadian pre-authorized debit payment method options to pass to the invoice's PaymentIntent.
4733
        ACSSDebit *InvoicePaymentSettingsPaymentMethodOptionsACSSDebit `json:"acss_debit"`
4734
        // If paying by `bancontact`, this sub-hash contains details about the Bancontact payment method options to pass to the invoice's PaymentIntent.
4735
        Bancontact *InvoicePaymentSettingsPaymentMethodOptionsBancontact `json:"bancontact"`
4736
        // If paying by `card`, this sub-hash contains details about the Card payment method options to pass to the invoice's PaymentIntent.
4737
        Card *InvoicePaymentSettingsPaymentMethodOptionsCard `json:"card"`
4738
        // If paying by `customer_balance`, this sub-hash contains details about the Bank transfer payment method options to pass to the invoice's PaymentIntent.
4739
        CustomerBalance *InvoicePaymentSettingsPaymentMethodOptionsCustomerBalance `json:"customer_balance"`
4740
        // If paying by `konbini`, this sub-hash contains details about the Konbini payment method options to pass to the invoice's PaymentIntent.
4741
        Konbini *InvoicePaymentSettingsPaymentMethodOptionsKonbini `json:"konbini"`
4742
        // If paying by `sepa_debit`, this sub-hash contains details about the SEPA Direct Debit payment method options to pass to the invoice's PaymentIntent.
4743
        SEPADebit *InvoicePaymentSettingsPaymentMethodOptionsSEPADebit `json:"sepa_debit"`
4744
        // If paying by `us_bank_account`, this sub-hash contains details about the ACH direct debit payment method options to pass to the invoice's PaymentIntent.
4745
        USBankAccount *InvoicePaymentSettingsPaymentMethodOptionsUSBankAccount `json:"us_bank_account"`
4746
}
4747
type InvoicePaymentSettings struct {
4748
        // ID of the mandate to be used for this invoice. It must correspond to the payment method used to pay the invoice, including the invoice's default_payment_method or default_source, if set.
4749
        DefaultMandate string `json:"default_mandate"`
4750
        // Payment-method-specific configuration to provide to the invoice's PaymentIntent.
4751
        PaymentMethodOptions *InvoicePaymentSettingsPaymentMethodOptions `json:"payment_method_options"`
4752
        // The list of payment method types (e.g. card) to provide to the invoice's PaymentIntent. If not set, Stripe attempts to automatically determine the types to use by looking at the invoice's default payment method, the subscription's default payment method, the customer's default payment method, and your [invoice template settings](https://dashboard.stripe.com/settings/billing/invoice).
4753
        PaymentMethodTypes []InvoicePaymentSettingsPaymentMethodType `json:"payment_method_types"`
4754
}
4755

4756
// Invoice pdf rendering options
4757
type InvoiceRenderingPDF struct {
4758
        // Page size of invoice pdf. Options include a4, letter, and auto. If set to auto, page size will be switched to a4 or letter based on customer locale.
4759
        PageSize InvoiceRenderingPDFPageSize `json:"page_size"`
4760
}
4761

4762
// The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
4763
type InvoiceRendering struct {
4764
        // How line-item prices and amounts will be displayed with respect to tax on invoice PDFs.
4765
        AmountTaxDisplay string `json:"amount_tax_display"`
4766
        // Invoice pdf rendering options
4767
        PDF *InvoiceRenderingPDF `json:"pdf"`
4768
        // ID of the rendering template that the invoice is formatted by.
4769
        Template string `json:"template"`
4770
        // Version of the rendering template that the invoice is using.
4771
        TemplateVersion int64 `json:"template_version"`
4772
}
4773

4774
// The taxes applied to the shipping rate.
4775
type InvoiceShippingCostTax struct {
4776
        // Amount of tax applied for this rate.
4777
        Amount int64 `json:"amount"`
4778
        // Tax rates can be applied to [invoices](https://stripe.com/docs/billing/invoices/tax-rates), [subscriptions](https://stripe.com/docs/billing/subscriptions/taxes) and [Checkout Sessions](https://stripe.com/docs/payments/checkout/set-up-a-subscription#tax-rates) to collect tax.
4779
        //
4780
        // Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates)
4781
        Rate *TaxRate `json:"rate"`
4782
        // The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
4783
        TaxabilityReason InvoiceShippingCostTaxTaxabilityReason `json:"taxability_reason"`
4784
        // The amount on which tax is calculated, in cents (or local equivalent).
4785
        TaxableAmount int64 `json:"taxable_amount"`
4786
}
4787

4788
// The details of the cost of shipping, including the ShippingRate applied on the invoice.
4789
type InvoiceShippingCost struct {
4790
        // Total shipping cost before any taxes are applied.
4791
        AmountSubtotal int64 `json:"amount_subtotal"`
4792
        // Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0.
4793
        AmountTax int64 `json:"amount_tax"`
4794
        // Total shipping cost after taxes are applied.
4795
        AmountTotal int64 `json:"amount_total"`
4796
        // The ID of the ShippingRate for this invoice.
4797
        ShippingRate *ShippingRate `json:"shipping_rate"`
4798
        // The taxes applied to the shipping rate.
4799
        Taxes []*InvoiceShippingCostTax `json:"taxes"`
4800
}
4801
type InvoiceStatusTransitions struct {
4802
        // The time that the invoice draft was finalized.
4803
        FinalizedAt int64 `json:"finalized_at"`
4804
        // The time that the invoice was marked uncollectible.
4805
        MarkedUncollectibleAt int64 `json:"marked_uncollectible_at"`
4806
        // The time that the invoice was paid.
4807
        PaidAt int64 `json:"paid_at"`
4808
        // The time that the invoice was voided.
4809
        VoidedAt int64 `json:"voided_at"`
4810
}
4811

4812
// If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
4813
type InvoiceSubscriptionDetailsPauseCollection struct {
4814
        // The payment collection behavior for this subscription while paused. One of `keep_as_draft`, `mark_uncollectible`, or `void`.
4815
        Behavior InvoiceSubscriptionDetailsPauseCollectionBehavior `json:"behavior"`
4816
        // The time after which the subscription will resume collecting payments.
4817
        ResumesAt int64 `json:"resumes_at"`
4818
}
4819

4820
// Details about the subscription that created this invoice.
4821
type InvoiceSubscriptionDetails struct {
4822
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) defined as subscription metadata when an invoice is created. Becomes an immutable snapshot of the subscription metadata at the time of invoice finalization.
4823
        //  *Note: This attribute is populated only for invoices created on or after June 29, 2023.*
4824
        Metadata map[string]string `json:"metadata"`
4825
        // If specified, payment collection for this subscription will be paused. Note that the subscription status will be unchanged and will not be updated to `paused`. Learn more about [pausing collection](https://stripe.com/billing/subscriptions/pause-payment).
4826
        PauseCollection *InvoiceSubscriptionDetailsPauseCollection `json:"pause_collection"`
4827
}
4828

4829
// Indicates which line items triggered a threshold invoice.
4830
type InvoiceThresholdReasonItemReason struct {
4831
        // The IDs of the line items that triggered the threshold invoice.
4832
        LineItemIDs []string `json:"line_item_ids"`
4833
        // The quantity threshold boundary that applied to the given line item.
4834
        UsageGTE int64 `json:"usage_gte"`
4835
}
4836
type InvoiceThresholdReason struct {
4837
        // The total invoice amount threshold boundary if it triggered the threshold invoice.
4838
        AmountGTE int64 `json:"amount_gte"`
4839
        // Indicates which line items triggered a threshold invoice.
4840
        ItemReasons []*InvoiceThresholdReasonItemReason `json:"item_reasons"`
4841
}
4842

4843
// The aggregate amounts calculated per discount across all line items.
4844
type InvoiceTotalDiscountAmount struct {
4845
        // The amount, in cents (or local equivalent), of the discount.
4846
        Amount int64 `json:"amount"`
4847
        // The discount that was applied to get this discount amount.
4848
        Discount *Discount `json:"discount"`
4849
}
4850

4851
// The aggregate amounts calculated per margin across all line items.
4852
type InvoiceTotalMarginAmount struct {
4853
        // The amount, in cents (or local equivalent), of the reduction in line item amount.
4854
        Amount int64 `json:"amount"`
4855
        // The margin that was applied to get this margin amount.
4856
        Margin *Margin `json:"margin"`
4857
}
4858

4859
// Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice. This is a combined list of total_pretax_credit_amounts across all invoice line items.
4860
type InvoiceTotalPretaxCreditAmount struct {
4861
        // The amount, in cents (or local equivalent), of the pretax credit amount.
4862
        Amount int64 `json:"amount"`
4863
        // The credit balance transaction that was applied to get this pretax credit amount.
4864
        CreditBalanceTransaction *BillingCreditBalanceTransaction `json:"credit_balance_transaction"`
4865
        // The discount that was applied to get this pretax credit amount.
4866
        Discount *Discount `json:"discount"`
4867
        // The margin that was applied to get this pretax credit amount.
4868
        Margin *Margin `json:"margin"`
4869
        // Type of the pretax credit amount referenced.
4870
        Type InvoiceTotalPretaxCreditAmountType `json:"type"`
4871
}
4872

4873
// The aggregate amounts calculated per tax rate for all line items.
4874
type InvoiceTotalTaxAmount struct {
4875
        // The amount, in cents (or local equivalent), of the tax.
4876
        Amount int64 `json:"amount"`
4877
        // Whether this tax amount is inclusive or exclusive.
4878
        Inclusive bool `json:"inclusive"`
4879
        // The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
4880
        TaxabilityReason InvoiceTotalTaxAmountTaxabilityReason `json:"taxability_reason"`
4881
        // The amount on which tax is calculated, in cents (or local equivalent).
4882
        TaxableAmount int64 `json:"taxable_amount"`
4883
        // The tax rate that was applied to get this tax amount.
4884
        TaxRate *TaxRate `json:"tax_rate"`
4885
}
4886

4887
// The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice.
4888
type InvoiceTransferData struct {
4889
        // The amount in cents (or local equivalent) that will be transferred to the destination account when the invoice is paid. By default, the entire amount is transferred to the destination.
4890
        Amount int64 `json:"amount"`
4891
        // The account where funds from the payment will be transferred to upon payment success.
4892
        Destination *Account `json:"destination"`
4893
}
4894

4895
// Invoices are statements of amounts owed by a customer, and are either
4896
// generated one-off, or generated periodically from a subscription.
4897
//
4898
// They contain [invoice items](https://stripe.com/docs/api#invoiceitems), and proration adjustments
4899
// that may be caused by subscription upgrades/downgrades (if necessary).
4900
//
4901
// If your invoice is configured to be billed through automatic charges,
4902
// Stripe automatically finalizes your invoice and attempts payment. Note
4903
// that finalizing the invoice,
4904
// [when automatic](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection), does
4905
// not happen immediately as the invoice is created. Stripe waits
4906
// until one hour after the last webhook was successfully sent (or the last
4907
// webhook timed out after failing). If you (and the platforms you may have
4908
// connected to) have no webhooks configured, Stripe waits one hour after
4909
// creation to finalize the invoice.
4910
//
4911
// If your invoice is configured to be billed by sending an email, then based on your
4912
// [email settings](https://dashboard.stripe.com/account/billing/automatic),
4913
// Stripe will email the invoice to your customer and await payment. These
4914
// emails can contain a link to a hosted page to pay the invoice.
4915
//
4916
// Stripe applies any customer credit on the account before determining the
4917
// amount due for the invoice (i.e., the amount that will be actually
4918
// charged). If the amount due for the invoice is less than Stripe's [minimum allowed charge
4919
// per currency](https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts), the
4920
// invoice is automatically marked paid, and we add the amount due to the
4921
// customer's credit balance which is applied to the next invoice.
4922
//
4923
// More details on the customer's credit balance are
4924
// [here](https://stripe.com/docs/billing/customer/balance).
4925
//
4926
// Related guide: [Send invoices to customers](https://stripe.com/docs/billing/invoices/sending)
4927
type Invoice struct {
4928
        APIResource
4929
        // The country of the business associated with this invoice, most often the business creating the invoice.
4930
        AccountCountry string `json:"account_country"`
4931
        // The public name of the business associated with this invoice, most often the business creating the invoice.
4932
        AccountName string `json:"account_name"`
4933
        // The account tax IDs associated with the invoice. Only editable when the invoice is a draft.
4934
        AccountTaxIDs []*TaxID `json:"account_tax_ids"`
4935
        // Final amount due at this time for this invoice. If the invoice's total is smaller than the minimum charge amount, for example, or if there is account credit that can be applied to the invoice, the `amount_due` may be 0. If there is a positive `starting_balance` for the invoice (the customer owes money), the `amount_due` will also take that into account. The charge that gets generated for the invoice will be for the amount specified in `amount_due`.
4936
        AmountDue int64 `json:"amount_due"`
4937
        // The amount, in cents (or local equivalent), that was paid.
4938
        AmountPaid int64 `json:"amount_paid"`
4939
        // The difference between amount_due and amount_paid, in cents (or local equivalent).
4940
        AmountRemaining int64 `json:"amount_remaining"`
4941
        // List of expected payments and corresponding due dates. This value will be null for invoices where collection_method=charge_automatically.
4942
        AmountsDue []*InvoiceAmountsDue `json:"amounts_due"`
4943
        // This is the sum of all the shipping amounts.
4944
        AmountShipping int64 `json:"amount_shipping"`
4945
        // ID of the Connect Application that created the invoice.
4946
        Application *Application `json:"application"`
4947
        // The fee in cents (or local equivalent) that will be applied to the invoice and transferred to the application owner's Stripe account when the invoice is paid.
4948
        ApplicationFeeAmount int64 `json:"application_fee_amount"`
4949
        // Number of payment attempts made for this invoice, from the perspective of the payment retry schedule. Any payment attempt counts as the first attempt, and subsequently only automatic retries increment the attempt count. In other words, manual payment attempts after the first attempt do not affect the retry schedule. If a failure is returned with a non-retryable return code, the invoice can no longer be retried unless a new payment method is obtained. Retries will continue to be scheduled, and attempt_count will continue to increment, but retries will only be executed if a new payment method is obtained.
4950
        AttemptCount int64 `json:"attempt_count"`
4951
        // Whether an attempt has been made to pay the invoice. An invoice is not attempted until 1 hour after the `invoice.created` webhook, for example, so you might not want to display that invoice as unpaid to your users.
4952
        Attempted bool `json:"attempted"`
4953
        // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action.
4954
        AutoAdvance bool `json:"auto_advance"`
4955
        // The time when this invoice is currently scheduled to be automatically finalized. The field will be `null` if the invoice is not scheduled to finalize in the future. If the invoice is not in the draft state, this field will always be `null` - see `finalized_at` for the time when an already-finalized invoice was finalized.
4956
        AutomaticallyFinalizesAt int64                `json:"automatically_finalizes_at"`
4957
        AutomaticTax             *InvoiceAutomaticTax `json:"automatic_tax"`
4958
        // Indicates the reason why the invoice was created.
4959
        //
4960
        // * `manual`: Unrelated to a subscription, for example, created via the invoice editor.
4961
        // * `subscription`: No longer in use. Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
4962
        // * `subscription_create`: A new subscription was created.
4963
        // * `subscription_cycle`: A subscription advanced into a new period.
4964
        // * `subscription_threshold`: A subscription reached a billing threshold.
4965
        // * `subscription_update`: A subscription was updated.
4966
        // * `upcoming`: Reserved for simulated invoices, per the upcoming invoice endpoint.
4967
        BillingReason InvoiceBillingReason `json:"billing_reason"`
4968
        // ID of the latest charge generated for this invoice, if any.
4969
        Charge *Charge `json:"charge"`
4970
        // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay this invoice using the default source attached to the customer. When sending an invoice, Stripe will email this invoice to the customer with payment instructions.
4971
        CollectionMethod InvoiceCollectionMethod `json:"collection_method"`
4972
        // Time at which the object was created. Measured in seconds since the Unix epoch.
4973
        Created int64 `json:"created"`
4974
        // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
4975
        Currency Currency `json:"currency"`
4976
        // The ID of the customer who will be billed.
4977
        Customer *Customer `json:"customer"`
4978
        // The customer's address. Until the invoice is finalized, this field will equal `customer.address`. Once the invoice is finalized, this field will no longer be updated.
4979
        CustomerAddress *Address `json:"customer_address"`
4980
        // The customer's email. Until the invoice is finalized, this field will equal `customer.email`. Once the invoice is finalized, this field will no longer be updated.
4981
        CustomerEmail string `json:"customer_email"`
4982
        // The customer's name. Until the invoice is finalized, this field will equal `customer.name`. Once the invoice is finalized, this field will no longer be updated.
4983
        CustomerName string `json:"customer_name"`
4984
        // The customer's phone number. Until the invoice is finalized, this field will equal `customer.phone`. Once the invoice is finalized, this field will no longer be updated.
4985
        CustomerPhone string `json:"customer_phone"`
4986
        // The customer's shipping information. Until the invoice is finalized, this field will equal `customer.shipping`. Once the invoice is finalized, this field will no longer be updated.
4987
        CustomerShipping *ShippingDetails `json:"customer_shipping"`
4988
        // The customer's tax exempt status. Until the invoice is finalized, this field will equal `customer.tax_exempt`. Once the invoice is finalized, this field will no longer be updated.
4989
        CustomerTaxExempt *CustomerTaxExempt `json:"customer_tax_exempt"`
4990
        // The customer's tax IDs. Until the invoice is finalized, this field will contain the same tax IDs as `customer.tax_ids`. Once the invoice is finalized, this field will no longer be updated.
4991
        CustomerTaxIDs []*InvoiceCustomerTaxID `json:"customer_tax_ids"`
4992
        // Custom fields displayed on the invoice.
4993
        CustomFields []*InvoiceCustomField `json:"custom_fields"`
4994
        // The margins applied to the invoice. Can be overridden by line item `margins`. Use `expand[]=default_margins` to expand each margin.
4995
        DefaultMargins []*Margin `json:"default_margins"`
4996
        // ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings.
4997
        DefaultPaymentMethod *PaymentMethod `json:"default_payment_method"`
4998
        // ID of the default payment source for the invoice. It must belong to the customer associated with the invoice and be in a chargeable state. If not set, defaults to the subscription's default source, if any, or to the customer's default source.
4999
        DefaultSource *PaymentSource `json:"default_source"`
5000
        // The tax rates applied to this invoice, if any.
5001
        DefaultTaxRates []*TaxRate `json:"default_tax_rates"`
5002
        Deleted         bool       `json:"deleted"`
5003
        // An arbitrary string attached to the object. Often useful for displaying to users. Referenced as 'memo' in the Dashboard.
5004
        Description string `json:"description"`
5005
        // Describes the current discount applied to this invoice, if there is one. Not populated if there are multiple discounts.
5006
        Discount *Discount `json:"discount"`
5007
        // The discounts applied to the invoice. Line item discounts are applied before invoice discounts. Use `expand[]=discounts` to expand each discount.
5008
        Discounts []*Discount `json:"discounts"`
5009
        // The date on which payment for this invoice is due. This value will be `null` for invoices where `collection_method=charge_automatically`.
5010
        DueDate int64 `json:"due_date"`
5011
        // The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt.
5012
        EffectiveAt int64 `json:"effective_at"`
5013
        // Ending customer balance after the invoice is finalized. Invoices are finalized approximately an hour after successful webhook delivery or when payment collection is attempted for the invoice. If the invoice has not been finalized yet, this will be null.
5014
        EndingBalance int64 `json:"ending_balance"`
5015
        // Footer displayed on the invoice.
5016
        Footer string `json:"footer"`
5017
        // Details of the invoice that was cloned. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details.
5018
        FromInvoice *InvoiceFromInvoice `json:"from_invoice"`
5019
        // The URL for the hosted invoice page, which allows customers to view and pay an invoice. If the invoice has not been finalized yet, this will be null.
5020
        HostedInvoiceURL string `json:"hosted_invoice_url"`
5021
        // Unique identifier for the object. This property is always present unless the invoice is an upcoming invoice. See [Retrieve an upcoming invoice](https://stripe.com/docs/api/invoices/upcoming) for more details.
5022
        ID string `json:"id"`
5023
        // The link to download the PDF for the invoice. If the invoice has not been finalized yet, this will be null.
5024
        InvoicePDF string         `json:"invoice_pdf"`
5025
        Issuer     *InvoiceIssuer `json:"issuer"`
5026
        // The error encountered during the previous attempt to finalize the invoice. This field is cleared when the invoice is successfully finalized.
5027
        LastFinalizationError *Error `json:"last_finalization_error"`
5028
        // The ID of the most recent non-draft revision of this invoice
5029
        LatestRevision *Invoice `json:"latest_revision"`
5030
        // The individual line items that make up the invoice. `lines` is sorted as follows: (1) pending invoice items (including prorations) in reverse chronological order, (2) subscription items in reverse chronological order, and (3) invoice items added after invoice creation in chronological order.
5031
        Lines *InvoiceLineItemList `json:"lines"`
5032
        // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
5033
        Livemode bool `json:"livemode"`
5034
        // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
5035
        Metadata map[string]string `json:"metadata"`
5036
        // The time at which payment will next be attempted. This value will be `null` for invoices where `collection_method=send_invoice`.
5037
        NextPaymentAttempt int64 `json:"next_payment_attempt"`
5038
        // A unique, identifying string that appears on emails sent to the customer for this invoice. This starts with the customer's unique invoice_prefix if it is specified.
5039
        Number string `json:"number"`
5040
        // String representing the object's type. Objects of the same type share the same value.
5041
        Object string `json:"object"`
5042
        // 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](https://stripe.com/docs/billing/invoices/connect) documentation for details.
5043
        OnBehalfOf *Account `json:"on_behalf_of"`
5044
        // Whether payment was successfully collected for this invoice. An invoice can be paid (most commonly) with a charge or with credit from the customer's account balance.
5045
        Paid bool `json:"paid"`
5046
        // Returns true if the invoice was manually marked paid, returns false if the invoice hasn't been paid yet or was paid on Stripe.
5047
        PaidOutOfBand bool `json:"paid_out_of_band"`
5048
        // The PaymentIntent associated with this invoice. The PaymentIntent is generated when the invoice is finalized, and can then be used to pay the invoice. Note that voiding an invoice will cancel the PaymentIntent.
5049
        PaymentIntent *PaymentIntent `json:"payment_intent"`
5050
        // Payments for this invoice
5051
        Payments        *InvoicePaymentList     `json:"payments"`
5052
        PaymentSettings *InvoicePaymentSettings `json:"payment_settings"`
5053
        // End of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](https://stripe.com/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price.
5054
        PeriodEnd int64 `json:"period_end"`
5055
        // Start of the usage period during which invoice items were added to this invoice. This looks back one period for a subscription invoice. Use the [line item period](https://stripe.com/api/invoices/line_item#invoice_line_item_object-period) to get the service period for each price.
5056
        PeriodStart int64 `json:"period_start"`
5057
        // Total amount of all post-payment credit notes issued for this invoice.
5058
        PostPaymentCreditNotesAmount int64 `json:"post_payment_credit_notes_amount"`
5059
        // Total amount of all pre-payment credit notes issued for this invoice.
5060
        PrePaymentCreditNotesAmount int64 `json:"pre_payment_credit_notes_amount"`
5061
        // The quote this invoice was generated from.
5062
        Quote *Quote `json:"quote"`
5063
        // This is the transaction number that appears on email receipts sent for this invoice.
5064
        ReceiptNumber string `json:"receipt_number"`
5065
        // The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page.
5066
        Rendering *InvoiceRendering `json:"rendering"`
5067
        // The details of the cost of shipping, including the ShippingRate applied on the invoice.
5068
        ShippingCost *InvoiceShippingCost `json:"shipping_cost"`
5069
        // Shipping details for the invoice. The Invoice PDF will use the `shipping_details` value if it is set, otherwise the PDF will render the shipping address from the customer.
5070
        ShippingDetails *ShippingDetails `json:"shipping_details"`
5071
        // Starting customer balance before the invoice is finalized. If the invoice has not been finalized yet, this will be the current customer balance. For revision invoices, this also includes any customer balance that was applied to the original invoice.
5072
        StartingBalance int64 `json:"starting_balance"`
5073
        // Extra information about an invoice for the customer's credit card statement.
5074
        StatementDescriptor string `json:"statement_descriptor"`
5075
        // The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview)
5076
        Status            InvoiceStatus             `json:"status"`
5077
        StatusTransitions *InvoiceStatusTransitions `json:"status_transitions"`
5078
        // The subscription that this invoice was prepared for, if any.
5079
        Subscription *Subscription `json:"subscription"`
5080
        // Details about the subscription that created this invoice.
5081
        SubscriptionDetails *InvoiceSubscriptionDetails `json:"subscription_details"`
5082
        // Only set for upcoming invoices that preview prorations. The time used to calculate prorations.
5083
        SubscriptionProrationDate int64 `json:"subscription_proration_date"`
5084
        // Total of all subscriptions, invoice items, and prorations on the invoice before any invoice level discount or exclusive tax is applied. Item discounts are already incorporated
5085
        Subtotal int64 `json:"subtotal"`
5086
        // The integer amount in cents (or local equivalent) representing the subtotal of the invoice before any invoice level discount or tax is applied. Item discounts are already incorporated
5087
        SubtotalExcludingTax int64 `json:"subtotal_excluding_tax"`
5088
        // The amount of tax on this invoice. This is the sum of all the tax amounts on this invoice.
5089
        Tax int64 `json:"tax"`
5090
        // ID of the test clock this invoice belongs to.
5091
        TestClock       *TestHelpersTestClock   `json:"test_clock"`
5092
        ThresholdReason *InvoiceThresholdReason `json:"threshold_reason"`
5093
        // Total after discounts and taxes.
5094
        Total int64 `json:"total"`
5095
        // The aggregate amounts calculated per discount across all line items.
5096
        TotalDiscountAmounts []*InvoiceTotalDiscountAmount `json:"total_discount_amounts"`
5097
        // The integer amount in cents (or local equivalent) representing the total amount of the invoice including all discounts but excluding all tax.
5098
        TotalExcludingTax int64 `json:"total_excluding_tax"`
5099
        // The aggregate amounts calculated per margin across all line items.
5100
        TotalMarginAmounts []*InvoiceTotalMarginAmount `json:"total_margin_amounts"`
5101
        // Contains pretax credit amounts (ex: discount, credit grants, etc) that apply to this invoice. This is a combined list of total_pretax_credit_amounts across all invoice line items.
5102
        TotalPretaxCreditAmounts []*InvoiceTotalPretaxCreditAmount `json:"total_pretax_credit_amounts"`
5103
        // The aggregate amounts calculated per tax rate for all line items.
5104
        TotalTaxAmounts []*InvoiceTotalTaxAmount `json:"total_tax_amounts"`
5105
        // The account (if any) the payment will be attributed to for tax reporting, and where funds from the payment will be transferred to for the invoice.
5106
        TransferData *InvoiceTransferData `json:"transfer_data"`
5107
        // Invoices are automatically paid or sent 1 hour after webhooks are delivered, or until all webhook delivery attempts have [been exhausted](https://stripe.com/docs/billing/webhooks#understand). This field tracks the time when webhooks for this invoice were successfully delivered. If the invoice had no webhooks to deliver, this will be set while the invoice is being created.
5108
        WebhooksDeliveredAt int64 `json:"webhooks_delivered_at"`
5109
}
5110

5111
// InvoiceList is a list of Invoices as retrieved from a list endpoint.
5112
type InvoiceList struct {
5113
        APIResource
5114
        ListMeta
5115
        Data []*Invoice `json:"data"`
5116
}
5117

5118
// InvoiceSearchResult is a list of Invoice search results as retrieved from a search endpoint.
5119
type InvoiceSearchResult struct {
5120
        APIResource
5121
        SearchMeta
5122
        Data []*Invoice `json:"data"`
5123
}
5124

5125
// UnmarshalJSON handles deserialization of an Invoice.
5126
// This custom unmarshaling is needed because the resulting
5127
// property may be an id or the full struct if it was expanded.
5128
func (i *Invoice) UnmarshalJSON(data []byte) error {
4✔
5129
        if id, ok := ParseID(data); ok {
5✔
5130
                i.ID = id
1✔
5131
                return nil
1✔
5132
        }
1✔
5133

5134
        type invoice Invoice
3✔
5135
        var v invoice
3✔
5136
        if err := json.Unmarshal(data, &v); err != nil {
3✔
UNCOV
5137
                return err
×
UNCOV
5138
        }
×
5139

5140
        *i = Invoice(v)
3✔
5141
        return nil
3✔
5142
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc