From c14d20a05c7d726e486ed66e9bc1242e8177cf3a Mon Sep 17 00:00:00 2001 From: "stripe-openapi[bot]" <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:10:44 -0800 Subject: [PATCH] Update generated code (#1814) * Update generated code for v832 * Update generated code for v833 * Update generated code for v835 * Update generated code for v836 * Update generated code for v837 * Update generated code for v838 * Update generated code for v839 * Update generated code for v840 * Update generated code for v840 --------- Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> --- OPENAPI_VERSION | 2 +- account.go | 6 +- applicationfee.go | 6 +- balancetransaction.go | 8 +- billingportal_configuration.go | 4 +- charge.go | 6 +- checkout_session.go | 4 +- client/api.go | 4 + customer.go | 6 +- event.go | 6 +- file.go | 6 +- filelink.go | 6 +- identity_verificationreport.go | 10 ++- identity_verificationsession.go | 12 ++- invoice.go | 14 ++-- invoiceitem.go | 6 +- invoicelineitem.go | 137 ++++++++++++++++++++++++++++++++ invoicelineitem/client.go | 41 ++++++++++ issuing_dispute.go | 4 +- issuing_token.go | 4 +- payout.go | 6 +- radar_valuelist.go | 6 +- radar_valuelistitem.go | 6 +- refund.go | 6 +- reporting_reportrun.go | 6 +- review.go | 6 +- subscription.go | 10 ++- subscriptionitem.go | 2 +- taxrate.go | 2 +- transfer.go | 6 +- treasury_financialaccount.go | 6 +- treasury_outboundpayment.go | 4 + treasury_transaction.go | 6 +- treasury_transactionentry.go | 6 +- 34 files changed, 306 insertions(+), 64 deletions(-) create mode 100644 invoicelineitem/client.go diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 5433dd907d..e3b365910e 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v829 \ No newline at end of file +v840 \ No newline at end of file diff --git a/account.go b/account.go index f7ecad2a54..594d58a4b5 100644 --- a/account.go +++ b/account.go @@ -902,8 +902,10 @@ type AccountTOSAcceptanceParams struct { // Returns a list of accounts connected to your platform via [Connect](https://stripe.com/docs/connect). If you're not a platform, the list is empty. type AccountListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return connected accounts that were created during the given date interval. + Created *int64 `form:"created"` + // Only return connected accounts that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/applicationfee.go b/applicationfee.go index 03eced4f79..6468098523 100644 --- a/applicationfee.go +++ b/applicationfee.go @@ -12,8 +12,10 @@ import "encoding/json" type ApplicationFeeListParams struct { ListParams `form:"*"` // Only return application fees for the charge specified by this charge ID. - Charge *string `form:"charge"` - Created *int64 `form:"created"` + Charge *string `form:"charge"` + // Only return applications fees that were created during the given date interval. + Created *int64 `form:"created"` + // Only return applications fees that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/balancetransaction.go b/balancetransaction.go index 6cd7b51c1e..aa95c7e04e 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -128,8 +128,10 @@ const ( // // Note that this endpoint was previously called “Balance history” and used the path /v1/balance/history. type BalanceTransactionListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return transactions that were created during the given date interval. + Created *int64 `form:"created"` + // Only return transactions that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Only return transactions in a certain currency. 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). Currency *string `form:"currency"` @@ -172,7 +174,7 @@ type BalanceTransactionFeeDetail struct { Currency Currency `json:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description string `json:"description"` - // Type of the fee, one of: `application_fee`, `stripe_fee` or `tax`. + // Type of the fee, one of: `application_fee`, `payment_method_passthrough_fee`, `stripe_fee` or `tax`. Type string `json:"type"` } diff --git a/billingportal_configuration.go b/billingportal_configuration.go index b74bd56a59..513436e835 100644 --- a/billingportal_configuration.go +++ b/billingportal_configuration.go @@ -65,7 +65,7 @@ const ( BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdateQuantity BillingPortalConfigurationFeaturesSubscriptionUpdateDefaultAllowedUpdate = "quantity" ) -// Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. +// Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. Defaults to a value of `none` if you don't set it during creation. type BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior string // List of values that BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior can take @@ -280,7 +280,7 @@ type BillingPortalConfigurationFeaturesSubscriptionUpdate struct { Enabled bool `json:"enabled"` // The list of up to 10 products that support subscription updates. Products []*BillingPortalConfigurationFeaturesSubscriptionUpdateProduct `json:"products"` - // Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. + // Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. Defaults to a value of `none` if you don't set it during creation. ProrationBehavior BillingPortalConfigurationFeaturesSubscriptionUpdateProrationBehavior `json:"proration_behavior"` } type BillingPortalConfigurationFeatures struct { diff --git a/charge.go b/charge.go index 70accc89b4..7441eccec3 100644 --- a/charge.go +++ b/charge.go @@ -303,8 +303,10 @@ const ( // Returns a list of charges you've previously created. The charges are returned in sorted order, with the most recent charges appearing first. type ChargeListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return charges that were created during the given date interval. + Created *int64 `form:"created"` + // Only return charges that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Only return charges for the customer specified by this customer ID. Customer *string `form:"customer"` diff --git a/checkout_session.go b/checkout_session.go index c7e12f7b7b..54583f0569 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -768,9 +768,9 @@ type CheckoutSessionListCustomerDetailsParams struct { // Returns a list of Checkout Sessions. type CheckoutSessionListParams struct { ListParams `form:"*"` - // Only return the Checkout Sessions that were created during the given date interval. + // Only return Checkout Sessions that were created during the given date interval. Created *int64 `form:"created"` - // Only return the Checkout Sessions that were created during the given date interval. + // Only return Checkout Sessions that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Only return the Checkout Sessions for the Customer specified. Customer *string `form:"customer"` diff --git a/client/api.go b/client/api.go index ca461c743b..29472e2f99 100644 --- a/client/api.go +++ b/client/api.go @@ -48,6 +48,7 @@ import ( identityverificationsession "github.com/stripe/stripe-go/v76/identity/verificationsession" "github.com/stripe/stripe-go/v76/invoice" "github.com/stripe/stripe-go/v76/invoiceitem" + "github.com/stripe/stripe-go/v76/invoicelineitem" issuingauthorization "github.com/stripe/stripe-go/v76/issuing/authorization" issuingcard "github.com/stripe/stripe-go/v76/issuing/card" issuingcardholder "github.com/stripe/stripe-go/v76/issuing/cardholder" @@ -206,6 +207,8 @@ type API struct { IdentityVerificationSessions *identityverificationsession.Client // InvoiceItems is the client used to invoke /invoiceitems APIs. InvoiceItems *invoiceitem.Client + // InvoiceLineItems is the client used to invoke /invoices/{invoice}/lines APIs. + InvoiceLineItems *invoicelineitem.Client // Invoices is the client used to invoke /invoices APIs. Invoices *invoice.Client // IssuingAuthorizations is the client used to invoke /issuing/authorizations APIs. @@ -414,6 +417,7 @@ func (a *API) Init(key string, backends *stripe.Backends) { a.IdentityVerificationReports = &identityverificationreport.Client{B: backends.API, Key: key} a.IdentityVerificationSessions = &identityverificationsession.Client{B: backends.API, Key: key} a.InvoiceItems = &invoiceitem.Client{B: backends.API, Key: key} + a.InvoiceLineItems = &invoicelineitem.Client{B: backends.API, Key: key} a.Invoices = &invoice.Client{B: backends.API, Key: key} a.IssuingAuthorizations = &issuingauthorization.Client{B: backends.API, Key: key} a.IssuingCardholders = &issuingcardholder.Client{B: backends.API, Key: key} diff --git a/customer.go b/customer.go index 5de0690aa8..1fb3be8062 100644 --- a/customer.go +++ b/customer.go @@ -172,8 +172,10 @@ type CustomerDeleteDiscountParams struct { // Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first. type CustomerListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return customers that were created during the given date interval. + Created *int64 `form:"created"` + // Only return customers that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // A case-sensitive filter on the list based on the customer's `email` field. The value must be a string. Email *string `form:"email"` diff --git a/event.go b/event.go index 12fcae5ff4..39526b37b2 100644 --- a/event.go +++ b/event.go @@ -255,8 +255,10 @@ const ( // List events, going back up to 30 days. Each event data is rendered according to Stripe API version at its creation time, specified in [event object](https://stripe.com/docs/api/events/object) api_version attribute (not according to your current Stripe API version or Stripe-Version header). type EventListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return events that were created during the given date interval. + Created *int64 `form:"created"` + // Only return events that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Filter events by whether all webhooks were successfully delivered. If false, events which are still pending or have failed all delivery attempts to a webhook endpoint will be returned. DeliverySuccess *bool `form:"delivery_success"` diff --git a/file.go b/file.go index 2d588809d9..2e7efd5818 100644 --- a/file.go +++ b/file.go @@ -40,8 +40,10 @@ const ( // Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top. type FileListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return files that were created during the given date interval. + Created *int64 `form:"created"` + // Only return files that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/filelink.go b/filelink.go index 878560bfb4..7aa5740af8 100644 --- a/filelink.go +++ b/filelink.go @@ -10,8 +10,10 @@ import "github.com/stripe/stripe-go/v76/form" // Returns a list of file links. type FileLinkListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return links that were created during the given date interval. + Created *int64 `form:"created"` + // Only return links that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/identity_verificationreport.go b/identity_verificationreport.go index a6a3b3d4d6..e0f1986a68 100644 --- a/identity_verificationreport.go +++ b/identity_verificationreport.go @@ -107,8 +107,12 @@ const ( // List all verification reports. type IdentityVerificationReportListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. + ClientReferenceID *string `form:"client_reference_id"` + // Only return VerificationReports that were created during the given date interval. + Created *int64 `form:"created"` + // Only return VerificationReports that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` @@ -285,6 +289,8 @@ type IdentityVerificationReportSelfie struct { // Related guides: [Accessing verification results](https://stripe.com/docs/identity/verification-sessions#results). type IdentityVerificationReport struct { APIResource + // A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. + ClientReferenceID string `json:"client_reference_id"` // Time at which the object was created. Measured in seconds since the Unix epoch. Created int64 `json:"created"` // Result from a document check diff --git a/identity_verificationsession.go b/identity_verificationsession.go index 322f565eb7..2cb5140351 100644 --- a/identity_verificationsession.go +++ b/identity_verificationsession.go @@ -79,8 +79,12 @@ const ( // Returns a list of VerificationSessions type IdentityVerificationSessionListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. + ClientReferenceID *string `form:"client_reference_id"` + // Only return VerificationSessions that were created during the given date interval. + Created *int64 `form:"created"` + // Only return VerificationSessions that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` @@ -120,6 +124,8 @@ type IdentityVerificationSessionOptionsParams struct { // Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents) type IdentityVerificationSessionParams struct { Params `form:"*"` + // A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. + ClientReferenceID *string `form:"client_reference_id"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` // 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`. @@ -260,6 +266,8 @@ type IdentityVerificationSessionVerifiedOutputs struct { // Related guide: [The Verification Sessions API](https://stripe.com/docs/identity/verification-sessions) type IdentityVerificationSession struct { APIResource + // A string to reference this user. This can be a customer ID, a session ID, or similar, and can be used to reconcile this verification with your internal systems. + ClientReferenceID string `json:"client_reference_id"` // The short-lived client secret used by Stripe.js to [show a verification modal](https://stripe.com/docs/js/identity/modal) inside your app. This client secret expires after 24 hours and can only be used once. Don't store it, log it, embed it in a URL, or expose it to anyone other than the user. Make sure that you have TLS enabled on any page that includes the client secret. Refer to our docs on [passing the client secret to the frontend](https://stripe.com/docs/identity/verification-sessions#client-secret) to learn more. ClientSecret string `json:"client_secret"` // Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/invoice.go b/invoice.go index cf73e7fda5..088bc4a44f 100644 --- a/invoice.go +++ b/invoice.go @@ -286,7 +286,7 @@ type InvoiceParams struct { OnBehalfOf *string `form:"on_behalf_of"` // Configuration settings for the PaymentIntent that is generated when the invoice is finalized. PaymentSettings *InvoicePaymentSettingsParams `form:"payment_settings"` - // How to handle pending invoice items on invoice creation. One of `include` or `exclude`. `include` will include any pending invoice items, and will create an empty draft invoice if no pending invoice items exist. `exclude` will always create an empty invoice draft regardless if there are pending invoice items or not. Defaults to `exclude` if the parameter is omitted. + // How to handle pending invoice items on invoice creation. Defaults to `exclude` if the parameter is omitted. PendingInvoiceItemsBehavior *string `form:"pending_invoice_items_behavior"` // The rendering-related settings that control how the invoice is displayed on customer-facing surfaces such as PDF and Hosted Invoice Page. Rendering *InvoiceRenderingParams `form:"rendering"` @@ -600,9 +600,11 @@ type InvoiceTransferDataParams struct { type InvoiceListParams struct { ListParams `form:"*"` // The collection method of the invoice to retrieve. Either `charge_automatically` or `send_invoice`. - CollectionMethod *string `form:"collection_method"` - Created *int64 `form:"created"` - CreatedRange *RangeQueryParams `form:"created"` + CollectionMethod *string `form:"collection_method"` + // Only return invoices that were created during the given date interval. + Created *int64 `form:"created"` + // Only return invoices that were created during the given date interval. + CreatedRange *RangeQueryParams `form:"created"` // Only return invoices for the customer specified by this customer ID. Customer *string `form:"customer"` DueDate *int64 `form:"due_date"` @@ -793,7 +795,7 @@ type InvoiceUpcomingParams struct { SubscriptionDefaultTaxRates []*string `form:"subscription_default_tax_rates"` // A list of up to 20 subscription items, each with an attached price. SubscriptionItems []*SubscriptionItemsParams `form:"subscription_items"` - // Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#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`. + // 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`. SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"` // 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'. SubscriptionProrationDate *int64 `form:"subscription_proration_date"` @@ -1079,7 +1081,7 @@ type InvoiceUpcomingLinesParams struct { SubscriptionDefaultTaxRates []*string `form:"subscription_default_tax_rates"` // A list of up to 20 subscription items, each with an attached price. SubscriptionItems []*InvoiceUpcomingLinesSubscriptionItemParams `form:"subscription_items"` - // Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#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`. + // 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`. SubscriptionProrationBehavior *string `form:"subscription_proration_behavior"` // 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'. SubscriptionProrationDate *int64 `form:"subscription_proration_date"` diff --git a/invoiceitem.go b/invoiceitem.go index c8a96356cc..0941fb497f 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -97,8 +97,10 @@ type InvoiceItemPriceDataParams struct { // Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first. type InvoiceItemListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return invoice items that were created during the given date interval. + Created *int64 `form:"created"` + // Only return invoice items that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // The identifier of the customer whose invoice items to return. If none is provided, all invoice items will be returned. Customer *string `form:"customer"` diff --git a/invoicelineitem.go b/invoicelineitem.go index 61e0047c15..bbab376800 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -15,6 +15,142 @@ const ( InvoiceLineItemTypeSubscription InvoiceLineItemType = "subscription" ) +// The coupons & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts. +type InvoiceLineItemDiscountParams struct { + // ID of the coupon to create a new discount for. + Coupon *string `form:"coupon"` + // ID of an existing discount on the object (or one of its ancestors) to reuse. + Discount *string `form:"discount"` +} + +// 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. +type InvoiceLineItemPeriodParams struct { + // The end of the period, which must be greater than or equal to the start. This value is inclusive. + End *int64 `form:"end"` + // The start of the period. This value is inclusive. + Start *int64 `form:"start"` +} + +// Data used to generate a new product object inline. One of `product` or `product_data` is required. +type InvoiceLineItemPriceDataProductDataParams struct { + // 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. + Description *string `form:"description"` + // A list of up to 8 URLs of images for this product, meant to be displayable to the customer. + Images []*string `form:"images"` + // 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`. + Metadata map[string]string `form:"metadata"` + // The product's name, meant to be displayable to the customer. + Name *string `form:"name"` + // A [tax code](https://stripe.com/docs/tax/tax-categories) ID. + TaxCode *string `form:"tax_code"` +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceLineItemPriceDataProductDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + +// Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. +type InvoiceLineItemPriceDataParams struct { + // 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). + Currency *string `form:"currency"` + // The ID of the product that this price will belong to. One of `product` or `product_data` is required. + Product *string `form:"product"` + // Data used to generate a new product object inline. One of `product` or `product_data` is required. + ProductData *InvoiceLineItemPriceDataProductDataParams `form:"product_data"` + // 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. + TaxBehavior *string `form:"tax_behavior"` + // A non-negative integer in cents (or local equivalent) representing how much to charge. One of `unit_amount` or `unit_amount_decimal` is required. + UnitAmount *int64 `form:"unit_amount"` + // 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. + UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` +} + +// Data to find or create a TaxRate object. +// +// 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. +type InvoiceLineItemTaxAmountTaxRateDataParams struct { + // Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)). + Country *string `form:"country"` + // An arbitrary string attached to the tax rate for your internal use only. It will not be visible to your customers. + Description *string `form:"description"` + // The display name of the tax rate, which will be shown to users. + DisplayName *string `form:"display_name"` + // This specifies if the tax rate is inclusive or exclusive. + Inclusive *bool `form:"inclusive"` + // The jurisdiction for the tax rate. You can use this label field for tax reporting purposes. It also appears on your customer's invoice. + Jurisdiction *string `form:"jurisdiction"` + // 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. + Percentage *float64 `form:"percentage"` + // [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. + State *string `form:"state"` + // The high-level tax type, such as `vat` or `sales_tax`. + TaxType *string `form:"tax_type"` +} + +// 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. +type InvoiceLineItemTaxAmountParams struct { + // The amount, in cents (or local equivalent), of the tax. + Amount *int64 `form:"amount"` + // The amount on which tax is calculated, in cents (or local equivalent). + TaxableAmount *int64 `form:"taxable_amount"` + // Data to find or create a TaxRate object. + // + // 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. + TaxRateData *InvoiceLineItemTaxAmountTaxRateDataParams `form:"tax_rate_data"` +} + +// Updates an invoice's line item. Some fields, such as tax_amounts, only live on the invoice line item, +// so they can only be updated through this endpoint. Other fields, such as amount, live on both the invoice +// item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. +// Updating an invoice's line item is only possible before the invoice is finalized. +type InvoiceLineItemParams struct { + Params `form:"*"` + Invoice *string `form:"-"` // Included in URL + // 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. + Amount *int64 `form:"amount"` + // An arbitrary string which you can attach to the invoice item. The description is displayed in the invoice for easy tracking. + Description *string `form:"description"` + // 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. + Discountable *bool `form:"discountable"` + // The coupons & existing discounts which apply to the line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts. + Discounts []*InvoiceLineItemDiscountParams `form:"discounts"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + // 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`. + Metadata map[string]string `form:"metadata"` + // 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. + Period *InvoiceLineItemPeriodParams `form:"period"` + // The ID of the price object. + Price *string `form:"price"` + // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. + PriceData *InvoiceLineItemPriceDataParams `form:"price_data"` + // Non-negative integer. The quantity of units for the line item. + Quantity *int64 `form:"quantity"` + // 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. + TaxAmounts []*InvoiceLineItemTaxAmountParams `form:"tax_amounts"` + // 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. + TaxRates []*string `form:"tax_rates"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceLineItemParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceLineItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The amount of discount calculated per discount for this line item. type InvoiceLineItemDiscountAmount struct { // The amount, in cents (or local equivalent), of the discount. @@ -37,6 +173,7 @@ type InvoiceLineItemProrationDetails struct { CreditedItems *InvoiceLineItemProrationDetailsCreditedItems `json:"credited_items"` } type InvoiceLineItem struct { + APIResource // The amount, in cents (or local equivalent). Amount int64 `json:"amount"` // The integer amount in cents (or local equivalent) representing the amount for this line item, excluding all tax and discounts. diff --git a/invoicelineitem/client.go b/invoicelineitem/client.go new file mode 100644 index 0000000000..4874ab38e0 --- /dev/null +++ b/invoicelineitem/client.go @@ -0,0 +1,41 @@ +// +// +// File generated from our OpenAPI spec +// +// + +// Package invoicelineitem provides the /invoices/{invoice}/lines APIs +package invoicelineitem + +import ( + "net/http" + + stripe "github.com/stripe/stripe-go/v76" +) + +// Client is used to invoke /invoices/{invoice}/lines APIs. +type Client struct { + B stripe.Backend + Key string +} + +// Update updates an invoice line item's properties. +func Update(id string, params *stripe.InvoiceLineItemParams) (*stripe.InvoiceLineItem, error) { + return getC().Update(id, params) +} + +// Update updates an invoice line item's properties. +func (c Client) Update(id string, params *stripe.InvoiceLineItemParams) (*stripe.InvoiceLineItem, error) { + path := stripe.FormatURLPath( + "/v1/invoices/%s/lines/%s", + stripe.StringValue(params.Invoice), + id, + ) + invoicelineitem := &stripe.InvoiceLineItem{} + err := c.B.Call(http.MethodPost, path, c.Key, params, invoicelineitem) + return invoicelineitem, err +} + +func getC() Client { + return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} +} diff --git a/issuing_dispute.go b/issuing_dispute.go index e6af4ec56c..84049a0258 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -82,9 +82,9 @@ const ( // Returns a list of Issuing Dispute objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. type IssuingDisputeListParams struct { ListParams `form:"*"` - // Select Issuing disputes that were created during the given date interval. + // Only return Issuing disputes that were created during the given date interval. Created *int64 `form:"created"` - // Select Issuing disputes that were created during the given date interval. + // Only return Issuing disputes that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/issuing_token.go b/issuing_token.go index 3eda78f6fa..51f4644559 100644 --- a/issuing_token.go +++ b/issuing_token.go @@ -118,9 +118,9 @@ type IssuingTokenListParams struct { ListParams `form:"*"` // The Issuing card identifier to list tokens for. Card *string `form:"card"` - // Select Issuing tokens that were created during the given date interval. + // Only return Issuing tokens that were created during the given date interval. Created *int64 `form:"created"` - // Select Issuing tokens that were created during the given date interval. + // Only return Issuing tokens that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/payout.go b/payout.go index ed1a58eba4..1b54e5671c 100644 --- a/payout.go +++ b/payout.go @@ -93,8 +93,10 @@ type PayoutListParams struct { ListParams `form:"*"` ArrivalDate *int64 `form:"arrival_date"` ArrivalDateRange *RangeQueryParams `form:"arrival_date"` - Created *int64 `form:"created"` - CreatedRange *RangeQueryParams `form:"created"` + // Only return payouts that were created during the given date interval. + Created *int64 `form:"created"` + // Only return payouts that were created during the given date interval. + CreatedRange *RangeQueryParams `form:"created"` // The ID of an external account - only return payouts sent to this external account. Destination *string `form:"destination"` // Specifies which fields in the response should be expanded. diff --git a/radar_valuelist.go b/radar_valuelist.go index 729c5b61c0..e3f232237d 100644 --- a/radar_valuelist.go +++ b/radar_valuelist.go @@ -58,8 +58,10 @@ type RadarValueListListParams struct { // The alias used to reference the value list when writing rules. Alias *string `form:"alias"` // A value contained within a value list - returns all value lists containing this value. - Contains *string `form:"contains"` - Created *int64 `form:"created"` + Contains *string `form:"contains"` + // Only return value lists that were created during the given date interval. + Created *int64 `form:"created"` + // Only return value lists that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/radar_valuelistitem.go b/radar_valuelistitem.go index 640f29a460..9a4a09d1c4 100644 --- a/radar_valuelistitem.go +++ b/radar_valuelistitem.go @@ -24,8 +24,10 @@ func (p *RadarValueListItemParams) AddExpand(f string) { // Returns a list of ValueListItem objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. type RadarValueListItemListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return items that were created during the given date interval. + Created *int64 `form:"created"` + // Only return items that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/refund.go b/refund.go index f7dcbec28e..7639abfb9e 100644 --- a/refund.go +++ b/refund.go @@ -55,8 +55,10 @@ const ( type RefundListParams struct { ListParams `form:"*"` // Only return refunds for the charge specified by this charge ID. - Charge *string `form:"charge"` - Created *int64 `form:"created"` + Charge *string `form:"charge"` + // Only return refunds that were created during the given date interval. + Created *int64 `form:"created"` + // Only return refunds that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/reporting_reportrun.go b/reporting_reportrun.go index 8ac0bdfd38..7df5ad998f 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -21,8 +21,10 @@ const ( // Returns a list of Report Runs, with the most recent appearing first. type ReportingReportRunListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return Report Runs that were created during the given date interval. + Created *int64 `form:"created"` + // Only return Report Runs that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/review.go b/review.go index 1df533c42c..0bfa222645 100644 --- a/review.go +++ b/review.go @@ -45,8 +45,10 @@ const ( // Returns a list of Review objects that have open set to true. The objects are sorted in descending order by creation date, with the most recently created object appearing first. type ReviewListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return reviews that were created during the given date interval. + Created *int64 `form:"created"` + // Only return reviews that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/subscription.go b/subscription.go index 471db004fd..58ded3b2b3 100644 --- a/subscription.go +++ b/subscription.go @@ -348,7 +348,7 @@ type SubscriptionParams struct { PendingInvoiceItemInterval *SubscriptionPendingInvoiceItemIntervalParams `form:"pending_invoice_item_interval"` // The API ID of a promotion code to apply to this subscription. A promotion code applied to a subscription will only affect invoices created for that particular subscription. PromotionCode *string `form:"promotion_code"` - // Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#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`. + // 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`. ProrationBehavior *string `form:"proration_behavior"` // If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#upcoming_invoice) endpoint. It can also be used to implement custom proration logic, such as prorating by day instead of by second, by providing the time that you wish to use for proration calculations. ProrationDate *int64 `form:"proration_date"` @@ -646,8 +646,10 @@ type SubscriptionListParams struct { // Filter subscriptions by their automatic tax settings. AutomaticTax *SubscriptionListAutomaticTaxParams `form:"automatic_tax"` // The collection method of the subscriptions to retrieve. Either `charge_automatically` or `send_invoice`. - CollectionMethod *string `form:"collection_method"` - Created *int64 `form:"created"` + CollectionMethod *string `form:"collection_method"` + // Only return subscriptions that were created during the given date interval. + Created *int64 `form:"created"` + // Only return subscriptions that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` CurrentPeriodEnd *int64 `form:"current_period_end"` CurrentPeriodEndRange *RangeQueryParams `form:"current_period_end"` @@ -710,7 +712,7 @@ type SubscriptionResumeParams struct { BillingCycleAnchor *string `form:"billing_cycle_anchor"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` - // Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#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`. + // 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`. ProrationBehavior *string `form:"proration_behavior"` // If set, the proration will be calculated as though the subscription was resumed at the given time. This can be used to apply exactly the same proration that was previewed with [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. ProrationDate *int64 `form:"proration_date"` diff --git a/subscriptionitem.go b/subscriptionitem.go index 2b86241ea5..7532229bda 100644 --- a/subscriptionitem.go +++ b/subscriptionitem.go @@ -36,7 +36,7 @@ type SubscriptionItemParams struct { Price *string `form:"price"` // Data used to generate a new [Price](https://stripe.com/docs/api/prices) object inline. PriceData *SubscriptionItemPriceDataParams `form:"price_data"` - // Determines how to handle [prorations](https://stripe.com/docs/subscriptions/billing-cycle#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`. + // 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`. ProrationBehavior *string `form:"proration_behavior"` // If set, the proration will be calculated as though the subscription was updated at the given time. This can be used to apply the same proration that was previewed with the [upcoming invoice](https://stripe.com/docs/api#retrieve_customer_invoice) endpoint. ProrationDate *int64 `form:"proration_date"` diff --git a/taxrate.go b/taxrate.go index e9a9afd1c8..59059c1b31 100644 --- a/taxrate.go +++ b/taxrate.go @@ -37,8 +37,8 @@ const ( TaxRateTaxTypeQST TaxRateTaxType = "qst" TaxRateTaxTypeRST TaxRateTaxType = "rst" TaxRateTaxTypeSalesTax TaxRateTaxType = "sales_tax" - TaxRateTaxTypeServiceTax TaxRateTaxType = "service_tax" TaxRateTaxTypeVAT TaxRateTaxType = "vat" + TaxRateTaxTypeServiceTax TaxRateTaxType = "service_tax" ) // Returns a list of your tax rates. Tax rates are returned sorted by creation date, with the most recently created tax rates appearing first. diff --git a/transfer.go b/transfer.go index b8dc95d1c1..ff81610502 100644 --- a/transfer.go +++ b/transfer.go @@ -20,8 +20,10 @@ const ( // Returns a list of existing transfers sent to connected accounts. The transfers are returned in sorted order, with the most recently created transfers appearing first. type TransferListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return transfers that were created during the given date interval. + Created *int64 `form:"created"` + // Only return transfers that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Only return transfers for the destination specified by this account ID. Destination *string `form:"destination"` diff --git a/treasury_financialaccount.go b/treasury_financialaccount.go index 10e31bee6d..20d870f68b 100644 --- a/treasury_financialaccount.go +++ b/treasury_financialaccount.go @@ -113,8 +113,10 @@ const ( // Returns a list of FinancialAccounts. type TreasuryFinancialAccountListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return FinancialAccounts that were created during the given date interval. + Created *int64 `form:"created"` + // Only return FinancialAccounts that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index b47dbc33e5..ed165804a1 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -82,6 +82,10 @@ const ( // Returns a list of OutboundPayments sent from the specified FinancialAccount. type TreasuryOutboundPaymentListParams struct { ListParams `form:"*"` + // Only return OutboundPayments that were created during the given date interval. + Created *int64 `form:"created"` + // Only return OutboundPayments that were created during the given date interval. + CreatedRange *RangeQueryParams `form:"created"` // Only return OutboundPayments sent to this customer. Customer *string `form:"customer"` // Specifies which fields in the response should be expanded. diff --git a/treasury_transaction.go b/treasury_transaction.go index b11f1036f1..5d913fb2ac 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -60,8 +60,10 @@ type TreasuryTransactionListStatusTransitionsParams struct { // Retrieves a list of Transaction objects. type TreasuryTransactionListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return Transactions that were created during the given date interval. + Created *int64 `form:"created"` + // Only return Transactions that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` // Specifies which fields in the response should be expanded. Expand []*string `form:"expand"` diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index b81159c463..4a45920542 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -67,8 +67,10 @@ const ( // Retrieves a list of TransactionEntry objects. type TreasuryTransactionEntryListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` + ListParams `form:"*"` + // Only return TransactionEntries that were created during the given date interval. + Created *int64 `form:"created"` + // Only return TransactionEntries that were created during the given date interval. CreatedRange *RangeQueryParams `form:"created"` EffectiveAt *int64 `form:"effective_at"` EffectiveAtRange *RangeQueryParams `form:"effective_at"`