github.com/stripe/stripe-go/v76@v76.25.0/quote.go (about) 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/v76/form" 12 ) 13 14 // Type of the account referenced. 15 type QuoteAutomaticTaxLiabilityType string 16 17 // List of values that QuoteAutomaticTaxLiabilityType can take 18 const ( 19 QuoteAutomaticTaxLiabilityTypeAccount QuoteAutomaticTaxLiabilityType = "account" 20 QuoteAutomaticTaxLiabilityTypeSelf QuoteAutomaticTaxLiabilityType = "self" 21 ) 22 23 // The status of the most recent automated tax calculation for this quote. 24 type QuoteAutomaticTaxStatus string 25 26 // List of values that QuoteAutomaticTaxStatus can take 27 const ( 28 QuoteAutomaticTaxStatusComplete QuoteAutomaticTaxStatus = "complete" 29 QuoteAutomaticTaxStatusFailed QuoteAutomaticTaxStatus = "failed" 30 QuoteAutomaticTaxStatusRequiresLocationInputs QuoteAutomaticTaxStatus = "requires_location_inputs" 31 ) 32 33 // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or 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`. 34 type QuoteCollectionMethod string 35 36 // List of values that QuoteCollectionMethod can take 37 const ( 38 QuoteCollectionMethodChargeAutomatically QuoteCollectionMethod = "charge_automatically" 39 QuoteCollectionMethodSendInvoice QuoteCollectionMethod = "send_invoice" 40 ) 41 42 // The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. 43 type QuoteComputedRecurringInterval string 44 45 // List of values that QuoteComputedRecurringInterval can take 46 const ( 47 QuoteComputedRecurringIntervalDay QuoteComputedRecurringInterval = "day" 48 QuoteComputedRecurringIntervalMonth QuoteComputedRecurringInterval = "month" 49 QuoteComputedRecurringIntervalWeek QuoteComputedRecurringInterval = "week" 50 QuoteComputedRecurringIntervalYear QuoteComputedRecurringInterval = "year" 51 ) 52 53 // 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. 54 type QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason string 55 56 // List of values that QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason can take 57 const ( 58 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" 59 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" 60 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" 61 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" 62 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" 63 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" 64 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" 65 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" 66 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" 67 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" 68 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" 69 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" 70 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" 71 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" 72 QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" 73 ) 74 75 // 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. 76 type QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason string 77 78 // List of values that QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason can take 79 const ( 80 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" 81 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" 82 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" 83 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" 84 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" 85 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" 86 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" 87 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" 88 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" 89 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" 90 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" 91 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" 92 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" 93 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" 94 QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" 95 ) 96 97 // Type of the account referenced. 98 type QuoteInvoiceSettingsIssuerType string 99 100 // List of values that QuoteInvoiceSettingsIssuerType can take 101 const ( 102 QuoteInvoiceSettingsIssuerTypeAccount QuoteInvoiceSettingsIssuerType = "account" 103 QuoteInvoiceSettingsIssuerTypeSelf QuoteInvoiceSettingsIssuerType = "self" 104 ) 105 106 // The status of the quote. 107 type QuoteStatus string 108 109 // List of values that QuoteStatus can take 110 const ( 111 QuoteStatusAccepted QuoteStatus = "accepted" 112 QuoteStatusCanceled QuoteStatus = "canceled" 113 QuoteStatusDraft QuoteStatus = "draft" 114 QuoteStatusOpen QuoteStatus = "open" 115 ) 116 117 // 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. 118 type QuoteTotalDetailsBreakdownTaxTaxabilityReason string 119 120 // List of values that QuoteTotalDetailsBreakdownTaxTaxabilityReason can take 121 const ( 122 QuoteTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" 123 QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" 124 QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" 125 QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" 126 QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" 127 QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" 128 QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" 129 QuoteTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" 130 QuoteTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" 131 QuoteTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" 132 QuoteTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" 133 QuoteTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" 134 QuoteTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" 135 QuoteTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" 136 QuoteTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" 137 ) 138 139 // Returns a list of your quotes. 140 type QuoteListParams struct { 141 ListParams `form:"*"` 142 // The ID of the customer whose quotes will be retrieved. 143 Customer *string `form:"customer"` 144 // Specifies which fields in the response should be expanded. 145 Expand []*string `form:"expand"` 146 // The status of the quote. 147 Status *string `form:"status"` 148 // Provides a list of quotes that are associated with the specified test clock. The response will not include quotes with test clocks if this and the customer parameter is not set. 149 TestClock *string `form:"test_clock"` 150 } 151 152 // AddExpand appends a new field to expand. 153 func (p *QuoteListParams) AddExpand(f string) { 154 p.Expand = append(p.Expand, &f) 155 } 156 157 // 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. 158 type QuoteAutomaticTaxLiabilityParams struct { 159 // The connected account being referenced when `type` is `account`. 160 Account *string `form:"account"` 161 // Type of the account referenced in the request. 162 Type *string `form:"type"` 163 } 164 165 // Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. 166 type QuoteAutomaticTaxParams struct { 167 // Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. 168 Enabled *bool `form:"enabled"` 169 // 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. 170 Liability *QuoteAutomaticTaxLiabilityParams `form:"liability"` 171 } 172 173 // The discounts applied to the quote. You can only set up to one discount. 174 type QuoteDiscountParams struct { 175 // ID of the coupon to create a new discount for. 176 Coupon *string `form:"coupon"` 177 // ID of an existing discount on the object (or one of its ancestors) to reuse. 178 Discount *string `form:"discount"` 179 // ID of the promotion code to create a new discount for. 180 PromotionCode *string `form:"promotion_code"` 181 } 182 183 // Clone an existing quote. The new quote will be created in `status=draft`. When using this parameter, you cannot specify any other parameters except for `expires_at`. 184 type QuoteFromQuoteParams struct { 185 // Whether this quote is a revision of the previous quote. 186 IsRevision *bool `form:"is_revision"` 187 // The `id` of the quote that will be cloned. 188 Quote *string `form:"quote"` 189 } 190 191 // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account. 192 type QuoteInvoiceSettingsIssuerParams struct { 193 // The connected account being referenced when `type` is `account`. 194 Account *string `form:"account"` 195 // Type of the account referenced in the request. 196 Type *string `form:"type"` 197 } 198 199 // All invoices will be billed using the specified settings. 200 type QuoteInvoiceSettingsParams struct { 201 // Number of days within which a customer must pay the invoice generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`. 202 DaysUntilDue *int64 `form:"days_until_due"` 203 // The connected account that issues the invoice. The invoice is presented with the branding and support information of the specified account. 204 Issuer *QuoteInvoiceSettingsIssuerParams `form:"issuer"` 205 } 206 207 // The discounts applied to this line item. 208 type QuoteLineItemDiscountParams struct { 209 // ID of the coupon to create a new discount for. 210 Coupon *string `form:"coupon"` 211 // ID of an existing discount on the object (or one of its ancestors) to reuse. 212 Discount *string `form:"discount"` 213 // ID of the promotion code to create a new discount for. 214 PromotionCode *string `form:"promotion_code"` 215 } 216 217 // The recurring components of a price such as `interval` and `interval_count`. 218 type QuoteLineItemPriceDataRecurringParams struct { 219 // Specifies billing frequency. Either `day`, `week`, `month` or `year`. 220 Interval *string `form:"interval"` 221 // 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). 222 IntervalCount *int64 `form:"interval_count"` 223 } 224 225 // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. 226 type QuoteLineItemPriceDataParams struct { 227 // 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). 228 Currency *string `form:"currency"` 229 // The ID of the product that this price will belong to. 230 Product *string `form:"product"` 231 // The recurring components of a price such as `interval` and `interval_count`. 232 Recurring *QuoteLineItemPriceDataRecurringParams `form:"recurring"` 233 // 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. 234 TaxBehavior *string `form:"tax_behavior"` 235 // A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. 236 UnitAmount *int64 `form:"unit_amount"` 237 // 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. 238 UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` 239 } 240 241 // A list of line items the customer is being quoted for. Each line item includes information about the product, the quantity, and the resulting cost. 242 type QuoteLineItemParams struct { 243 // The discounts applied to this line item. 244 Discounts []*QuoteLineItemDiscountParams `form:"discounts"` 245 // The ID of an existing line item on the quote. 246 ID *string `form:"id"` 247 // The ID of the price object. One of `price` or `price_data` is required. 248 Price *string `form:"price"` 249 // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. One of `price` or `price_data` is required. 250 PriceData *QuoteLineItemPriceDataParams `form:"price_data"` 251 // The quantity of the line item. 252 Quantity *int64 `form:"quantity"` 253 // The tax rates which apply to the line item. When set, the `default_tax_rates` on the quote do not apply to this line item. 254 TaxRates []*string `form:"tax_rates"` 255 } 256 257 // When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created. 258 type QuoteSubscriptionDataParams struct { 259 // The subscription's 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. 260 Description *string `form:"description"` 261 // When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. When updating a subscription, the date of which the subscription will be updated using a subscription schedule. The special value `current_period_end` can be provided to update a subscription at the end of its current period. The `effective_date` is ignored if it is in the past when the quote is accepted. 262 EffectiveDate *int64 `form:"effective_date"` 263 EffectiveDateCurrentPeriodEnd *bool `form:"-"` // See custom AppendTo 264 // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values. 265 Metadata map[string]string `form:"metadata"` 266 // Integer representing the number of trial period days before the customer is charged for the first time. 267 TrialPeriodDays *int64 `form:"trial_period_days"` 268 } 269 270 // AddMetadata adds a new key-value pair to the Metadata. 271 func (p *QuoteSubscriptionDataParams) AddMetadata(key string, value string) { 272 if p.Metadata == nil { 273 p.Metadata = make(map[string]string) 274 } 275 276 p.Metadata[key] = value 277 } 278 279 // AppendTo implements custom encoding logic for QuoteSubscriptionDataParams. 280 func (p *QuoteSubscriptionDataParams) AppendTo(body *form.Values, keyParts []string) { 281 if BoolValue(p.EffectiveDateCurrentPeriodEnd) { 282 body.Add(form.FormatKey(append(keyParts, "effective_date")), "current_period_end") 283 } 284 } 285 286 // The data with which to automatically create a Transfer for each of the invoices. 287 type QuoteTransferDataParams struct { 288 // The amount that will be transferred automatically when the invoice is paid. If no amount is set, the full amount is transferred. There cannot be any line items with recurring prices when using this field. 289 Amount *int64 `form:"amount"` 290 // 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. There must be at least 1 line item with a recurring price to use this field. 291 AmountPercent *float64 `form:"amount_percent"` 292 // ID of an existing, connected Stripe account. 293 Destination *string `form:"destination"` 294 } 295 296 // A quote models prices and services for a customer. Default options for header, description, footer, and expires_at can be set in the dashboard via the [quote template](https://dashboard.stripe.com/settings/billing/quote). 297 type QuoteParams struct { 298 Params `form:"*"` 299 // The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. There cannot be any line items with recurring prices when using this field. 300 ApplicationFeeAmount *int64 `form:"application_fee_amount"` 301 // 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. There must be at least 1 line item with a recurring price to use this field. 302 ApplicationFeePercent *float64 `form:"application_fee_percent"` 303 // Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. 304 AutomaticTax *QuoteAutomaticTaxParams `form:"automatic_tax"` 305 // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or at invoice finalization using the default payment method attached to the subscription or 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`. 306 CollectionMethod *string `form:"collection_method"` 307 // The customer for which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed. 308 Customer *string `form:"customer"` 309 // The tax rates that will apply to any line item that does not have `tax_rates` set. 310 DefaultTaxRates []*string `form:"default_tax_rates"` 311 // A description that will be displayed on the quote PDF. If no value is passed, the default description configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. 312 Description *string `form:"description"` 313 // The discounts applied to the quote. You can only set up to one discount. 314 Discounts []*QuoteDiscountParams `form:"discounts"` 315 // Specifies which fields in the response should be expanded. 316 Expand []*string `form:"expand"` 317 // A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. If no value is passed, the default expiration date configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. 318 ExpiresAt *int64 `form:"expires_at"` 319 // A footer that will be displayed on the quote PDF. If no value is passed, the default footer configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. 320 Footer *string `form:"footer"` 321 // Clone an existing quote. The new quote will be created in `status=draft`. When using this parameter, you cannot specify any other parameters except for `expires_at`. 322 FromQuote *QuoteFromQuoteParams `form:"from_quote"` 323 // A header that will be displayed on the quote PDF. If no value is passed, the default header configured in your [quote template settings](https://dashboard.stripe.com/settings/billing/quote) will be used. 324 Header *string `form:"header"` 325 // All invoices will be billed using the specified settings. 326 InvoiceSettings *QuoteInvoiceSettingsParams `form:"invoice_settings"` 327 // A list of line items the customer is being quoted for. Each line item includes information about the product, the quantity, and the resulting cost. 328 LineItems []*QuoteLineItemParams `form:"line_items"` 329 // 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`. 330 Metadata map[string]string `form:"metadata"` 331 // The account on behalf of which to charge. 332 OnBehalfOf *string `form:"on_behalf_of"` 333 // When creating a subscription or subscription schedule, the specified configuration data will be used. There must be at least one line item with a recurring price for a subscription or subscription schedule to be created. A subscription schedule is created if `subscription_data[effective_date]` is present and in the future, otherwise a subscription is created. 334 SubscriptionData *QuoteSubscriptionDataParams `form:"subscription_data"` 335 // ID of the test clock to attach to the quote. 336 TestClock *string `form:"test_clock"` 337 // The data with which to automatically create a Transfer for each of the invoices. 338 TransferData *QuoteTransferDataParams `form:"transfer_data"` 339 } 340 341 // AddExpand appends a new field to expand. 342 func (p *QuoteParams) AddExpand(f string) { 343 p.Expand = append(p.Expand, &f) 344 } 345 346 // AddMetadata adds a new key-value pair to the Metadata. 347 func (p *QuoteParams) AddMetadata(key string, value string) { 348 if p.Metadata == nil { 349 p.Metadata = make(map[string]string) 350 } 351 352 p.Metadata[key] = value 353 } 354 355 // When retrieving a quote, there is an includable [computed.upfront.line_items](https://stripe.com/docs/api/quotes/object#quote_object-computed-upfront-line_items) property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of upfront line items. 356 type QuoteListComputedUpfrontLineItemsParams struct { 357 ListParams `form:"*"` 358 Quote *string `form:"-"` // Included in URL 359 // Specifies which fields in the response should be expanded. 360 Expand []*string `form:"expand"` 361 } 362 363 // AddExpand appends a new field to expand. 364 func (p *QuoteListComputedUpfrontLineItemsParams) AddExpand(f string) { 365 p.Expand = append(p.Expand, &f) 366 } 367 368 // When retrieving a quote, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. 369 type QuoteListLineItemsParams struct { 370 ListParams `form:"*"` 371 Quote *string `form:"-"` // Included in URL 372 // Specifies which fields in the response should be expanded. 373 Expand []*string `form:"expand"` 374 } 375 376 // AddExpand appends a new field to expand. 377 func (p *QuoteListLineItemsParams) AddExpand(f string) { 378 p.Expand = append(p.Expand, &f) 379 } 380 381 // Accepts the specified quote. 382 type QuoteAcceptParams struct { 383 Params `form:"*"` 384 // Specifies which fields in the response should be expanded. 385 Expand []*string `form:"expand"` 386 } 387 388 // AddExpand appends a new field to expand. 389 func (p *QuoteAcceptParams) AddExpand(f string) { 390 p.Expand = append(p.Expand, &f) 391 } 392 393 // Cancels the quote. 394 type QuoteCancelParams struct { 395 Params `form:"*"` 396 // Specifies which fields in the response should be expanded. 397 Expand []*string `form:"expand"` 398 } 399 400 // AddExpand appends a new field to expand. 401 func (p *QuoteCancelParams) AddExpand(f string) { 402 p.Expand = append(p.Expand, &f) 403 } 404 405 // Finalizes the quote. 406 type QuoteFinalizeQuoteParams struct { 407 Params `form:"*"` 408 // Specifies which fields in the response should be expanded. 409 Expand []*string `form:"expand"` 410 // A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. 411 ExpiresAt *int64 `form:"expires_at"` 412 } 413 414 // AddExpand appends a new field to expand. 415 func (p *QuoteFinalizeQuoteParams) AddExpand(f string) { 416 p.Expand = append(p.Expand, &f) 417 } 418 419 // Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf) 420 type QuotePDFParams struct { 421 Params `form:"*"` 422 // Specifies which fields in the response should be expanded. 423 Expand []*string `form:"expand"` 424 } 425 426 // AddExpand appends a new field to expand. 427 func (p *QuotePDFParams) AddExpand(f string) { 428 p.Expand = append(p.Expand, &f) 429 } 430 431 // 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. 432 type QuoteAutomaticTaxLiability struct { 433 // The connected account being referenced when `type` is `account`. 434 Account *Account `json:"account"` 435 // Type of the account referenced. 436 Type QuoteAutomaticTaxLiabilityType `json:"type"` 437 } 438 type QuoteAutomaticTax struct { 439 // Automatically calculate taxes 440 Enabled bool `json:"enabled"` 441 // 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. 442 Liability *QuoteAutomaticTaxLiability `json:"liability"` 443 // The status of the most recent automated tax calculation for this quote. 444 Status QuoteAutomaticTaxStatus `json:"status"` 445 } 446 447 // The aggregated discounts. 448 type QuoteComputedRecurringTotalDetailsBreakdownDiscount struct { 449 // The amount discounted. 450 Amount int64 `json:"amount"` 451 // A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). 452 // It contains information about when the discount began, when it will end, and what it is applied to. 453 // 454 // Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) 455 Discount *Discount `json:"discount"` 456 } 457 458 // The aggregated tax amounts by rate. 459 type QuoteComputedRecurringTotalDetailsBreakdownTax struct { 460 // Amount of tax applied for this rate. 461 Amount int64 `json:"amount"` 462 // 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. 463 // 464 // Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) 465 Rate *TaxRate `json:"rate"` 466 // 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. 467 TaxabilityReason QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason `json:"taxability_reason"` 468 // The amount on which tax is calculated, in cents (or local equivalent). 469 TaxableAmount int64 `json:"taxable_amount"` 470 } 471 type QuoteComputedRecurringTotalDetailsBreakdown struct { 472 // The aggregated discounts. 473 Discounts []*QuoteComputedRecurringTotalDetailsBreakdownDiscount `json:"discounts"` 474 // The aggregated tax amounts by rate. 475 Taxes []*QuoteComputedRecurringTotalDetailsBreakdownTax `json:"taxes"` 476 } 477 type QuoteComputedRecurringTotalDetails struct { 478 // This is the sum of all the discounts. 479 AmountDiscount int64 `json:"amount_discount"` 480 // This is the sum of all the shipping amounts. 481 AmountShipping int64 `json:"amount_shipping"` 482 // This is the sum of all the tax amounts. 483 AmountTax int64 `json:"amount_tax"` 484 Breakdown *QuoteComputedRecurringTotalDetailsBreakdown `json:"breakdown"` 485 } 486 487 // The definitive totals and line items the customer will be charged on a recurring basis. Takes into account the line items with recurring prices and discounts with `duration=forever` coupons only. Defaults to `null` if no inputted line items with recurring prices. 488 type QuoteComputedRecurring struct { 489 // Total before any discounts or taxes are applied. 490 AmountSubtotal int64 `json:"amount_subtotal"` 491 // Total after discounts and taxes are applied. 492 AmountTotal int64 `json:"amount_total"` 493 // The frequency at which a subscription is billed. One of `day`, `week`, `month` or `year`. 494 Interval QuoteComputedRecurringInterval `json:"interval"` 495 // The number of intervals (specified in the `interval` attribute) between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. 496 IntervalCount int64 `json:"interval_count"` 497 TotalDetails *QuoteComputedRecurringTotalDetails `json:"total_details"` 498 } 499 500 // The aggregated discounts. 501 type QuoteComputedUpfrontTotalDetailsBreakdownDiscount struct { 502 // The amount discounted. 503 Amount int64 `json:"amount"` 504 // A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). 505 // It contains information about when the discount began, when it will end, and what it is applied to. 506 // 507 // Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) 508 Discount *Discount `json:"discount"` 509 } 510 511 // The aggregated tax amounts by rate. 512 type QuoteComputedUpfrontTotalDetailsBreakdownTax struct { 513 // Amount of tax applied for this rate. 514 Amount int64 `json:"amount"` 515 // 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. 516 // 517 // Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) 518 Rate *TaxRate `json:"rate"` 519 // 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. 520 TaxabilityReason QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason `json:"taxability_reason"` 521 // The amount on which tax is calculated, in cents (or local equivalent). 522 TaxableAmount int64 `json:"taxable_amount"` 523 } 524 type QuoteComputedUpfrontTotalDetailsBreakdown struct { 525 // The aggregated discounts. 526 Discounts []*QuoteComputedUpfrontTotalDetailsBreakdownDiscount `json:"discounts"` 527 // The aggregated tax amounts by rate. 528 Taxes []*QuoteComputedUpfrontTotalDetailsBreakdownTax `json:"taxes"` 529 } 530 type QuoteComputedUpfrontTotalDetails struct { 531 // This is the sum of all the discounts. 532 AmountDiscount int64 `json:"amount_discount"` 533 // This is the sum of all the shipping amounts. 534 AmountShipping int64 `json:"amount_shipping"` 535 // This is the sum of all the tax amounts. 536 AmountTax int64 `json:"amount_tax"` 537 Breakdown *QuoteComputedUpfrontTotalDetailsBreakdown `json:"breakdown"` 538 } 539 type QuoteComputedUpfront struct { 540 // Total before any discounts or taxes are applied. 541 AmountSubtotal int64 `json:"amount_subtotal"` 542 // Total after discounts and taxes are applied. 543 AmountTotal int64 `json:"amount_total"` 544 // The line items that will appear on the next invoice after this quote is accepted. This does not include pending invoice items that exist on the customer but may still be included in the next invoice. 545 LineItems *LineItemList `json:"line_items"` 546 TotalDetails *QuoteComputedUpfrontTotalDetails `json:"total_details"` 547 } 548 type QuoteComputed struct { 549 // The definitive totals and line items the customer will be charged on a recurring basis. Takes into account the line items with recurring prices and discounts with `duration=forever` coupons only. Defaults to `null` if no inputted line items with recurring prices. 550 Recurring *QuoteComputedRecurring `json:"recurring"` 551 Upfront *QuoteComputedUpfront `json:"upfront"` 552 } 553 554 // Details of the quote that was cloned. See the [cloning documentation](https://stripe.com/docs/quotes/clone) for more details. 555 type QuoteFromQuote struct { 556 // Whether this quote is a revision of a different quote. 557 IsRevision bool `json:"is_revision"` 558 // The quote that was cloned. 559 Quote *Quote `json:"quote"` 560 } 561 type QuoteInvoiceSettingsIssuer struct { 562 // The connected account being referenced when `type` is `account`. 563 Account *Account `json:"account"` 564 // Type of the account referenced. 565 Type QuoteInvoiceSettingsIssuerType `json:"type"` 566 } 567 type QuoteInvoiceSettings struct { 568 // Number of days within which a customer must pay invoices generated by this quote. This value will be `null` for quotes where `collection_method=charge_automatically`. 569 DaysUntilDue int64 `json:"days_until_due"` 570 Issuer *QuoteInvoiceSettingsIssuer `json:"issuer"` 571 } 572 type QuoteStatusTransitions struct { 573 // The time that the quote was accepted. Measured in seconds since Unix epoch. 574 AcceptedAt int64 `json:"accepted_at"` 575 // The time that the quote was canceled. Measured in seconds since Unix epoch. 576 CanceledAt int64 `json:"canceled_at"` 577 // The time that the quote was finalized. Measured in seconds since Unix epoch. 578 FinalizedAt int64 `json:"finalized_at"` 579 } 580 type QuoteSubscriptionData struct { 581 // The subscription's 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. 582 Description string `json:"description"` 583 // When creating a new subscription, the date of which the subscription schedule will start after the quote is accepted. This date is ignored if it is in the past when the quote is accepted. Measured in seconds since the Unix epoch. 584 EffectiveDate int64 `json:"effective_date"` 585 // Set of [key-value pairs](https://stripe.com/docs/api/metadata) that will set metadata on the subscription or subscription schedule when the quote is accepted. If a recurring price is included in `line_items`, this field will be passed to the resulting subscription's `metadata` field. If `subscription_data.effective_date` is used, this field will be passed to the resulting subscription schedule's `phases.metadata` field. Unlike object-level metadata, this field is declarative. Updates will clear prior values. 586 Metadata map[string]string `json:"metadata"` 587 // Integer representing the number of trial period days before the customer is charged for the first time. 588 TrialPeriodDays int64 `json:"trial_period_days"` 589 } 590 591 // The aggregated discounts. 592 type QuoteTotalDetailsBreakdownDiscount struct { 593 // The amount discounted. 594 Amount int64 `json:"amount"` 595 // A discount represents the actual application of a [coupon](https://stripe.com/docs/api#coupons) or [promotion code](https://stripe.com/docs/api#promotion_codes). 596 // It contains information about when the discount began, when it will end, and what it is applied to. 597 // 598 // Related guide: [Applying discounts to subscriptions](https://stripe.com/docs/billing/subscriptions/discounts) 599 Discount *Discount `json:"discount"` 600 } 601 602 // The aggregated tax amounts by rate. 603 type QuoteTotalDetailsBreakdownTax struct { 604 // Amount of tax applied for this rate. 605 Amount int64 `json:"amount"` 606 // 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. 607 // 608 // Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) 609 Rate *TaxRate `json:"rate"` 610 // 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. 611 TaxabilityReason QuoteTotalDetailsBreakdownTaxTaxabilityReason `json:"taxability_reason"` 612 // The amount on which tax is calculated, in cents (or local equivalent). 613 TaxableAmount int64 `json:"taxable_amount"` 614 } 615 type QuoteTotalDetailsBreakdown struct { 616 // The aggregated discounts. 617 Discounts []*QuoteTotalDetailsBreakdownDiscount `json:"discounts"` 618 // The aggregated tax amounts by rate. 619 Taxes []*QuoteTotalDetailsBreakdownTax `json:"taxes"` 620 } 621 type QuoteTotalDetails struct { 622 // This is the sum of all the discounts. 623 AmountDiscount int64 `json:"amount_discount"` 624 // This is the sum of all the shipping amounts. 625 AmountShipping int64 `json:"amount_shipping"` 626 // This is the sum of all the tax amounts. 627 AmountTax int64 `json:"amount_tax"` 628 Breakdown *QuoteTotalDetailsBreakdown `json:"breakdown"` 629 } 630 631 // The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. 632 type QuoteTransferData struct { 633 // 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. 634 Amount int64 `json:"amount"` 635 // 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 will be transferred to the destination. 636 AmountPercent float64 `json:"amount_percent"` 637 // The account where funds from the payment will be transferred to upon payment success. 638 Destination *Account `json:"destination"` 639 } 640 641 // A Quote is a way to model prices that you'd like to provide to a customer. 642 // Once accepted, it will automatically create an invoice, subscription or subscription schedule. 643 type Quote struct { 644 APIResource 645 // Total before any discounts or taxes are applied. 646 AmountSubtotal int64 `json:"amount_subtotal"` 647 // Total after discounts and taxes are applied. 648 AmountTotal int64 `json:"amount_total"` 649 // ID of the Connect Application that created the quote. 650 Application *Application `json:"application"` 651 // The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner's Stripe account. Only applicable if there are no line items with recurring prices on the quote. 652 ApplicationFeeAmount int64 `json:"application_fee_amount"` 653 // 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. Only applicable if there are line items with recurring prices on the quote. 654 ApplicationFeePercent float64 `json:"application_fee_percent"` 655 AutomaticTax *QuoteAutomaticTax `json:"automatic_tax"` 656 // Either `charge_automatically`, or `send_invoice`. When charging automatically, Stripe will attempt to pay invoices at the end of the subscription cycle or on finalization using the default payment method attached to the subscription or 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`. 657 CollectionMethod QuoteCollectionMethod `json:"collection_method"` 658 Computed *QuoteComputed `json:"computed"` 659 // Time at which the object was created. Measured in seconds since the Unix epoch. 660 Created int64 `json:"created"` 661 // 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). 662 Currency Currency `json:"currency"` 663 // The customer which this quote belongs to. A customer is required before finalizing the quote. Once specified, it cannot be changed. 664 Customer *Customer `json:"customer"` 665 // The tax rates applied to this quote. 666 DefaultTaxRates []*TaxRate `json:"default_tax_rates"` 667 // A description that will be displayed on the quote PDF. 668 Description string `json:"description"` 669 // The discounts applied to this quote. 670 Discounts []*Discount `json:"discounts"` 671 // The date on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. 672 ExpiresAt int64 `json:"expires_at"` 673 // A footer that will be displayed on the quote PDF. 674 Footer string `json:"footer"` 675 // Details of the quote that was cloned. See the [cloning documentation](https://stripe.com/docs/quotes/clone) for more details. 676 FromQuote *QuoteFromQuote `json:"from_quote"` 677 // A header that will be displayed on the quote PDF. 678 Header string `json:"header"` 679 // Unique identifier for the object. 680 ID string `json:"id"` 681 // The invoice that was created from this quote. 682 Invoice *Invoice `json:"invoice"` 683 InvoiceSettings *QuoteInvoiceSettings `json:"invoice_settings"` 684 // A list of items the customer is being quoted for. 685 LineItems *LineItemList `json:"line_items"` 686 // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. 687 Livemode bool `json:"livemode"` 688 // 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. 689 Metadata map[string]string `json:"metadata"` 690 // A unique number that identifies this particular quote. This number is assigned once the quote is [finalized](https://stripe.com/docs/quotes/overview#finalize). 691 Number string `json:"number"` 692 // String representing the object's type. Objects of the same type share the same value. 693 Object string `json:"object"` 694 // The account on behalf of which to charge. See the [Connect documentation](https://support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details. 695 OnBehalfOf *Account `json:"on_behalf_of"` 696 // The status of the quote. 697 Status QuoteStatus `json:"status"` 698 StatusTransitions *QuoteStatusTransitions `json:"status_transitions"` 699 // The subscription that was created or updated from this quote. 700 Subscription *Subscription `json:"subscription"` 701 SubscriptionData *QuoteSubscriptionData `json:"subscription_data"` 702 // The subscription schedule that was created or updated from this quote. 703 SubscriptionSchedule *SubscriptionSchedule `json:"subscription_schedule"` 704 // ID of the test clock this quote belongs to. 705 TestClock *TestHelpersTestClock `json:"test_clock"` 706 TotalDetails *QuoteTotalDetails `json:"total_details"` 707 // The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the invoices. 708 TransferData *QuoteTransferData `json:"transfer_data"` 709 } 710 711 // QuoteList is a list of Quotes as retrieved from a list endpoint. 712 type QuoteList struct { 713 APIResource 714 ListMeta 715 Data []*Quote `json:"data"` 716 } 717 718 // UnmarshalJSON handles deserialization of a Quote. 719 // This custom unmarshaling is needed because the resulting 720 // property may be an id or the full struct if it was expanded. 721 func (q *Quote) UnmarshalJSON(data []byte) error { 722 if id, ok := ParseID(data); ok { 723 q.ID = id 724 return nil 725 } 726 727 type quote Quote 728 var v quote 729 if err := json.Unmarshal(data, &v); err != nil { 730 return err 731 } 732 733 *q = Quote(v) 734 return nil 735 }