diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 341fbefcb5..13e06c1ee9 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v655 \ No newline at end of file +v666 \ No newline at end of file diff --git a/account.go b/account.go index ec37ccee0a..bf51f047ca 100644 --- a/account.go +++ b/account.go @@ -691,6 +691,12 @@ type AccountDocumentsParams struct { ProofOfRegistration *AccountDocumentsProofOfRegistrationParams `form:"proof_of_registration"` } +// Settings specific to Bacs Direct Debit payments. +type AccountSettingsBACSDebitPaymentsParams struct { + // The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps display it as the name of the business. To use custom branding, set the Bacs Direct Debit Display Name during or right after creation. Custom branding incurs an additional monthly fee for the platform. If you don't set the display name before requesting Bacs capability, it's automatically set as "Stripe" and the account is onboarded to Stripe branding, which is free. + DisplayName *string `form:"display_name"` +} + // Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. type AccountSettingsBrandingParams struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px. @@ -794,12 +800,10 @@ type AccountSettingsTreasuryParams struct { // Details on the account's acceptance of the Stripe Treasury Services Agreement. TOSAcceptance *AccountSettingsTreasuryTOSAcceptanceParams `form:"tos_acceptance"` } -type AccountSettingsBACSDebitPaymentsParams struct { - DisplayName *string `form:"display_name"` -} // Options for customizing how the account functions within Stripe. type AccountSettingsParams struct { + // Settings specific to Bacs Direct Debit payments. BACSDebitPayments *AccountSettingsBACSDebitPaymentsParams `form:"bacs_debit_payments"` // Settings used to apply the account's branding to email receipts, invoices, Checkout, and other products. Branding *AccountSettingsBrandingParams `form:"branding"` @@ -1162,8 +1166,10 @@ type AccountRequirements struct { PendingVerification []string `json:"pending_verification"` } type AccountSettingsBACSDebitPayments struct { - // The Bacs Direct Debit Display Name for this account. For payments made with Bacs Direct Debit, this will appear on the mandate, and as the statement descriptor. + // The Bacs Direct Debit display name for this account. For payments made with Bacs Direct Debit, this name appears on the mandate as the statement descriptor. Mobile banking apps display it as the name of the business. To use custom branding, set the Bacs Direct Debit Display Name during or right after creation. Custom branding incurs an additional monthly fee for the platform. The fee appears 5 business days after requesting Bacs. If you don't set the display name before requesting Bacs capability, it's automatically set as "Stripe" and the account is onboarded to Stripe branding, which is free. DisplayName string `json:"display_name"` + // The Bacs Direct Debit Service user number for this account. For payments made with Bacs Direct Debit, this number is a unique identifier of the account with our banking partners. + ServiceUserNumber string `json:"service_user_number"` } type AccountSettingsBranding struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) An icon for the account. Must be square and at least 128px x 128px. diff --git a/charge.go b/charge.go index b7e434f27e..a1005f7be8 100644 --- a/charge.go +++ b/charge.go @@ -745,6 +745,8 @@ type ChargePaymentMethodDetailsCard struct { AmountAuthorized int64 `json:"amount_authorized"` // Card brand. Can be `amex`, `diners`, `discover`, `eftpos_au`, `jcb`, `mastercard`, `unionpay`, `visa`, or `unknown`. Brand PaymentMethodCardBrand `json:"brand"` + // When using manual capture, a future timestamp at which the charge will be automatically refunded if uncaptured. + CaptureBefore int64 `json:"capture_before"` // Check results by Card networks on Card address and CVC at time of payment. Checks *ChargePaymentMethodDetailsCardChecks `json:"checks"` // Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected. diff --git a/checkout_session.go b/checkout_session.go index bc2f2f0873..c2fb679c63 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -542,6 +542,27 @@ const ( CheckoutSessionPaymentMethodOptionsPayNowSetupFutureUsageNone CheckoutSessionPaymentMethodOptionsPayNowSetupFutureUsage = "none" ) +// Controls when the funds will be captured from the customer's account. +type CheckoutSessionPaymentMethodOptionsPaypalCaptureMethod string + +// List of values that CheckoutSessionPaymentMethodOptionsPaypalCaptureMethod can take +const ( + CheckoutSessionPaymentMethodOptionsPaypalCaptureMethodManual CheckoutSessionPaymentMethodOptionsPaypalCaptureMethod = "manual" +) + +// Indicates that you intend to make future payments with this PaymentIntent's payment method. +// +// Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. +// +// When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). +type CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage string + +// List of values that CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage can take +const ( + CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsageNone CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage = "none" + CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsageOffSession CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage = "off_session" +) + // Indicates that you intend to make future payments with this PaymentIntent's payment method. // // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. @@ -2292,6 +2313,20 @@ type CheckoutSessionPaymentMethodOptionsPayNow struct { // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). SetupFutureUsage CheckoutSessionPaymentMethodOptionsPayNowSetupFutureUsage `json:"setup_future_usage"` } +type CheckoutSessionPaymentMethodOptionsPaypal struct { + // Controls when the funds will be captured from the customer's account. + CaptureMethod CheckoutSessionPaymentMethodOptionsPaypalCaptureMethod `json:"capture_method"` + // Preferred locale of the PayPal checkout page that the customer is redirected to. + PreferredLocale string `json:"preferred_locale"` + // A reference of the PayPal transaction visible to customer which is mapped to PayPal's invoice ID. This must be a globally unique ID if you have configured in your PayPal settings to block multiple payments per invoice ID. + Reference string `json:"reference"` + // Indicates that you intend to make future payments with this PaymentIntent's payment method. + // + // Providing this parameter will [attach the payment method](https://stripe.com/docs/payments/save-during-payment) to the PaymentIntent's Customer, if present, after the PaymentIntent is confirmed and any required actions from the user are complete. If no Customer was provided, the payment method can still be [attached](https://stripe.com/docs/api/payment_methods/attach) to a Customer after the transaction completes. + // + // When processing card payments, Stripe also uses `setup_future_usage` to dynamically optimize your payment flow and comply with regional legislation and network rules, such as [SCA](https://stripe.com/docs/strong-customer-authentication). + SetupFutureUsage CheckoutSessionPaymentMethodOptionsPaypalSetupFutureUsage `json:"setup_future_usage"` +} type CheckoutSessionPaymentMethodOptionsPix struct { // The number of seconds after which Pix payment will expire. ExpiresAfterSeconds int64 `json:"expires_after_seconds"` @@ -2357,6 +2392,7 @@ type CheckoutSessionPaymentMethodOptions struct { OXXO *CheckoutSessionPaymentMethodOptionsOXXO `json:"oxxo"` P24 *CheckoutSessionPaymentMethodOptionsP24 `json:"p24"` PayNow *CheckoutSessionPaymentMethodOptionsPayNow `json:"paynow"` + Paypal *CheckoutSessionPaymentMethodOptionsPaypal `json:"paypal"` Pix *CheckoutSessionPaymentMethodOptionsPix `json:"pix"` RevolutPay *CheckoutSessionPaymentMethodOptionsRevolutPay `json:"revolut_pay"` SEPADebit *CheckoutSessionPaymentMethodOptionsSEPADebit `json:"sepa_debit"` diff --git a/client/api.go b/client/api.go index 93a2368a75..c94d3e33c6 100644 --- a/client/api.go +++ b/client/api.go @@ -43,6 +43,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" @@ -191,6 +192,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. @@ -394,6 +397,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/creditnote.go b/creditnote.go index 68f9db2dd4..e1a9e96854 100644 --- a/creditnote.go +++ b/creditnote.go @@ -81,6 +81,16 @@ const ( CreditNoteTypePrePayment CreditNoteType = "pre_payment" ) +// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. +type CreditNoteLineTaxAmountParams 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"` + // The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe. + TaxRate *string `form:"tax_rate"` +} + // Line items that make up the credit note. type CreditNoteLineParams struct { // The line item amount to credit. Only valid when `type` is `invoice_line_item`. @@ -91,7 +101,9 @@ type CreditNoteLineParams struct { InvoiceLineItem *string `form:"invoice_line_item"` // The line item quantity to credit. Quantity *int64 `form:"quantity"` - // The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item`. + // A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. + TaxAmounts []*CreditNoteLineTaxAmountParams `form:"tax_amounts"` + // The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`. TaxRates []*string `form:"tax_rates"` // Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` Type *string `form:"type"` @@ -179,6 +191,16 @@ func (p *CreditNoteListParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) } +// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. +type CreditNotePreviewLineTaxAmountParams 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"` + // The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe. + TaxRate *string `form:"tax_rate"` +} + // Line items that make up the credit note. type CreditNotePreviewLineParams struct { // The line item amount to credit. Only valid when `type` is `invoice_line_item`. @@ -189,7 +211,9 @@ type CreditNotePreviewLineParams struct { InvoiceLineItem *string `form:"invoice_line_item"` // The line item quantity to credit. Quantity *int64 `form:"quantity"` - // The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item`. + // A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. + TaxAmounts []*CreditNotePreviewLineTaxAmountParams `form:"tax_amounts"` + // The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`. TaxRates []*string `form:"tax_rates"` // Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` Type *string `form:"type"` @@ -262,6 +286,16 @@ func (p *CreditNoteVoidCreditNoteParams) AddExpand(f string) { p.Expand = append(p.Expand, &f) } +// A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. +type CreditNotePreviewLinesLineTaxAmountParams 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"` + // The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe. + TaxRate *string `form:"tax_rate"` +} + // Line items that make up the credit note. type CreditNotePreviewLinesLineParams struct { // The line item amount to credit. Only valid when `type` is `invoice_line_item`. @@ -272,7 +306,9 @@ type CreditNotePreviewLinesLineParams struct { InvoiceLineItem *string `form:"invoice_line_item"` // The line item quantity to credit. Quantity *int64 `form:"quantity"` - // The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item`. + // A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`. + TaxAmounts []*CreditNotePreviewLinesLineTaxAmountParams `form:"tax_amounts"` + // The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`. TaxRates []*string `form:"tax_rates"` // Type of the credit note line item, one of `invoice_line_item` or `custom_line_item` Type *string `form:"type"` diff --git a/invoicelineitem.go b/invoicelineitem.go index d9a9c53fce..fcc879d097 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_transaction.go b/issuing_transaction.go index 85aea4d386..f81ef01e7b 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -101,6 +101,12 @@ type IssuingTransactionAmountDetails struct { CashbackAmount int64 `json:"cashback_amount"` } +// Details about the transaction, such as processing dates, set by the card network. +type IssuingTransactionNetworkData struct { + // The date the transaction was processed by the card network. This can be different from the date the seller recorded the transaction depending on when the acquirer submits the transaction to the network. + ProcessingDate string `json:"processing_date"` +} + // The legs of the trip. type IssuingTransactionPurchaseDetailsFlightSegment struct { // The three-letter IATA airport code of the flight's destination. @@ -221,6 +227,8 @@ type IssuingTransaction struct { MerchantData *IssuingAuthorizationMerchantData `json:"merchant_data"` // 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. Metadata map[string]string `json:"metadata"` + // Details about the transaction, such as processing dates, set by the card network. + NetworkData *IssuingTransactionNetworkData `json:"network_data"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` // Additional purchase information that is optionally provided by the merchant. diff --git a/price.go b/price.go index 02f6ed7f05..1589fd06ba 100644 --- a/price.go +++ b/price.go @@ -123,7 +123,7 @@ type PriceListRecurringParams struct { UsageType *string `form:"usage_type"` } -// Returns a list of your prices. +// Returns a list of your active prices. For the list of inactive prices, set active to false. type PriceListParams struct { ListParams `form:"*"` // Only return prices that are active or inactive (e.g., pass `false` to list all inactive prices). diff --git a/topup.go b/topup.go index 1ef1da73f8..a318994b1f 100644 --- a/topup.go +++ b/topup.go @@ -108,7 +108,7 @@ type Topup struct { Metadata map[string]string `json:"metadata"` // String representing the object's type. Objects of the same type share the same value. Object string `json:"object"` - // For most Stripe users, the source of every top-up is a bank account. This hash is then the [source object](https://stripe.com/docs/api#source_object) describing that bank account. + // The source field is deprecated. It might not always be present in the API response. Source *PaymentSource `json:"source"` // Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter. StatementDescriptor string `json:"statement_descriptor"`