diff --git a/account.go b/account.go index c09ef7c5e0..02da6cec87 100644 --- a/account.go +++ b/account.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // The business type. @@ -165,12 +165,16 @@ type AccountParams struct { Documents *AccountDocumentsParams `form:"documents"` // The email address of the account holder. This is only to make the account easier to identify to you. Stripe only emails Custom accounts with your consent. Email *string `form:"email"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A card or bank account to attach to the account for receiving [payouts](https://stripe.com/docs/connect/bank-debit-card-payouts) (you won't be able to use it for top-ups). You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation. // // By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. To add additional external accounts without replacing the existing default for the currency, use the [bank account](https://stripe.com/docs/api#account_create_bank_account) or [card creation](https://stripe.com/docs/api#account_create_card) APIs. ExternalAccount *AccountExternalAccountParams `form:"external_account"` // Information about the person represented by the account. This field is null unless `business_type` is set to `individual`. Individual *PersonParams `form:"individual"` + // 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"` // Options for customizing how the account functions within Stripe. Settings *AccountSettingsParams `form:"settings"` // Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance). @@ -179,6 +183,20 @@ type AccountParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *AccountParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *AccountParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India. type AccountBusinessProfileMonthlyEstimatedRevenueParams struct { // A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). @@ -737,8 +755,8 @@ type AccountSettingsPayoutsScheduleParams struct { } // AppendTo implements custom encoding logic for AccountSettingsPayoutsScheduleParams. -func (a *AccountSettingsPayoutsScheduleParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(a.DelayDaysMinimum) { +func (p *AccountSettingsPayoutsScheduleParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.DelayDaysMinimum) { body.Add(form.FormatKey(append(keyParts, "delay_days")), "minimum") } } @@ -806,6 +824,13 @@ type AccountListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *AccountListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // With [Connect](https://stripe.com/docs/connect), you may flag accounts as suspicious. @@ -813,6 +838,8 @@ type AccountListParams struct { // Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero. type AccountRejectParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`. Reason *string `form:"reason"` } @@ -842,6 +869,11 @@ func (p *AccountExternalAccountParams) AppendTo(body *form.Values, keyParts []st } } +// AddExpand appends a new field to expand. +func (p *AccountRejectParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type AccountBusinessProfileMonthlyEstimatedRevenue struct { // A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). Amount int64 `json:"amount"` diff --git a/account/client.go b/account/client.go index ccaa12ce6e..056d67e227 100644 --- a/account/client.go +++ b/account/client.go @@ -10,8 +10,8 @@ package account import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /accounts APIs. diff --git a/accountlink.go b/accountlink.go index 1c8d9e8f43..1db4067464 100644 --- a/accountlink.go +++ b/accountlink.go @@ -31,6 +31,8 @@ type AccountLinkParams struct { Account *string `form:"account"` // Which information the platform needs to collect from the user. One of `currently_due` or `eventually_due`. Default is `currently_due`. Collect *string `form:"collect"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link's URL so they can continue with Connect Onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user. RefreshURL *string `form:"refresh_url"` // The URL that the user will be redirected to upon leaving or completing the linked flow. @@ -39,6 +41,11 @@ type AccountLinkParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *AccountLinkParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Account Links are the means by which a Connect platform grants a connected account permission to access // Stripe-hosted applications, such as Connect Onboarding. // diff --git a/accountlink/client.go b/accountlink/client.go index c10b193e83..10196371fa 100644 --- a/accountlink/client.go +++ b/accountlink/client.go @@ -10,7 +10,7 @@ package accountlink import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /account_links APIs. diff --git a/applepaydomain.go b/applepaydomain.go index 15af3424ec..e7aff95f41 100644 --- a/applepaydomain.go +++ b/applepaydomain.go @@ -10,13 +10,28 @@ package stripe type ApplePayDomainListParams struct { ListParams `form:"*"` DomainName *string `form:"domain_name"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ApplePayDomainListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Create an apple pay domain. type ApplePayDomainParams struct { Params `form:"*"` DomainName *string `form:"domain_name"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *ApplePayDomainParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type ApplePayDomain struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/applepaydomain/client.go b/applepaydomain/client.go index 5b9fdc6747..bdf021e391 100644 --- a/applepaydomain/client.go +++ b/applepaydomain/client.go @@ -10,8 +10,8 @@ package applepaydomain import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /apple_pay/domains APIs. diff --git a/applicationfee.go b/applicationfee.go index 10f18bef29..03eced4f79 100644 --- a/applicationfee.go +++ b/applicationfee.go @@ -15,12 +15,27 @@ type ApplicationFeeListParams struct { Charge *string `form:"charge"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ApplicationFeeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves the details of an application fee that your account has collected. The same information is returned when refunding the application fee. type ApplicationFeeParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *ApplicationFeeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type ApplicationFee struct { APIResource // ID of the Stripe account this fee was taken from. diff --git a/applicationfee/client.go b/applicationfee/client.go index 6f752ec39d..0c8d67f51c 100644 --- a/applicationfee/client.go +++ b/applicationfee/client.go @@ -10,8 +10,8 @@ package applicationfee import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /application_fees APIs. diff --git a/apps/secret/client.go b/apps/secret/client.go index 74f2d5dcb3..49d6657238 100644 --- a/apps/secret/client.go +++ b/apps/secret/client.go @@ -10,8 +10,8 @@ package secret import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /apps/secrets APIs. diff --git a/apps_secret.go b/apps_secret.go index 3179d42d49..879fc396cc 100644 --- a/apps_secret.go +++ b/apps_secret.go @@ -26,12 +26,19 @@ type AppsSecretFindScopeParams struct { // Finds a secret in the secret store by name and scope. type AppsSecretFindParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A name for the secret that's unique within the scope. Name *string `form:"name"` // Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. Scope *AppsSecretFindScopeParams `form:"scope"` } +// AddExpand appends a new field to expand. +func (p *AppsSecretFindParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. type AppsSecretScopeParams struct { // The secret scope type. @@ -43,6 +50,8 @@ type AppsSecretScopeParams struct { // Create or replace a secret in the secret store. type AppsSecretParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The Unix timestamp for the expiry time of the secret, after which the secret deletes. ExpiresAt *int64 `form:"expires_at"` // A name for the secret that's unique within the scope. @@ -53,6 +62,11 @@ type AppsSecretParams struct { Scope *AppsSecretScopeParams `form:"scope"` } +// AddExpand appends a new field to expand. +func (p *AppsSecretParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. type AppsSecretListScopeParams struct { // The secret scope type. @@ -64,10 +78,17 @@ type AppsSecretListScopeParams struct { // List all secrets stored on the given scope. type AppsSecretListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. Scope *AppsSecretListScopeParams `form:"scope"` } +// AddExpand appends a new field to expand. +func (p *AppsSecretListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. type AppsSecretDeleteWhereScopeParams struct { // The secret scope type. @@ -79,11 +100,19 @@ type AppsSecretDeleteWhereScopeParams struct { // Deletes a secret from the secret store by name and scope. type AppsSecretDeleteWhereParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A name for the secret that's unique within the scope. Name *string `form:"name"` // Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user. Scope *AppsSecretDeleteWhereScopeParams `form:"scope"` } + +// AddExpand appends a new field to expand. +func (p *AppsSecretDeleteWhereParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type AppsSecretScope struct { // The secret scope type. Type AppsSecretScopeType `json:"type"` diff --git a/balance.go b/balance.go index 5f65960a3d..0e75d16458 100644 --- a/balance.go +++ b/balance.go @@ -21,6 +21,13 @@ const ( // For a sample request, see [Accounting for negative balances](https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances). type BalanceParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *BalanceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Funds that are available to be transferred or paid out, whether automatically by Stripe or explicitly via the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). The available balance for each currency and payment type can be found in the `source_types` property. diff --git a/balance/client.go b/balance/client.go index afd6abaf53..863280bf4c 100644 --- a/balance/client.go +++ b/balance/client.go @@ -10,7 +10,7 @@ package balance import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /balance APIs. diff --git a/balancetransaction.go b/balancetransaction.go index 123c05aba9..a747cc6d41 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -121,6 +121,8 @@ type BalanceTransactionListParams struct { 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // For automatic Stripe payouts only, only returns transactions that were paid out on the specified payout ID. Payout *string `form:"payout"` // Only returns the original transaction. @@ -129,11 +131,23 @@ type BalanceTransactionListParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *BalanceTransactionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the balance transaction with the given ID. // // Note that this endpoint previously used the path /v1/balance/history/:id. type BalanceTransactionParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *BalanceTransactionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction. diff --git a/balancetransaction/client.go b/balancetransaction/client.go index 83ee6abe5d..b7278ea99d 100644 --- a/balancetransaction/client.go +++ b/balancetransaction/client.go @@ -10,8 +10,8 @@ package balancetransaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /balance_transactions APIs. diff --git a/bankaccount.go b/bankaccount.go index e84018b6db..aff972a2a4 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" "strconv" ) @@ -216,10 +216,14 @@ type BankAccountParams struct { DefaultForCurrency *bool `form:"default_for_currency"` // Documents that may be submitted to satisfy various informational requests. Documents *BankAccountDocumentsParams `form:"documents"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Two digit number representing the card's expiration month. ExpMonth *string `form:"exp_month"` // Four digit number representing the card's expiration year. ExpYear *string `form:"exp_year"` + // 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"` // Cardholder name. Name *string `form:"name"` // The routing number, sort code, or other country-appropriate institution number for the bank account. For US bank accounts, this is required and should be the ACH routing number, not the wire routing number. If you are providing an IBAN for `account_number`, this field is not required. @@ -240,13 +244,13 @@ type BankAccountParams struct { // This is not a pattern that we want to push forward, and this largely exists // because the bank accounts endpoint is a little unusual. There is one other // resource like it, which is cards. -func (a *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) { +func (p *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) { // Rather than being called in addition to `AppendTo`, this function // *replaces* `AppendTo`, so we must also make sure to handle the encoding // of `Params` so metadata and the like is included in the encoded payload. - form.AppendTo(body, a.Params) + form.AppendTo(body, p.Params) - isCustomer := a.Customer != nil + isCustomer := p.Customer != nil var sourceType string if isCustomer { @@ -256,42 +260,56 @@ func (a *BankAccountParams) AppendToAsSourceOrExternalAccount(body *form.Values) } // Use token (if exists) or a dictionary containing a user’s bank account details. - if a.Token != nil { - body.Add(sourceType, StringValue(a.Token)) + if p.Token != nil { + body.Add(sourceType, StringValue(p.Token)) - if a.DefaultForCurrency != nil { + if p.DefaultForCurrency != nil { body.Add( "default_for_currency", - strconv.FormatBool(BoolValue(a.DefaultForCurrency)), + strconv.FormatBool(BoolValue(p.DefaultForCurrency)), ) } } else { body.Add(sourceType+"[object]", "bank_account") - body.Add(sourceType+"[country]", StringValue(a.Country)) - body.Add(sourceType+"[account_number]", StringValue(a.AccountNumber)) - body.Add(sourceType+"[currency]", StringValue(a.Currency)) + body.Add(sourceType+"[country]", StringValue(p.Country)) + body.Add(sourceType+"[account_number]", StringValue(p.AccountNumber)) + body.Add(sourceType+"[currency]", StringValue(p.Currency)) // These are optional and the API will fail if we try to send empty // values in for them, so make sure to check that they're actually set // before encoding them. - if a.AccountHolderName != nil { - body.Add(sourceType+"[account_holder_name]", StringValue(a.AccountHolderName)) + if p.AccountHolderName != nil { + body.Add(sourceType+"[account_holder_name]", StringValue(p.AccountHolderName)) } - if a.AccountHolderType != nil { - body.Add(sourceType+"[account_holder_type]", StringValue(a.AccountHolderType)) + if p.AccountHolderType != nil { + body.Add(sourceType+"[account_holder_type]", StringValue(p.AccountHolderType)) } - if a.RoutingNumber != nil { - body.Add(sourceType+"[routing_number]", StringValue(a.RoutingNumber)) + if p.RoutingNumber != nil { + body.Add(sourceType+"[routing_number]", StringValue(p.RoutingNumber)) } - if a.DefaultForCurrency != nil { - body.Add(sourceType+"[default_for_currency]", strconv.FormatBool(BoolValue(a.DefaultForCurrency))) + if p.DefaultForCurrency != nil { + body.Add(sourceType+"[default_for_currency]", strconv.FormatBool(BoolValue(p.DefaultForCurrency))) } } } +// AddExpand appends a new field to expand. +func (p *BankAccountParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *BankAccountParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type BankAccountListParams struct { ListParams `form:"*"` // The identifier of the parent account under which the bank accounts are diff --git a/bankaccount/client.go b/bankaccount/client.go index 047a52e7b5..2112088481 100644 --- a/bankaccount/client.go +++ b/bankaccount/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke bankaccount related APIs. diff --git a/billingportal/configuration/client.go b/billingportal/configuration/client.go index 8dda6901ab..2fb875af10 100644 --- a/billingportal/configuration/client.go +++ b/billingportal/configuration/client.go @@ -10,8 +10,8 @@ package configuration import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /billing_portal/configurations APIs. diff --git a/billingportal/session/client.go b/billingportal/session/client.go index 0dd9778818..d7e3105f75 100644 --- a/billingportal/session/client.go +++ b/billingportal/session/client.go @@ -10,7 +10,7 @@ package session import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /billing_portal/sessions APIs. diff --git a/billingportal_configuration.go b/billingportal_configuration.go index 4f015c4f72..2a93c4886a 100644 --- a/billingportal_configuration.go +++ b/billingportal_configuration.go @@ -80,10 +80,17 @@ type BillingPortalConfigurationListParams struct { ListParams `form:"*"` // Only return configurations that are active or inactive (e.g., pass `true` to only list active configurations). Active *bool `form:"active"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return the default or non-default configurations (e.g., pass `true` to only list the default configuration). IsDefault *bool `form:"is_default"` } +// AddExpand appends a new field to expand. +func (p *BillingPortalConfigurationListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The business information shown to customers in the portal. type BillingPortalConfigurationBusinessProfileParams struct { // The messaging shown to customers in the portal. @@ -193,11 +200,30 @@ type BillingPortalConfigurationParams struct { BusinessProfile *BillingPortalConfigurationBusinessProfileParams `form:"business_profile"` // The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session. DefaultReturnURL *string `form:"default_return_url"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Information about the features available in the portal. Features *BillingPortalConfigurationFeaturesParams `form:"features"` // The hosted login page for this configuration. Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share). LoginPage *BillingPortalConfigurationLoginPageParams `form:"login_page"` + // 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"` } + +// AddExpand appends a new field to expand. +func (p *BillingPortalConfigurationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *BillingPortalConfigurationParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type BillingPortalConfigurationBusinessProfile struct { // The messaging shown to customers in the portal. Headline string `json:"headline"` diff --git a/billingportal_session.go b/billingportal_session.go index 976a59bb9f..e3aae66368 100644 --- a/billingportal_session.go +++ b/billingportal_session.go @@ -110,6 +110,8 @@ type BillingPortalSessionParams struct { Configuration *string `form:"configuration"` // The ID of an existing customer. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows. FlowData *BillingPortalSessionFlowDataParams `form:"flow_data"` // The IETF language tag of the locale customer portal is displayed in. If blank or auto, the customer's `preferred_locales` or browser's locale is used. @@ -120,6 +122,11 @@ type BillingPortalSessionParams struct { ReturnURL *string `form:"return_url"` } +// AddExpand appends a new field to expand. +func (p *BillingPortalSessionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Configuration when `after_completion.type=hosted_confirmation`. type BillingPortalSessionFlowAfterCompletionHostedConfirmation struct { // A custom message to display to the customer after the flow is completed. diff --git a/capability.go b/capability.go index d2afbb79ec..dc222f6010 100644 --- a/capability.go +++ b/capability.go @@ -41,16 +41,30 @@ const ( type CapabilityListParams struct { ListParams `form:"*"` Account *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CapabilityListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves information about the specified Account Capability. type CapabilityParams struct { Params `form:"*"` Account *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Passing true requests the capability for the account, if it is not already requested. A requested capability may not immediately become active. Any requirements to activate the capability are returned in the `requirements` arrays. Requested *bool `form:"requested"` } +// AddExpand appends a new field to expand. +func (p *CapabilityParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Fields that are due and can be satisfied by providing the corresponding alternative fields instead. type CapabilityFutureRequirementsAlternative struct { // Fields that can be provided to satisfy all fields in `original_fields_due`. diff --git a/capability/client.go b/capability/client.go index 981d44fe9f..b4b0b9eac1 100644 --- a/capability/client.go +++ b/capability/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /accounts/{account}/capabilities APIs. diff --git a/card.go b/card.go index 7b294668ab..d4150ff5fa 100644 --- a/card.go +++ b/card.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" "strconv" ) @@ -132,10 +132,14 @@ type CardParams struct { CVC *string `form:"cvc"` // Applicable only on accounts (not customers or recipients). If you set this to `true` (or if this is the first external account being added in this currency), this card will become the default external account for its currency. DefaultForCurrency *bool `form:"default_for_currency"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Two digit number representing the card's expiration month. ExpMonth *string `form:"exp_month"` // Four digit number representing the card's expiration year. ExpYear *string `form:"exp_year"` + // 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"` // Cardholder name. Name *string `form:"name"` // The card number, as a string without any separators. @@ -157,99 +161,113 @@ type CardParams struct { // This is not a pattern that we want to push forward, and this largely exists // because the cards endpoint is a little unusual. There is one other resource // like it, which is bank account. -func (c *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, keyParts []string) { +func (p *CardParams) AppendToAsCardSourceOrExternalAccount(body *form.Values, keyParts []string) { // Rather than being called in addition to `AppendTo`, this function // *replaces* `AppendTo`, so we must also make sure to handle the encoding // of `Params` so metadata and the like is included in the encoded payload. - form.AppendToPrefixed(body, c.Params, keyParts) + form.AppendToPrefixed(body, p.Params, keyParts) - if c.DefaultForCurrency != nil { + if p.DefaultForCurrency != nil { body.Add( form.FormatKey(append(keyParts, "default_for_currency")), - strconv.FormatBool(BoolValue(c.DefaultForCurrency)), + strconv.FormatBool(BoolValue(p.DefaultForCurrency)), ) } - if c.Token != nil { - if c.Account != nil { - body.Add(form.FormatKey(append(keyParts, "external_account")), StringValue(c.Token)) + if p.Token != nil { + if p.Account != nil { + body.Add(form.FormatKey(append(keyParts, "external_account")), StringValue(p.Token)) } else { - body.Add(form.FormatKey(append(keyParts, cardSource)), StringValue(c.Token)) + body.Add(form.FormatKey(append(keyParts, cardSource)), StringValue(p.Token)) } } - if c.Number != nil { + if p.Number != nil { body.Add(form.FormatKey(append(keyParts, cardSource, "object")), "card") - body.Add(form.FormatKey(append(keyParts, cardSource, "number")), StringValue(c.Number)) + body.Add(form.FormatKey(append(keyParts, cardSource, "number")), StringValue(p.Number)) } - if c.CVC != nil { + if p.CVC != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "cvc")), - StringValue(c.CVC), + StringValue(p.CVC), ) } - if c.Currency != nil { + if p.Currency != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "currency")), - StringValue(c.Currency), + StringValue(p.Currency), ) } - if c.ExpMonth != nil { + if p.ExpMonth != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "exp_month")), - StringValue(c.ExpMonth), + StringValue(p.ExpMonth), ) } - if c.ExpYear != nil { + if p.ExpYear != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "exp_year")), - StringValue(c.ExpYear), + StringValue(p.ExpYear), ) } - if c.Name != nil { + if p.Name != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "name")), - StringValue(c.Name), + StringValue(p.Name), ) } - if c.AddressCity != nil { + if p.AddressCity != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "address_city")), - StringValue(c.AddressCity), + StringValue(p.AddressCity), ) } - if c.AddressCountry != nil { + if p.AddressCountry != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "address_country")), - StringValue(c.AddressCountry), + StringValue(p.AddressCountry), ) } - if c.AddressLine1 != nil { + if p.AddressLine1 != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "address_line1")), - StringValue(c.AddressLine1), + StringValue(p.AddressLine1), ) } - if c.AddressLine2 != nil { + if p.AddressLine2 != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "address_line2")), - StringValue(c.AddressLine2), + StringValue(p.AddressLine2), ) } - if c.AddressState != nil { + if p.AddressState != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "address_state")), - StringValue(c.AddressState), + StringValue(p.AddressState), ) } - if c.AddressZip != nil { + if p.AddressZip != nil { body.Add( form.FormatKey(append(keyParts, cardSource, "address_zip")), - StringValue(c.AddressZip), + StringValue(p.AddressZip), ) } } +// AddExpand appends a new field to expand. +func (p *CardParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CardParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type CardListParams struct { ListParams `form:"*"` Account *string `form:"-"` // Included in URL diff --git a/card/client.go b/card/client.go index e78aa04d73..0d97df31bb 100644 --- a/card/client.go +++ b/card/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke card related APIs. diff --git a/cashbalance.go b/cashbalance.go index 4bd345597a..c5b15881a7 100644 --- a/cashbalance.go +++ b/cashbalance.go @@ -18,11 +18,18 @@ const ( // Retrieves a customer's cash balance. type CashBalanceParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A hash of settings for this cash balance. Settings *CashBalanceSettingsParams `form:"settings"` Customer *string `form:"-"` // Included in URL } +// AddExpand appends a new field to expand. +func (p *CashBalanceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A hash of settings for this cash balance. type CashBalanceSettingsParams struct { // Controls how funds transferred by the customer are applied to payment intents and invoices. Valid options are `automatic`, `manual`, or `merchant_default`. For more information about these reconciliation modes, see [Reconciliation](https://stripe.com/docs/payments/customer-balance/reconciliation). diff --git a/cashbalance/client.go b/cashbalance/client.go index 81ee13bbc7..fa26598512 100644 --- a/cashbalance/client.go +++ b/cashbalance/client.go @@ -11,7 +11,7 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /customers/{customer}/cash_balance APIs. diff --git a/charge.go b/charge.go index 9e13331068..82095e5cc4 100644 --- a/charge.go +++ b/charge.go @@ -248,10 +248,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type ChargeSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *ChargeSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // 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:"*"` @@ -259,11 +266,19 @@ type ChargeListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return charges for the customer specified by this customer ID. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return charges that were created by the PaymentIntent specified by this PaymentIntent ID. PaymentIntent *string `form:"payment_intent"` // Only return charges for this transfer group. TransferGroup *string `form:"transfer_group"` } + +// AddExpand appends a new field to expand. +func (p *ChargeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type ChargeDestinationParams struct { // ID of an existing, connected Stripe account. Account *string `form:"account"` @@ -318,18 +333,22 @@ type ChargeParams struct { Currency *string `form:"currency"` // The ID of an existing customer that will be associated with this request. This field may only be updated if there is no existing associated customer with this charge. Customer *string `form:"customer"` - // An arbitrary string which you can attach to a charge object. It is displayed when in the web interface alongside the charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the `description` of the charge(s) that they are describing. + // An arbitrary string which you can attach to a `Charge` object. It is displayed when in the web interface alongside the charge. Note that if you use Stripe to send automatic email receipts to your customers, your receipt emails will include the `description` of the charge(s) that they are describing. Description *string `form:"description"` Destination *ChargeDestinationParams `form:"destination"` ExchangeRate *float64 `form:"exchange_rate"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A set of key-value pairs you can attach to a charge giving information about its riskiness. If you believe a charge is fraudulent, include a `user_report` key with a value of `fraudulent`. If you believe a charge is safe, include a `user_report` key with a value of `safe`. Stripe will use the information you send to improve our fraud detection algorithms. FraudDetails *ChargeFraudDetailsParams `form:"fraud_details"` Level3 *ChargeLevel3Params `form:"level3"` + // 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 Stripe account ID for which these funds are intended. Automatically set if you use the `destination` parameter. For details, see [Creating Separate Charges and Transfers](https://stripe.com/docs/connect/separate-charges-and-transfers#on-behalf-of). OnBehalfOf *string `form:"on_behalf_of"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *ChargeRadarOptionsParams `form:"radar_options"` - // This is the email address that the receipt for this charge will be sent to. If this field is updated, then a new email receipt will be sent to the updated address. + // The email address to which this charge's [receipt](https://stripe.com/docs/dashboard/receipts) will be sent. The receipt will not be sent until the charge is paid, and no receipts will be sent for test mode charges. If this charge is for a [Customer](https://stripe.com/docs/api/customers/object), the email address specified here will override the customer's email address. If `receipt_email` is specified for a charge in live mode, a receipt will be sent regardless of your [email settings](https://dashboard.stripe.com/account/emails). ReceiptEmail *string `form:"receipt_email"` // Shipping information for the charge. Helps prevent fraud on charges for physical goods. Shipping *ShippingDetailsParams `form:"shipping"` @@ -352,6 +371,20 @@ func (p *ChargeParams) SetSource(sp interface{}) error { return err } +// AddExpand appends a new field to expand. +func (p *ChargeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *ChargeParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // A set of key-value pairs you can attach to a charge giving information about its riskiness. If you believe a charge is fraudulent, include a `user_report` key with a value of `fraudulent`. If you believe a charge is safe, include a `user_report` key with a value of `safe`. Stripe will use the information you send to improve our fraud detection algorithms. type ChargeFraudDetailsParams struct { // Either `safe` or `fraudulent`. @@ -378,6 +411,8 @@ type ChargeCaptureParams struct { // An application fee amount to add on to this charge, which must be less than or equal to the original amount. ApplicationFeeAmount *int64 `form:"application_fee_amount"` ExchangeRate *float64 `form:"exchange_rate"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The email address to send this charge's receipt to. This will override the previously-specified email address for this charge, if one was set. Receipts will not be sent in test mode. ReceiptEmail *string `form:"receipt_email"` // For card charges, use `statement_descriptor_suffix` instead. Otherwise, you can use this value as the complete description of a charge on your customers' statements. Must contain at least one letter, maximum 22 characters. @@ -389,6 +424,12 @@ type ChargeCaptureParams struct { // A string that identifies this transaction as part of a group. `transfer_group` may only be provided if it has not been set. See the [Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-options) for details. TransferGroup *string `form:"transfer_group"` } + +// AddExpand appends a new field to expand. +func (p *ChargeCaptureParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type ChargeBillingDetails struct { // Billing address. Address *Address `json:"address"` diff --git a/charge/client.go b/charge/client.go index 251551a5f4..5324d65533 100644 --- a/charge/client.go +++ b/charge/client.go @@ -10,8 +10,8 @@ package charge import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /charges APIs. diff --git a/checkout/session/client.go b/checkout/session/client.go index 4d05c23529..f44f384bcf 100644 --- a/checkout/session/client.go +++ b/checkout/session/client.go @@ -10,8 +10,8 @@ package session import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /checkout/sessions APIs. diff --git a/checkout_session.go b/checkout_session.go index fdec2a0c1d..e06c091556 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -618,24 +618,21 @@ type CheckoutSessionShippingCostTaxTaxabilityReason string // List of values that CheckoutSessionShippingCostTaxTaxabilityReason can take const ( - CheckoutSessionShippingCostTaxTaxabilityReasonCustomerExempt CheckoutSessionShippingCostTaxTaxabilityReason = "customer_exempt" - CheckoutSessionShippingCostTaxTaxabilityReasonExcludedTerritory CheckoutSessionShippingCostTaxTaxabilityReason = "excluded_territory" - CheckoutSessionShippingCostTaxTaxabilityReasonJurisdictionUnsupported CheckoutSessionShippingCostTaxTaxabilityReason = "jurisdiction_unsupported" - CheckoutSessionShippingCostTaxTaxabilityReasonNotCollecting CheckoutSessionShippingCostTaxTaxabilityReason = "not_collecting" - CheckoutSessionShippingCostTaxTaxabilityReasonNotSubjectToTax CheckoutSessionShippingCostTaxTaxabilityReason = "not_subject_to_tax" - CheckoutSessionShippingCostTaxTaxabilityReasonNotSupported CheckoutSessionShippingCostTaxTaxabilityReason = "not_supported" - CheckoutSessionShippingCostTaxTaxabilityReasonPortionProductExempt CheckoutSessionShippingCostTaxTaxabilityReason = "portion_product_exempt" - CheckoutSessionShippingCostTaxTaxabilityReasonPortionReducedRated CheckoutSessionShippingCostTaxTaxabilityReason = "portion_reduced_rated" - CheckoutSessionShippingCostTaxTaxabilityReasonPortionStandardRated CheckoutSessionShippingCostTaxTaxabilityReason = "portion_standard_rated" - CheckoutSessionShippingCostTaxTaxabilityReasonProductExempt CheckoutSessionShippingCostTaxTaxabilityReason = "product_exempt" - CheckoutSessionShippingCostTaxTaxabilityReasonProductExemptHoliday CheckoutSessionShippingCostTaxTaxabilityReason = "product_exempt_holiday" - CheckoutSessionShippingCostTaxTaxabilityReasonProportionallyRated CheckoutSessionShippingCostTaxTaxabilityReason = "proportionally_rated" - CheckoutSessionShippingCostTaxTaxabilityReasonReducedRated CheckoutSessionShippingCostTaxTaxabilityReason = "reduced_rated" - CheckoutSessionShippingCostTaxTaxabilityReasonReverseCharge CheckoutSessionShippingCostTaxTaxabilityReason = "reverse_charge" - CheckoutSessionShippingCostTaxTaxabilityReasonStandardRated CheckoutSessionShippingCostTaxTaxabilityReason = "standard_rated" - CheckoutSessionShippingCostTaxTaxabilityReasonTaxableBasisReduced CheckoutSessionShippingCostTaxTaxabilityReason = "taxable_basis_reduced" - CheckoutSessionShippingCostTaxTaxabilityReasonVATExempt CheckoutSessionShippingCostTaxTaxabilityReason = "vat_exempt" - CheckoutSessionShippingCostTaxTaxabilityReasonZeroRated CheckoutSessionShippingCostTaxTaxabilityReason = "zero_rated" + CheckoutSessionShippingCostTaxTaxabilityReasonCustomerExempt CheckoutSessionShippingCostTaxTaxabilityReason = "customer_exempt" + CheckoutSessionShippingCostTaxTaxabilityReasonNotCollecting CheckoutSessionShippingCostTaxTaxabilityReason = "not_collecting" + CheckoutSessionShippingCostTaxTaxabilityReasonNotSubjectToTax CheckoutSessionShippingCostTaxTaxabilityReason = "not_subject_to_tax" + CheckoutSessionShippingCostTaxTaxabilityReasonNotSupported CheckoutSessionShippingCostTaxTaxabilityReason = "not_supported" + CheckoutSessionShippingCostTaxTaxabilityReasonPortionProductExempt CheckoutSessionShippingCostTaxTaxabilityReason = "portion_product_exempt" + CheckoutSessionShippingCostTaxTaxabilityReasonPortionReducedRated CheckoutSessionShippingCostTaxTaxabilityReason = "portion_reduced_rated" + CheckoutSessionShippingCostTaxTaxabilityReasonPortionStandardRated CheckoutSessionShippingCostTaxTaxabilityReason = "portion_standard_rated" + CheckoutSessionShippingCostTaxTaxabilityReasonProductExempt CheckoutSessionShippingCostTaxTaxabilityReason = "product_exempt" + CheckoutSessionShippingCostTaxTaxabilityReasonProductExemptHoliday CheckoutSessionShippingCostTaxTaxabilityReason = "product_exempt_holiday" + CheckoutSessionShippingCostTaxTaxabilityReasonProportionallyRated CheckoutSessionShippingCostTaxTaxabilityReason = "proportionally_rated" + CheckoutSessionShippingCostTaxTaxabilityReasonReducedRated CheckoutSessionShippingCostTaxTaxabilityReason = "reduced_rated" + CheckoutSessionShippingCostTaxTaxabilityReasonReverseCharge CheckoutSessionShippingCostTaxTaxabilityReason = "reverse_charge" + CheckoutSessionShippingCostTaxTaxabilityReasonStandardRated CheckoutSessionShippingCostTaxTaxabilityReason = "standard_rated" + CheckoutSessionShippingCostTaxTaxabilityReasonTaxableBasisReduced CheckoutSessionShippingCostTaxTaxabilityReason = "taxable_basis_reduced" + CheckoutSessionShippingCostTaxTaxabilityReasonZeroRated CheckoutSessionShippingCostTaxTaxabilityReason = "zero_rated" ) // The status of the Checkout Session, one of `open`, `complete`, or `expired`. @@ -667,24 +664,21 @@ type CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason string // List of values that CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason can take const ( - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "excluded_territory" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "jurisdiction_unsupported" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonNotSupported CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonProductExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonReducedRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonStandardRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonVATExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "vat_exempt" - CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonZeroRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonNotSupported CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonProductExempt CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonReducedRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonStandardRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" + CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonZeroRated CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" ) // Only return the Checkout Sessions for the Customer details specified. @@ -700,6 +694,8 @@ type CheckoutSessionListParams struct { Customer *string `form:"customer"` // Only return the Checkout Sessions for the Customer details specified. CustomerDetails *CheckoutSessionListCustomerDetailsParams `form:"customer_details"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return the Checkout Session for the PaymentIntent specified. PaymentIntent *string `form:"payment_intent"` // Only return the Checkout Sessions for the Payment Link specified. @@ -708,6 +704,11 @@ type CheckoutSessionListParams struct { Subscription *string `form:"subscription"` } +// AddExpand appends a new field to expand. +func (p *CheckoutSessionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Configure a Checkout Session that can be used to recover an expired session. type CheckoutSessionAfterExpirationRecoveryParams struct { // Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to `false` @@ -867,6 +868,15 @@ type CheckoutSessionInvoiceCreationInvoiceDataParams struct { RenderingOptions *CheckoutSessionInvoiceCreationInvoiceDataRenderingOptionsParams `form:"rendering_options"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionInvoiceCreationInvoiceDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Generate a post-purchase Invoice for one-time payments. type CheckoutSessionInvoiceCreationParams struct { // Set to `true` to enable invoice creation. @@ -899,6 +909,15 @@ type CheckoutSessionLineItemPriceDataProductDataParams struct { TaxCode *string `form:"tax_code"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionLineItemPriceDataProductDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The recurring components of a price such as `interval` and `interval_count`. type CheckoutSessionLineItemPriceDataRecurringParams struct { // Specifies billing frequency. Either `day`, `week`, `month` or `year`. @@ -1010,6 +1029,15 @@ type CheckoutSessionPaymentIntentDataParams struct { TransferGroup *string `form:"transfer_group"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionPaymentIntentDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Additional fields for Mandate creation type CheckoutSessionPaymentMethodOptionsACSSDebitMandateOptionsParams struct { // A URL for custom mandate text to render during confirmation step. @@ -1454,6 +1482,15 @@ type CheckoutSessionSetupIntentDataParams struct { OnBehalfOf *string `form:"on_behalf_of"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionSetupIntentDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // When set, provides configuration for Checkout to collect a shipping address from a customer. type CheckoutSessionShippingAddressCollectionParams struct { // An array of two-letter ISO country codes representing which countries Checkout should provide as options for @@ -1521,6 +1558,15 @@ type CheckoutSessionShippingOptionShippingRateDataParams struct { Type *string `form:"type"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionShippingOptionShippingRateDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The shipping rate options to apply to this Session. type CheckoutSessionShippingOptionParams struct { // The ID of the Shipping Rate to use for this shipping option. @@ -1582,6 +1628,15 @@ type CheckoutSessionSubscriptionDataParams struct { TrialSettings *CheckoutSessionSubscriptionDataTrialSettingsParams `form:"trial_settings"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionSubscriptionDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Controls tax ID collection settings for the session. type CheckoutSessionTaxIDCollectionParams struct { // Set to true to enable Tax ID collection. @@ -1645,6 +1700,8 @@ type CheckoutSessionParams struct { CustomText *CheckoutSessionCustomTextParams `form:"custom_text"` // The coupon or promotion code to apply to this Session. Currently, only up to one may be specified. Discounts []*CheckoutSessionDiscountParams `form:"discounts"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 30 minutes to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation. ExpiresAt *int64 `form:"expires_at"` // Generate a post-purchase Invoice for one-time payments. @@ -1657,6 +1714,8 @@ type CheckoutSessionParams struct { LineItems []*CheckoutSessionLineItemParams `form:"line_items"` // The IETF language tag of the locale Checkout is displayed in. If blank or `auto`, the browser's locale is used. Locale *string `form:"locale"` + // 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 mode of the Checkout Session. Pass `subscription` if the Checkout Session includes at least one recurring item. Mode *string `form:"mode"` // A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. @@ -1709,10 +1768,31 @@ type CheckoutSessionParams struct { TaxIDCollection *CheckoutSessionTaxIDCollectionParams `form:"tax_id_collection"` } +// AddExpand appends a new field to expand. +func (p *CheckoutSessionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CheckoutSessionParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // When retrieving a Checkout Session, 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. type CheckoutSessionListLineItemsParams struct { ListParams `form:"*"` Session *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CheckoutSessionListLineItemsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // A Session can be expired when it is in one of these statuses: open @@ -1720,6 +1800,13 @@ type CheckoutSessionListLineItemsParams struct { // After it expires, a customer can't complete a Session and customers loading the Session see a message saying the Session is expired. type CheckoutSessionExpireParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CheckoutSessionExpireParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // When set, configuration used to recover the Checkout Session on expiry. diff --git a/client/api.go b/client/api.go index e7e9787e45..20354904fa 100644 --- a/client/api.go +++ b/client/api.go @@ -8,112 +8,112 @@ package client import ( - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/account" - "github.com/stripe/stripe-go/v74/accountlink" - "github.com/stripe/stripe-go/v74/applepaydomain" - "github.com/stripe/stripe-go/v74/applicationfee" - appssecret "github.com/stripe/stripe-go/v74/apps/secret" - "github.com/stripe/stripe-go/v74/balance" - "github.com/stripe/stripe-go/v74/balancetransaction" - "github.com/stripe/stripe-go/v74/bankaccount" - billingportalconfiguration "github.com/stripe/stripe-go/v74/billingportal/configuration" - billingportalsession "github.com/stripe/stripe-go/v74/billingportal/session" - "github.com/stripe/stripe-go/v74/capability" - "github.com/stripe/stripe-go/v74/card" - "github.com/stripe/stripe-go/v74/cashbalance" - "github.com/stripe/stripe-go/v74/charge" - checkoutsession "github.com/stripe/stripe-go/v74/checkout/session" - "github.com/stripe/stripe-go/v74/countryspec" - "github.com/stripe/stripe-go/v74/coupon" - "github.com/stripe/stripe-go/v74/creditnote" - "github.com/stripe/stripe-go/v74/customer" - "github.com/stripe/stripe-go/v74/customerbalancetransaction" - "github.com/stripe/stripe-go/v74/customercashbalancetransaction" - "github.com/stripe/stripe-go/v74/dispute" - "github.com/stripe/stripe-go/v74/ephemeralkey" - "github.com/stripe/stripe-go/v74/event" - "github.com/stripe/stripe-go/v74/feerefund" - "github.com/stripe/stripe-go/v74/file" - "github.com/stripe/stripe-go/v74/filelink" - financialconnectionsaccount "github.com/stripe/stripe-go/v74/financialconnections/account" - financialconnectionssession "github.com/stripe/stripe-go/v74/financialconnections/session" - identityverificationreport "github.com/stripe/stripe-go/v74/identity/verificationreport" - identityverificationsession "github.com/stripe/stripe-go/v74/identity/verificationsession" - "github.com/stripe/stripe-go/v74/invoice" - "github.com/stripe/stripe-go/v74/invoiceitem" - issuingauthorization "github.com/stripe/stripe-go/v74/issuing/authorization" - issuingcard "github.com/stripe/stripe-go/v74/issuing/card" - issuingcardholder "github.com/stripe/stripe-go/v74/issuing/cardholder" - issuingdispute "github.com/stripe/stripe-go/v74/issuing/dispute" - issuingtransaction "github.com/stripe/stripe-go/v74/issuing/transaction" - "github.com/stripe/stripe-go/v74/loginlink" - "github.com/stripe/stripe-go/v74/mandate" - "github.com/stripe/stripe-go/v74/oauth" - "github.com/stripe/stripe-go/v74/paymentintent" - "github.com/stripe/stripe-go/v74/paymentlink" - "github.com/stripe/stripe-go/v74/paymentmethod" - "github.com/stripe/stripe-go/v74/paymentsource" - "github.com/stripe/stripe-go/v74/payout" - "github.com/stripe/stripe-go/v74/person" - "github.com/stripe/stripe-go/v74/plan" - "github.com/stripe/stripe-go/v74/price" - "github.com/stripe/stripe-go/v74/product" - "github.com/stripe/stripe-go/v74/promotioncode" - "github.com/stripe/stripe-go/v74/quote" - radarearlyfraudwarning "github.com/stripe/stripe-go/v74/radar/earlyfraudwarning" - radarvaluelist "github.com/stripe/stripe-go/v74/radar/valuelist" - radarvaluelistitem "github.com/stripe/stripe-go/v74/radar/valuelistitem" - "github.com/stripe/stripe-go/v74/refund" - reportingreportrun "github.com/stripe/stripe-go/v74/reporting/reportrun" - reportingreporttype "github.com/stripe/stripe-go/v74/reporting/reporttype" - "github.com/stripe/stripe-go/v74/review" - "github.com/stripe/stripe-go/v74/setupattempt" - "github.com/stripe/stripe-go/v74/setupintent" - "github.com/stripe/stripe-go/v74/shippingrate" - sigmascheduledqueryrun "github.com/stripe/stripe-go/v74/sigma/scheduledqueryrun" - "github.com/stripe/stripe-go/v74/source" - "github.com/stripe/stripe-go/v74/sourcetransaction" - "github.com/stripe/stripe-go/v74/subscription" - "github.com/stripe/stripe-go/v74/subscriptionitem" - "github.com/stripe/stripe-go/v74/subscriptionschedule" - taxcalculation "github.com/stripe/stripe-go/v74/tax/calculation" - taxsettings "github.com/stripe/stripe-go/v74/tax/settings" - taxtransaction "github.com/stripe/stripe-go/v74/tax/transaction" - "github.com/stripe/stripe-go/v74/taxcode" - "github.com/stripe/stripe-go/v74/taxid" - "github.com/stripe/stripe-go/v74/taxrate" - terminalconfiguration "github.com/stripe/stripe-go/v74/terminal/configuration" - terminalconnectiontoken "github.com/stripe/stripe-go/v74/terminal/connectiontoken" - terminallocation "github.com/stripe/stripe-go/v74/terminal/location" - terminalreader "github.com/stripe/stripe-go/v74/terminal/reader" - testhelperscustomer "github.com/stripe/stripe-go/v74/testhelpers/customer" - testhelpersissuingcard "github.com/stripe/stripe-go/v74/testhelpers/issuing/card" - testhelpersrefund "github.com/stripe/stripe-go/v74/testhelpers/refund" - testhelpersterminalreader "github.com/stripe/stripe-go/v74/testhelpers/terminal/reader" - testhelperstestclock "github.com/stripe/stripe-go/v74/testhelpers/testclock" - testhelperstreasuryinboundtransfer "github.com/stripe/stripe-go/v74/testhelpers/treasury/inboundtransfer" - testhelperstreasuryoutboundpayment "github.com/stripe/stripe-go/v74/testhelpers/treasury/outboundpayment" - testhelperstreasuryoutboundtransfer "github.com/stripe/stripe-go/v74/testhelpers/treasury/outboundtransfer" - testhelperstreasuryreceivedcredit "github.com/stripe/stripe-go/v74/testhelpers/treasury/receivedcredit" - testhelperstreasuryreceiveddebit "github.com/stripe/stripe-go/v74/testhelpers/treasury/receiveddebit" - "github.com/stripe/stripe-go/v74/token" - "github.com/stripe/stripe-go/v74/topup" - "github.com/stripe/stripe-go/v74/transfer" - "github.com/stripe/stripe-go/v74/transferreversal" - treasurycreditreversal "github.com/stripe/stripe-go/v74/treasury/creditreversal" - treasurydebitreversal "github.com/stripe/stripe-go/v74/treasury/debitreversal" - treasuryfinancialaccount "github.com/stripe/stripe-go/v74/treasury/financialaccount" - treasuryinboundtransfer "github.com/stripe/stripe-go/v74/treasury/inboundtransfer" - treasuryoutboundpayment "github.com/stripe/stripe-go/v74/treasury/outboundpayment" - treasuryoutboundtransfer "github.com/stripe/stripe-go/v74/treasury/outboundtransfer" - treasuryreceivedcredit "github.com/stripe/stripe-go/v74/treasury/receivedcredit" - treasuryreceiveddebit "github.com/stripe/stripe-go/v74/treasury/receiveddebit" - treasurytransaction "github.com/stripe/stripe-go/v74/treasury/transaction" - treasurytransactionentry "github.com/stripe/stripe-go/v74/treasury/transactionentry" - "github.com/stripe/stripe-go/v74/usagerecord" - "github.com/stripe/stripe-go/v74/usagerecordsummary" - "github.com/stripe/stripe-go/v74/webhookendpoint" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/account" + "github.com/stripe/stripe-go/v75/accountlink" + "github.com/stripe/stripe-go/v75/applepaydomain" + "github.com/stripe/stripe-go/v75/applicationfee" + appssecret "github.com/stripe/stripe-go/v75/apps/secret" + "github.com/stripe/stripe-go/v75/balance" + "github.com/stripe/stripe-go/v75/balancetransaction" + "github.com/stripe/stripe-go/v75/bankaccount" + billingportalconfiguration "github.com/stripe/stripe-go/v75/billingportal/configuration" + billingportalsession "github.com/stripe/stripe-go/v75/billingportal/session" + "github.com/stripe/stripe-go/v75/capability" + "github.com/stripe/stripe-go/v75/card" + "github.com/stripe/stripe-go/v75/cashbalance" + "github.com/stripe/stripe-go/v75/charge" + checkoutsession "github.com/stripe/stripe-go/v75/checkout/session" + "github.com/stripe/stripe-go/v75/countryspec" + "github.com/stripe/stripe-go/v75/coupon" + "github.com/stripe/stripe-go/v75/creditnote" + "github.com/stripe/stripe-go/v75/customer" + "github.com/stripe/stripe-go/v75/customerbalancetransaction" + "github.com/stripe/stripe-go/v75/customercashbalancetransaction" + "github.com/stripe/stripe-go/v75/dispute" + "github.com/stripe/stripe-go/v75/ephemeralkey" + "github.com/stripe/stripe-go/v75/event" + "github.com/stripe/stripe-go/v75/feerefund" + "github.com/stripe/stripe-go/v75/file" + "github.com/stripe/stripe-go/v75/filelink" + financialconnectionsaccount "github.com/stripe/stripe-go/v75/financialconnections/account" + financialconnectionssession "github.com/stripe/stripe-go/v75/financialconnections/session" + identityverificationreport "github.com/stripe/stripe-go/v75/identity/verificationreport" + identityverificationsession "github.com/stripe/stripe-go/v75/identity/verificationsession" + "github.com/stripe/stripe-go/v75/invoice" + "github.com/stripe/stripe-go/v75/invoiceitem" + issuingauthorization "github.com/stripe/stripe-go/v75/issuing/authorization" + issuingcard "github.com/stripe/stripe-go/v75/issuing/card" + issuingcardholder "github.com/stripe/stripe-go/v75/issuing/cardholder" + issuingdispute "github.com/stripe/stripe-go/v75/issuing/dispute" + issuingtransaction "github.com/stripe/stripe-go/v75/issuing/transaction" + "github.com/stripe/stripe-go/v75/loginlink" + "github.com/stripe/stripe-go/v75/mandate" + "github.com/stripe/stripe-go/v75/oauth" + "github.com/stripe/stripe-go/v75/paymentintent" + "github.com/stripe/stripe-go/v75/paymentlink" + "github.com/stripe/stripe-go/v75/paymentmethod" + "github.com/stripe/stripe-go/v75/paymentsource" + "github.com/stripe/stripe-go/v75/payout" + "github.com/stripe/stripe-go/v75/person" + "github.com/stripe/stripe-go/v75/plan" + "github.com/stripe/stripe-go/v75/price" + "github.com/stripe/stripe-go/v75/product" + "github.com/stripe/stripe-go/v75/promotioncode" + "github.com/stripe/stripe-go/v75/quote" + radarearlyfraudwarning "github.com/stripe/stripe-go/v75/radar/earlyfraudwarning" + radarvaluelist "github.com/stripe/stripe-go/v75/radar/valuelist" + radarvaluelistitem "github.com/stripe/stripe-go/v75/radar/valuelistitem" + "github.com/stripe/stripe-go/v75/refund" + reportingreportrun "github.com/stripe/stripe-go/v75/reporting/reportrun" + reportingreporttype "github.com/stripe/stripe-go/v75/reporting/reporttype" + "github.com/stripe/stripe-go/v75/review" + "github.com/stripe/stripe-go/v75/setupattempt" + "github.com/stripe/stripe-go/v75/setupintent" + "github.com/stripe/stripe-go/v75/shippingrate" + sigmascheduledqueryrun "github.com/stripe/stripe-go/v75/sigma/scheduledqueryrun" + "github.com/stripe/stripe-go/v75/source" + "github.com/stripe/stripe-go/v75/sourcetransaction" + "github.com/stripe/stripe-go/v75/subscription" + "github.com/stripe/stripe-go/v75/subscriptionitem" + "github.com/stripe/stripe-go/v75/subscriptionschedule" + taxcalculation "github.com/stripe/stripe-go/v75/tax/calculation" + taxsettings "github.com/stripe/stripe-go/v75/tax/settings" + taxtransaction "github.com/stripe/stripe-go/v75/tax/transaction" + "github.com/stripe/stripe-go/v75/taxcode" + "github.com/stripe/stripe-go/v75/taxid" + "github.com/stripe/stripe-go/v75/taxrate" + terminalconfiguration "github.com/stripe/stripe-go/v75/terminal/configuration" + terminalconnectiontoken "github.com/stripe/stripe-go/v75/terminal/connectiontoken" + terminallocation "github.com/stripe/stripe-go/v75/terminal/location" + terminalreader "github.com/stripe/stripe-go/v75/terminal/reader" + testhelperscustomer "github.com/stripe/stripe-go/v75/testhelpers/customer" + testhelpersissuingcard "github.com/stripe/stripe-go/v75/testhelpers/issuing/card" + testhelpersrefund "github.com/stripe/stripe-go/v75/testhelpers/refund" + testhelpersterminalreader "github.com/stripe/stripe-go/v75/testhelpers/terminal/reader" + testhelperstestclock "github.com/stripe/stripe-go/v75/testhelpers/testclock" + testhelperstreasuryinboundtransfer "github.com/stripe/stripe-go/v75/testhelpers/treasury/inboundtransfer" + testhelperstreasuryoutboundpayment "github.com/stripe/stripe-go/v75/testhelpers/treasury/outboundpayment" + testhelperstreasuryoutboundtransfer "github.com/stripe/stripe-go/v75/testhelpers/treasury/outboundtransfer" + testhelperstreasuryreceivedcredit "github.com/stripe/stripe-go/v75/testhelpers/treasury/receivedcredit" + testhelperstreasuryreceiveddebit "github.com/stripe/stripe-go/v75/testhelpers/treasury/receiveddebit" + "github.com/stripe/stripe-go/v75/token" + "github.com/stripe/stripe-go/v75/topup" + "github.com/stripe/stripe-go/v75/transfer" + "github.com/stripe/stripe-go/v75/transferreversal" + treasurycreditreversal "github.com/stripe/stripe-go/v75/treasury/creditreversal" + treasurydebitreversal "github.com/stripe/stripe-go/v75/treasury/debitreversal" + treasuryfinancialaccount "github.com/stripe/stripe-go/v75/treasury/financialaccount" + treasuryinboundtransfer "github.com/stripe/stripe-go/v75/treasury/inboundtransfer" + treasuryoutboundpayment "github.com/stripe/stripe-go/v75/treasury/outboundpayment" + treasuryoutboundtransfer "github.com/stripe/stripe-go/v75/treasury/outboundtransfer" + treasuryreceivedcredit "github.com/stripe/stripe-go/v75/treasury/receivedcredit" + treasuryreceiveddebit "github.com/stripe/stripe-go/v75/treasury/receiveddebit" + treasurytransaction "github.com/stripe/stripe-go/v75/treasury/transaction" + treasurytransactionentry "github.com/stripe/stripe-go/v75/treasury/transactionentry" + "github.com/stripe/stripe-go/v75/usagerecord" + "github.com/stripe/stripe-go/v75/usagerecordsummary" + "github.com/stripe/stripe-go/v75/webhookendpoint" ) // API is the Stripe client. It contains all the different resources available. @@ -366,7 +366,7 @@ func (a *API) Init(key string, backends *stripe.Backends) { a.Events = &event.Client{B: backends.API, Key: key} a.FeeRefunds = &feerefund.Client{B: backends.API, Key: key} a.FileLinks = &filelink.Client{B: backends.API, Key: key} - a.Files = &file.Client{B: backends.Uploads, BUploads: backends.Uploads, Key: key} + a.Files = &file.Client{B: backends.API, BUploads: backends.Uploads, Key: key} a.FinancialConnectionsAccounts = &financialconnectionsaccount.Client{B: backends.API, Key: key} a.FinancialConnectionsSessions = &financialconnectionssession.Client{B: backends.API, Key: key} a.IdentityVerificationReports = &identityverificationreport.Client{B: backends.API, Key: key} diff --git a/countryspec.go b/countryspec.go index 028c995761..9752cc5612 100644 --- a/countryspec.go +++ b/countryspec.go @@ -9,6 +9,13 @@ package stripe // Lists all Country Spec objects available in the API. type CountrySpecListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CountrySpecListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Country is the list of supported countries @@ -17,6 +24,13 @@ type Country string // Returns a Country Spec for a given Country code. type CountrySpecParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CountrySpecParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // VerificationFieldsList lists the fields needed for an account verification. diff --git a/countryspec/client.go b/countryspec/client.go index 265c08cc93..a7dafa0f83 100644 --- a/countryspec/client.go +++ b/countryspec/client.go @@ -10,8 +10,8 @@ package countryspec import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /country_specs APIs. diff --git a/coupon.go b/coupon.go index 44c437b965..938b4ec546 100644 --- a/coupon.go +++ b/coupon.go @@ -25,6 +25,13 @@ type CouponListParams struct { Created *int64 `form:"created"` // A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CouponListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // A hash containing directions for what this Coupon will apply discounts to. @@ -56,10 +63,14 @@ type CouponParams struct { Duration *string `form:"duration"` // Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect. DurationInMonths *int64 `form:"duration_in_months"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Unique string of your choice that will be used to identify this coupon when applying it to a customer. If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you. ID *string `form:"id"` // A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid. For example, you might have a 50% off coupon that the first 20 readers of your blog can use. MaxRedemptions *int64 `form:"max_redemptions"` + // 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"` // Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set. Name *string `form:"name"` // A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed). @@ -67,6 +78,21 @@ type CouponParams struct { // Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers. RedeemBy *int64 `form:"redeem_by"` } + +// AddExpand appends a new field to expand. +func (p *CouponParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CouponParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type CouponAppliesTo struct { // A list of product IDs this coupon applies to Products []string `json:"products"` diff --git a/coupon/client.go b/coupon/client.go index b23ebb51cf..0d852ccff4 100644 --- a/coupon/client.go +++ b/coupon/client.go @@ -10,8 +10,8 @@ package coupon import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /coupons APIs. diff --git a/creditnote.go b/creditnote.go index 4533796de5..68f9db2dd4 100644 --- a/creditnote.go +++ b/creditnote.go @@ -24,24 +24,21 @@ type CreditNoteShippingCostTaxTaxabilityReason string // List of values that CreditNoteShippingCostTaxTaxabilityReason can take const ( - CreditNoteShippingCostTaxTaxabilityReasonCustomerExempt CreditNoteShippingCostTaxTaxabilityReason = "customer_exempt" - CreditNoteShippingCostTaxTaxabilityReasonExcludedTerritory CreditNoteShippingCostTaxTaxabilityReason = "excluded_territory" - CreditNoteShippingCostTaxTaxabilityReasonJurisdictionUnsupported CreditNoteShippingCostTaxTaxabilityReason = "jurisdiction_unsupported" - CreditNoteShippingCostTaxTaxabilityReasonNotCollecting CreditNoteShippingCostTaxTaxabilityReason = "not_collecting" - CreditNoteShippingCostTaxTaxabilityReasonNotSubjectToTax CreditNoteShippingCostTaxTaxabilityReason = "not_subject_to_tax" - CreditNoteShippingCostTaxTaxabilityReasonNotSupported CreditNoteShippingCostTaxTaxabilityReason = "not_supported" - CreditNoteShippingCostTaxTaxabilityReasonPortionProductExempt CreditNoteShippingCostTaxTaxabilityReason = "portion_product_exempt" - CreditNoteShippingCostTaxTaxabilityReasonPortionReducedRated CreditNoteShippingCostTaxTaxabilityReason = "portion_reduced_rated" - CreditNoteShippingCostTaxTaxabilityReasonPortionStandardRated CreditNoteShippingCostTaxTaxabilityReason = "portion_standard_rated" - CreditNoteShippingCostTaxTaxabilityReasonProductExempt CreditNoteShippingCostTaxTaxabilityReason = "product_exempt" - CreditNoteShippingCostTaxTaxabilityReasonProductExemptHoliday CreditNoteShippingCostTaxTaxabilityReason = "product_exempt_holiday" - CreditNoteShippingCostTaxTaxabilityReasonProportionallyRated CreditNoteShippingCostTaxTaxabilityReason = "proportionally_rated" - CreditNoteShippingCostTaxTaxabilityReasonReducedRated CreditNoteShippingCostTaxTaxabilityReason = "reduced_rated" - CreditNoteShippingCostTaxTaxabilityReasonReverseCharge CreditNoteShippingCostTaxTaxabilityReason = "reverse_charge" - CreditNoteShippingCostTaxTaxabilityReasonStandardRated CreditNoteShippingCostTaxTaxabilityReason = "standard_rated" - CreditNoteShippingCostTaxTaxabilityReasonTaxableBasisReduced CreditNoteShippingCostTaxTaxabilityReason = "taxable_basis_reduced" - CreditNoteShippingCostTaxTaxabilityReasonVATExempt CreditNoteShippingCostTaxTaxabilityReason = "vat_exempt" - CreditNoteShippingCostTaxTaxabilityReasonZeroRated CreditNoteShippingCostTaxTaxabilityReason = "zero_rated" + CreditNoteShippingCostTaxTaxabilityReasonCustomerExempt CreditNoteShippingCostTaxTaxabilityReason = "customer_exempt" + CreditNoteShippingCostTaxTaxabilityReasonNotCollecting CreditNoteShippingCostTaxTaxabilityReason = "not_collecting" + CreditNoteShippingCostTaxTaxabilityReasonNotSubjectToTax CreditNoteShippingCostTaxTaxabilityReason = "not_subject_to_tax" + CreditNoteShippingCostTaxTaxabilityReasonNotSupported CreditNoteShippingCostTaxTaxabilityReason = "not_supported" + CreditNoteShippingCostTaxTaxabilityReasonPortionProductExempt CreditNoteShippingCostTaxTaxabilityReason = "portion_product_exempt" + CreditNoteShippingCostTaxTaxabilityReasonPortionReducedRated CreditNoteShippingCostTaxTaxabilityReason = "portion_reduced_rated" + CreditNoteShippingCostTaxTaxabilityReasonPortionStandardRated CreditNoteShippingCostTaxTaxabilityReason = "portion_standard_rated" + CreditNoteShippingCostTaxTaxabilityReasonProductExempt CreditNoteShippingCostTaxTaxabilityReason = "product_exempt" + CreditNoteShippingCostTaxTaxabilityReasonProductExemptHoliday CreditNoteShippingCostTaxTaxabilityReason = "product_exempt_holiday" + CreditNoteShippingCostTaxTaxabilityReasonProportionallyRated CreditNoteShippingCostTaxTaxabilityReason = "proportionally_rated" + CreditNoteShippingCostTaxTaxabilityReasonReducedRated CreditNoteShippingCostTaxTaxabilityReason = "reduced_rated" + CreditNoteShippingCostTaxTaxabilityReasonReverseCharge CreditNoteShippingCostTaxTaxabilityReason = "reverse_charge" + CreditNoteShippingCostTaxTaxabilityReasonStandardRated CreditNoteShippingCostTaxTaxabilityReason = "standard_rated" + CreditNoteShippingCostTaxTaxabilityReasonTaxableBasisReduced CreditNoteShippingCostTaxTaxabilityReason = "taxable_basis_reduced" + CreditNoteShippingCostTaxTaxabilityReasonZeroRated CreditNoteShippingCostTaxTaxabilityReason = "zero_rated" ) // Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). @@ -130,12 +127,16 @@ type CreditNoteParams struct { CreditAmount *int64 `form:"credit_amount"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. EffectiveAt *int64 `form:"effective_at"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // ID of the invoice. Invoice *string `form:"invoice"` // Line items that make up the credit note. Lines []*CreditNoteLineParams `form:"lines"` - // Credit note memo. + // The credit note's memo appears on the credit note PDF. Memo *string `form:"memo"` + // 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 integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe. OutOfBandAmount *int64 `form:"out_of_band_amount"` // Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` @@ -148,15 +149,36 @@ type CreditNoteParams struct { ShippingCost *CreditNoteShippingCostParams `form:"shipping_cost"` } +// AddExpand appends a new field to expand. +func (p *CreditNoteParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CreditNoteParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of credit notes. type CreditNoteListParams struct { ListParams `form:"*"` // Only return credit notes for the customer specified by this customer ID. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return credit notes for the invoice specified by this invoice ID. Invoice *string `form:"invoice"` } +// AddExpand appends a new field to expand. +func (p *CreditNoteListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // 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`. @@ -192,12 +214,16 @@ type CreditNotePreviewParams struct { CreditAmount *int64 `form:"credit_amount"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. EffectiveAt *int64 `form:"effective_at"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // ID of the invoice. Invoice *string `form:"invoice"` // Line items that make up the credit note. Lines []*CreditNotePreviewLineParams `form:"lines"` // The credit note's memo appears on the credit note PDF. Memo *string `form:"memo"` + // 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 integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe. OutOfBandAmount *int64 `form:"out_of_band_amount"` // Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` @@ -210,9 +236,30 @@ type CreditNotePreviewParams struct { ShippingCost *CreditNotePreviewShippingCostParams `form:"shipping_cost"` } +// AddExpand appends a new field to expand. +func (p *CreditNotePreviewParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CreditNotePreviewParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Marks a credit note as void. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding). type CreditNoteVoidCreditNoteParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CreditNoteVoidCreditNoteParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Line items that make up the credit note. @@ -250,12 +297,16 @@ type CreditNotePreviewLinesParams struct { CreditAmount *int64 `form:"credit_amount"` // The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF. EffectiveAt *int64 `form:"effective_at"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // ID of the invoice. Invoice *string `form:"invoice"` // Line items that make up the credit note. Lines []*CreditNotePreviewLinesLineParams `form:"lines"` // The credit note's memo appears on the credit note PDF. Memo *string `form:"memo"` + // 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 integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe. OutOfBandAmount *int64 `form:"out_of_band_amount"` // Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory` @@ -268,10 +319,31 @@ type CreditNotePreviewLinesParams struct { ShippingCost *CreditNotePreviewLinesShippingCostParams `form:"shipping_cost"` } +// AddExpand appends a new field to expand. +func (p *CreditNotePreviewLinesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CreditNotePreviewLinesParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // When retrieving a credit note, you'll get a lines property containing the the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. type CreditNoteListLinesParams struct { ListParams `form:"*"` CreditNote *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CreditNoteListLinesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The integer amount in cents (or local equivalent) representing the total amount of discount that was credited. diff --git a/creditnote/client.go b/creditnote/client.go index 769ec3f008..1e996d01ec 100644 --- a/creditnote/client.go +++ b/creditnote/client.go @@ -10,8 +10,8 @@ package creditnote import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /credit_notes APIs. diff --git a/customer.go b/customer.go index 33cdffaffd..3c5f7e3b8e 100644 --- a/customer.go +++ b/customer.go @@ -46,10 +46,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type CustomerSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *CustomerSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // 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:"*"` @@ -57,10 +64,17 @@ type CustomerListParams struct { 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Provides a list of customers that are associated with the specified test clock. The response will not include customers with test clocks if this parameter is not set. TestClock *string `form:"test_clock"` } +// AddExpand appends a new field to expand. +func (p *CustomerListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Settings controlling the behavior of the customer's cash balance, // such as reconciliation of funds received. type CustomerCashBalanceSettingsParams struct { @@ -145,10 +159,14 @@ type CustomerParams struct { Description *string `form:"description"` // Customer's email address. It's displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to *512 characters*. Email *string `form:"email"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers. InvoicePrefix *string `form:"invoice_prefix"` // Default invoice settings for this customer. InvoiceSettings *CustomerInvoiceSettingsParams `form:"invoice_settings"` + // 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 customer's full name or business name. Name *string `form:"name"` // The sequence to be used on the customer's next invoice. Defaults to 1. @@ -174,18 +192,46 @@ type CustomerParams struct { Validate *bool `form:"validate"` } +// AddExpand appends a new field to expand. +func (p *CustomerParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CustomerParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of PaymentMethods for a given Customer type CustomerListPaymentMethodsParams struct { ListParams `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // An optional filter on the list, based on the object `type` field. Without the filter, the list includes all current and future payment method types. If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *CustomerListPaymentMethodsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves a PaymentMethod object for a given Customer. type CustomerRetrievePaymentMethodParams struct { Params `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CustomerRetrievePaymentMethodParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Configuration for eu_bank_transfer funding type. @@ -215,10 +261,17 @@ type CustomerCreateFundingInstructionsParams struct { BankTransfer *CustomerCreateFundingInstructionsBankTransferParams `form:"bank_transfer"` // 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The `funding_type` to get the instructions for. FundingType *string `form:"funding_type"` } +// AddExpand appends a new field to expand. +func (p *CustomerCreateFundingInstructionsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Removes the currently applied discount on a customer. type CustomerDeleteDiscountParams struct { Params `form:"*"` diff --git a/customer/client.go b/customer/client.go index 7ee3a5ea5b..576a3779b2 100644 --- a/customer/client.go +++ b/customer/client.go @@ -10,8 +10,8 @@ package customer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /customers APIs. diff --git a/customerbalancetransaction.go b/customerbalancetransaction.go index 41cd29a818..992323e6bc 100644 --- a/customerbalancetransaction.go +++ b/customerbalancetransaction.go @@ -35,12 +35,37 @@ type CustomerBalanceTransactionParams struct { Currency *string `form:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *CustomerBalanceTransactionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *CustomerBalanceTransactionParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // Returns a list of transactions that updated the customer's [balances](https://stripe.com/docs/billing/customer/balance). type CustomerBalanceTransactionListParams struct { ListParams `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CustomerBalanceTransactionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Each customer has a [Balance](https://stripe.com/docs/api/customers/object#customer_object-balance) value, diff --git a/customerbalancetransaction/client.go b/customerbalancetransaction/client.go index 9374925663..da59ad327f 100644 --- a/customerbalancetransaction/client.go +++ b/customerbalancetransaction/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /customers/{customer}/balance_transactions APIs. diff --git a/customercashbalancetransaction.go b/customercashbalancetransaction.go index afbe4b0ec5..5e87c6c110 100644 --- a/customercashbalancetransaction.go +++ b/customercashbalancetransaction.go @@ -49,13 +49,28 @@ const ( type CustomerCashBalanceTransactionParams struct { Params `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *CustomerCashBalanceTransactionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Returns a list of transactions that modified the customer's [cash balance](https://stripe.com/docs/payments/customer-balance). type CustomerCashBalanceTransactionListParams struct { ListParams `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *CustomerCashBalanceTransactionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type CustomerCashBalanceTransactionAdjustedForOverdraft struct { // The [Cash Balance Transaction](https://stripe.com/docs/api/cash_balance_transactions/object) that brought the customer balance negative, triggering the clawback of funds. LinkedTransaction *CustomerCashBalanceTransaction `json:"linked_transaction"` diff --git a/customercashbalancetransaction/client.go b/customercashbalancetransaction/client.go index 3194e824a8..48e388deb5 100644 --- a/customercashbalancetransaction/client.go +++ b/customercashbalancetransaction/client.go @@ -10,8 +10,8 @@ package customercashbalancetransaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /customers/{customer}/cash_balance_transactions APIs. diff --git a/dispute.go b/dispute.go index 38336b5235..b8b1776779 100644 --- a/dispute.go +++ b/dispute.go @@ -50,19 +50,44 @@ type DisputeListParams struct { Charge *string `form:"charge"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return disputes associated to the PaymentIntent specified by this PaymentIntent ID. PaymentIntent *string `form:"payment_intent"` } +// AddExpand appends a new field to expand. +func (p *DisputeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the dispute with the given ID. type DisputeParams struct { Params `form:"*"` // Evidence to upload, to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. The combined character count of all fields is limited to 150,000. Evidence *DisputeEvidenceParams `form:"evidence"` + // 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"` // Whether to immediately submit evidence to the bank. If `false`, evidence is staged on the dispute. Staged evidence is visible in the API and Dashboard, and can be submitted to the bank by making another request with this attribute set to `true` (the default). Submit *bool `form:"submit"` } +// AddExpand appends a new field to expand. +func (p *DisputeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *DisputeParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Evidence to upload, to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review. The combined character count of all fields is limited to 150,000. type DisputeEvidenceParams struct { // Any server or activity logs showing proof that the customer accessed or downloaded the purchased digital product. This information should include IP addresses, corresponding timestamps, and any detailed recorded activity. Has a maximum character count of 20,000. diff --git a/dispute/client.go b/dispute/client.go index 47addf8abc..539c8349f4 100644 --- a/dispute/client.go +++ b/dispute/client.go @@ -10,8 +10,8 @@ package dispute import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /disputes APIs. diff --git a/ephemeralkey.go b/ephemeralkey.go index 3e0f107e96..3b081abf98 100644 --- a/ephemeralkey.go +++ b/ephemeralkey.go @@ -13,12 +13,20 @@ type EphemeralKeyParams struct { Params `form:"*"` // The ID of the Customer you'd like to modify using the resulting ephemeral key. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The ID of the Issuing Card you'd like to access using the resulting ephemeral key. IssuingCard *string `form:"issuing_card"` // The ID of the Identity VerificationSession you'd like to access using the resulting ephemeral key VerificationSession *string `form:"verification_session"` StripeVersion *string `form:"-"` // This goes in the `Stripe-Version` header } + +// AddExpand appends a new field to expand. +func (p *EphemeralKeyParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type EphemeralKey struct { APIResource // Time at which the object was created. Measured in seconds since the Unix epoch. diff --git a/ephemeralkey/client.go b/ephemeralkey/client.go index 37b95b6133..05055cd661 100644 --- a/ephemeralkey/client.go +++ b/ephemeralkey/client.go @@ -11,7 +11,7 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /ephemeral_keys APIs. diff --git a/error.go b/error.go index 614a1e3b68..655e68979f 100644 --- a/error.go +++ b/error.go @@ -50,7 +50,6 @@ const ( ErrorCodeCaptureUnauthorizedPayment ErrorCode = "capture_unauthorized_payment" ErrorCodeCardDeclineRateLimitExceeded ErrorCode = "card_decline_rate_limit_exceeded" ErrorCodeCardDeclined ErrorCode = "card_declined" - ErrorCodeCardDeclinedRateLimitExceeded ErrorCode = "card_decline_rate_limit_exceeded" ErrorCodeCardholderPhoneNumberRequired ErrorCode = "cardholder_phone_number_required" ErrorCodeChargeAlreadyCaptured ErrorCode = "charge_already_captured" ErrorCodeChargeAlreadyRefunded ErrorCode = "charge_already_refunded" @@ -88,14 +87,12 @@ const ( ErrorCodeInvalidExpiryYear ErrorCode = "invalid_expiry_year" ErrorCodeInvalidNumber ErrorCode = "invalid_number" ErrorCodeInvalidSourceUsage ErrorCode = "invalid_source_usage" - ErrorCodeInvalidSwipeData ErrorCode = "invalid_swipe_data" ErrorCodeInvalidTaxLocation ErrorCode = "invalid_tax_location" ErrorCodeInvoiceNoCustomerLineItems ErrorCode = "invoice_no_customer_line_items" ErrorCodeInvoiceNoPaymentMethodTypes ErrorCode = "invoice_no_payment_method_types" ErrorCodeInvoiceNoSubscriptionLineItems ErrorCode = "invoice_no_subscription_line_items" ErrorCodeInvoiceNotEditable ErrorCode = "invoice_not_editable" ErrorCodeInvoiceOnBehalfOfNotEditable ErrorCode = "invoice_on_behalf_of_not_editable" - ErrorCodeInvoicePamentIntentRequiresAction ErrorCode = "invoice_payment_intent_requires_action" ErrorCodeInvoicePaymentIntentRequiresAction ErrorCode = "invoice_payment_intent_requires_action" ErrorCodeInvoiceUpcomingNone ErrorCode = "invoice_upcoming_none" ErrorCodeLivemodeMismatch ErrorCode = "livemode_mismatch" @@ -160,7 +157,6 @@ const ( ErrorCodeSEPAUnsupportedAccount ErrorCode = "sepa_unsupported_account" ErrorCodeSKUInactive ErrorCode = "sku_inactive" ErrorCodeSecretKeyRequired ErrorCode = "secret_key_required" - ErrorCodeSepaUnsupportedAccount ErrorCode = "sepa_unsupported_account" ErrorCodeSetupAttemptFailed ErrorCode = "setup_attempt_failed" ErrorCodeSetupIntentAuthenticationFailure ErrorCode = "setup_intent_authentication_failure" ErrorCodeSetupIntentInvalidParameter ErrorCode = "setup_intent_invalid_parameter" @@ -168,7 +164,6 @@ const ( ErrorCodeSetupIntentSetupAttemptExpired ErrorCode = "setup_intent_setup_attempt_expired" ErrorCodeSetupIntentUnexpectedState ErrorCode = "setup_intent_unexpected_state" ErrorCodeShippingCalculationFailed ErrorCode = "shipping_calculation_failed" - ErrorCodeSkuInactive ErrorCode = "sku_inactive" ErrorCodeStateUnsupported ErrorCode = "state_unsupported" ErrorCodeStatusTransitionInvalid ErrorCode = "status_transition_invalid" ErrorCodeTLSVersionUnsupported ErrorCode = "tls_version_unsupported" @@ -184,7 +179,6 @@ const ( ErrorCodeTransferSourceBalanceParametersMismatch ErrorCode = "transfer_source_balance_parameters_mismatch" ErrorCodeTransfersNotAllowed ErrorCode = "transfers_not_allowed" ErrorCodeURLInvalid ErrorCode = "url_invalid" - ErrorCodeinstantPayoutsLimitExceeded ErrorCode = "instant_payouts_limit_exceeded" ) // The end of the section generated from our OpenAPI spec diff --git a/event.go b/event.go index 7fc557089e..a803e02cc2 100644 --- a/event.go +++ b/event.go @@ -19,16 +19,31 @@ type EventListParams struct { 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A string containing a specific event name, or group of events using * as a wildcard. The list will be filtered to include only events with a matching event property. Type *string `form:"type"` // An array of up to 20 strings containing specific event names. The list will be filtered to include only events with a matching event property. You may pass either `type` or `types`, but not both. Types []*string `form:"types"` } +// AddExpand appends a new field to expand. +func (p *EventListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the details of an event. Supply the unique identifier of the event, which you might have received in a webhook. type EventParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *EventParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type EventData struct { // Object is a raw mapping of the API resource contained in the event. // Although marked with json:"-", it's still populated independently by diff --git a/event/client.go b/event/client.go index 5041c5e83d..711c4e56eb 100644 --- a/event/client.go +++ b/event/client.go @@ -10,8 +10,8 @@ package event import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /events APIs. diff --git a/example/generated_examples_test.go b/example/generated_examples_test.go index e00a20b653..4354e6d3f6 100644 --- a/example/generated_examples_test.go +++ b/example/generated_examples_test.go @@ -5,90 +5,90 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v74" - account "github.com/stripe/stripe-go/v74/account" - accountlink "github.com/stripe/stripe-go/v74/accountlink" - apps_secret "github.com/stripe/stripe-go/v74/apps/secret" - balancetransaction "github.com/stripe/stripe-go/v74/balancetransaction" - billingportal_configuration "github.com/stripe/stripe-go/v74/billingportal/configuration" - billingportal_session "github.com/stripe/stripe-go/v74/billingportal/session" - capability "github.com/stripe/stripe-go/v74/capability" - cashbalance "github.com/stripe/stripe-go/v74/cashbalance" - charge "github.com/stripe/stripe-go/v74/charge" - checkout_session "github.com/stripe/stripe-go/v74/checkout/session" - countryspec "github.com/stripe/stripe-go/v74/countryspec" - coupon "github.com/stripe/stripe-go/v74/coupon" - customer "github.com/stripe/stripe-go/v74/customer" - customerbalancetransaction "github.com/stripe/stripe-go/v74/customerbalancetransaction" - dispute "github.com/stripe/stripe-go/v74/dispute" - event "github.com/stripe/stripe-go/v74/event" - financialconnections_account "github.com/stripe/stripe-go/v74/financialconnections/account" - financialconnections_session "github.com/stripe/stripe-go/v74/financialconnections/session" - identity_verificationreport "github.com/stripe/stripe-go/v74/identity/verificationreport" - identity_verificationsession "github.com/stripe/stripe-go/v74/identity/verificationsession" - invoice "github.com/stripe/stripe-go/v74/invoice" - invoiceitem "github.com/stripe/stripe-go/v74/invoiceitem" - issuing_authorization "github.com/stripe/stripe-go/v74/issuing/authorization" - issuing_card "github.com/stripe/stripe-go/v74/issuing/card" - issuing_cardholder "github.com/stripe/stripe-go/v74/issuing/cardholder" - issuing_dispute "github.com/stripe/stripe-go/v74/issuing/dispute" - issuing_transaction "github.com/stripe/stripe-go/v74/issuing/transaction" - mandate "github.com/stripe/stripe-go/v74/mandate" - paymentintent "github.com/stripe/stripe-go/v74/paymentintent" - paymentlink "github.com/stripe/stripe-go/v74/paymentlink" - paymentmethod "github.com/stripe/stripe-go/v74/paymentmethod" - payout "github.com/stripe/stripe-go/v74/payout" - person "github.com/stripe/stripe-go/v74/person" - plan "github.com/stripe/stripe-go/v74/plan" - price "github.com/stripe/stripe-go/v74/price" - product "github.com/stripe/stripe-go/v74/product" - promotioncode "github.com/stripe/stripe-go/v74/promotioncode" - quote "github.com/stripe/stripe-go/v74/quote" - radar_earlyfraudwarning "github.com/stripe/stripe-go/v74/radar/earlyfraudwarning" - refund "github.com/stripe/stripe-go/v74/refund" - review "github.com/stripe/stripe-go/v74/review" - setupattempt "github.com/stripe/stripe-go/v74/setupattempt" - setupintent "github.com/stripe/stripe-go/v74/setupintent" - shippingrate "github.com/stripe/stripe-go/v74/shippingrate" - sigma_scheduledqueryrun "github.com/stripe/stripe-go/v74/sigma/scheduledqueryrun" - source "github.com/stripe/stripe-go/v74/source" - subscription "github.com/stripe/stripe-go/v74/subscription" - subscriptionitem "github.com/stripe/stripe-go/v74/subscriptionitem" - subscriptionschedule "github.com/stripe/stripe-go/v74/subscriptionschedule" - tax_calculation "github.com/stripe/stripe-go/v74/tax/calculation" - tax_transaction "github.com/stripe/stripe-go/v74/tax/transaction" - taxcode "github.com/stripe/stripe-go/v74/taxcode" - taxid "github.com/stripe/stripe-go/v74/taxid" - taxrate "github.com/stripe/stripe-go/v74/taxrate" - terminal_configuration "github.com/stripe/stripe-go/v74/terminal/configuration" - terminal_connectiontoken "github.com/stripe/stripe-go/v74/terminal/connectiontoken" - terminal_location "github.com/stripe/stripe-go/v74/terminal/location" - terminal_reader "github.com/stripe/stripe-go/v74/terminal/reader" - testhelpers_customer "github.com/stripe/stripe-go/v74/testhelpers/customer" - testhelpers_issuing_card "github.com/stripe/stripe-go/v74/testhelpers/issuing/card" - testhelpers_refund "github.com/stripe/stripe-go/v74/testhelpers/refund" - testhelpers_testclock "github.com/stripe/stripe-go/v74/testhelpers/testclock" - testhelpers_treasury_inboundtransfer "github.com/stripe/stripe-go/v74/testhelpers/treasury/inboundtransfer" - testhelpers_treasury_outboundtransfer "github.com/stripe/stripe-go/v74/testhelpers/treasury/outboundtransfer" - testhelpers_treasury_receivedcredit "github.com/stripe/stripe-go/v74/testhelpers/treasury/receivedcredit" - testhelpers_treasury_receiveddebit "github.com/stripe/stripe-go/v74/testhelpers/treasury/receiveddebit" - _ "github.com/stripe/stripe-go/v74/testing" - token "github.com/stripe/stripe-go/v74/token" - topup "github.com/stripe/stripe-go/v74/topup" - transfer "github.com/stripe/stripe-go/v74/transfer" - transferreversal "github.com/stripe/stripe-go/v74/transferreversal" - treasury_creditreversal "github.com/stripe/stripe-go/v74/treasury/creditreversal" - treasury_debitreversal "github.com/stripe/stripe-go/v74/treasury/debitreversal" - treasury_financialaccount "github.com/stripe/stripe-go/v74/treasury/financialaccount" - treasury_inboundtransfer "github.com/stripe/stripe-go/v74/treasury/inboundtransfer" - treasury_outboundpayment "github.com/stripe/stripe-go/v74/treasury/outboundpayment" - treasury_outboundtransfer "github.com/stripe/stripe-go/v74/treasury/outboundtransfer" - treasury_receivedcredit "github.com/stripe/stripe-go/v74/treasury/receivedcredit" - treasury_receiveddebit "github.com/stripe/stripe-go/v74/treasury/receiveddebit" - treasury_transaction "github.com/stripe/stripe-go/v74/treasury/transaction" - treasury_transactionentry "github.com/stripe/stripe-go/v74/treasury/transactionentry" - usagerecord "github.com/stripe/stripe-go/v74/usagerecord" - webhookendpoint "github.com/stripe/stripe-go/v74/webhookendpoint" + stripe "github.com/stripe/stripe-go/v75" + account "github.com/stripe/stripe-go/v75/account" + accountlink "github.com/stripe/stripe-go/v75/accountlink" + apps_secret "github.com/stripe/stripe-go/v75/apps/secret" + balancetransaction "github.com/stripe/stripe-go/v75/balancetransaction" + billingportal_configuration "github.com/stripe/stripe-go/v75/billingportal/configuration" + billingportal_session "github.com/stripe/stripe-go/v75/billingportal/session" + capability "github.com/stripe/stripe-go/v75/capability" + cashbalance "github.com/stripe/stripe-go/v75/cashbalance" + charge "github.com/stripe/stripe-go/v75/charge" + checkout_session "github.com/stripe/stripe-go/v75/checkout/session" + countryspec "github.com/stripe/stripe-go/v75/countryspec" + coupon "github.com/stripe/stripe-go/v75/coupon" + customer "github.com/stripe/stripe-go/v75/customer" + customerbalancetransaction "github.com/stripe/stripe-go/v75/customerbalancetransaction" + dispute "github.com/stripe/stripe-go/v75/dispute" + event "github.com/stripe/stripe-go/v75/event" + financialconnections_account "github.com/stripe/stripe-go/v75/financialconnections/account" + financialconnections_session "github.com/stripe/stripe-go/v75/financialconnections/session" + identity_verificationreport "github.com/stripe/stripe-go/v75/identity/verificationreport" + identity_verificationsession "github.com/stripe/stripe-go/v75/identity/verificationsession" + invoice "github.com/stripe/stripe-go/v75/invoice" + invoiceitem "github.com/stripe/stripe-go/v75/invoiceitem" + issuing_authorization "github.com/stripe/stripe-go/v75/issuing/authorization" + issuing_card "github.com/stripe/stripe-go/v75/issuing/card" + issuing_cardholder "github.com/stripe/stripe-go/v75/issuing/cardholder" + issuing_dispute "github.com/stripe/stripe-go/v75/issuing/dispute" + issuing_transaction "github.com/stripe/stripe-go/v75/issuing/transaction" + mandate "github.com/stripe/stripe-go/v75/mandate" + paymentintent "github.com/stripe/stripe-go/v75/paymentintent" + paymentlink "github.com/stripe/stripe-go/v75/paymentlink" + paymentmethod "github.com/stripe/stripe-go/v75/paymentmethod" + payout "github.com/stripe/stripe-go/v75/payout" + person "github.com/stripe/stripe-go/v75/person" + plan "github.com/stripe/stripe-go/v75/plan" + price "github.com/stripe/stripe-go/v75/price" + product "github.com/stripe/stripe-go/v75/product" + promotioncode "github.com/stripe/stripe-go/v75/promotioncode" + quote "github.com/stripe/stripe-go/v75/quote" + radar_earlyfraudwarning "github.com/stripe/stripe-go/v75/radar/earlyfraudwarning" + refund "github.com/stripe/stripe-go/v75/refund" + review "github.com/stripe/stripe-go/v75/review" + setupattempt "github.com/stripe/stripe-go/v75/setupattempt" + setupintent "github.com/stripe/stripe-go/v75/setupintent" + shippingrate "github.com/stripe/stripe-go/v75/shippingrate" + sigma_scheduledqueryrun "github.com/stripe/stripe-go/v75/sigma/scheduledqueryrun" + source "github.com/stripe/stripe-go/v75/source" + subscription "github.com/stripe/stripe-go/v75/subscription" + subscriptionitem "github.com/stripe/stripe-go/v75/subscriptionitem" + subscriptionschedule "github.com/stripe/stripe-go/v75/subscriptionschedule" + tax_calculation "github.com/stripe/stripe-go/v75/tax/calculation" + tax_transaction "github.com/stripe/stripe-go/v75/tax/transaction" + taxcode "github.com/stripe/stripe-go/v75/taxcode" + taxid "github.com/stripe/stripe-go/v75/taxid" + taxrate "github.com/stripe/stripe-go/v75/taxrate" + terminal_configuration "github.com/stripe/stripe-go/v75/terminal/configuration" + terminal_connectiontoken "github.com/stripe/stripe-go/v75/terminal/connectiontoken" + terminal_location "github.com/stripe/stripe-go/v75/terminal/location" + terminal_reader "github.com/stripe/stripe-go/v75/terminal/reader" + testhelpers_customer "github.com/stripe/stripe-go/v75/testhelpers/customer" + testhelpers_issuing_card "github.com/stripe/stripe-go/v75/testhelpers/issuing/card" + testhelpers_refund "github.com/stripe/stripe-go/v75/testhelpers/refund" + testhelpers_testclock "github.com/stripe/stripe-go/v75/testhelpers/testclock" + testhelpers_treasury_inboundtransfer "github.com/stripe/stripe-go/v75/testhelpers/treasury/inboundtransfer" + testhelpers_treasury_outboundtransfer "github.com/stripe/stripe-go/v75/testhelpers/treasury/outboundtransfer" + testhelpers_treasury_receivedcredit "github.com/stripe/stripe-go/v75/testhelpers/treasury/receivedcredit" + testhelpers_treasury_receiveddebit "github.com/stripe/stripe-go/v75/testhelpers/treasury/receiveddebit" + _ "github.com/stripe/stripe-go/v75/testing" + token "github.com/stripe/stripe-go/v75/token" + topup "github.com/stripe/stripe-go/v75/topup" + transfer "github.com/stripe/stripe-go/v75/transfer" + transferreversal "github.com/stripe/stripe-go/v75/transferreversal" + treasury_creditreversal "github.com/stripe/stripe-go/v75/treasury/creditreversal" + treasury_debitreversal "github.com/stripe/stripe-go/v75/treasury/debitreversal" + treasury_financialaccount "github.com/stripe/stripe-go/v75/treasury/financialaccount" + treasury_inboundtransfer "github.com/stripe/stripe-go/v75/treasury/inboundtransfer" + treasury_outboundpayment "github.com/stripe/stripe-go/v75/treasury/outboundpayment" + treasury_outboundtransfer "github.com/stripe/stripe-go/v75/treasury/outboundtransfer" + treasury_receivedcredit "github.com/stripe/stripe-go/v75/treasury/receivedcredit" + treasury_receiveddebit "github.com/stripe/stripe-go/v75/treasury/receiveddebit" + treasury_transaction "github.com/stripe/stripe-go/v75/treasury/transaction" + treasury_transactionentry "github.com/stripe/stripe-go/v75/treasury/transactionentry" + usagerecord "github.com/stripe/stripe-go/v75/usagerecord" + webhookendpoint "github.com/stripe/stripe-go/v75/webhookendpoint" ) func TestAppsSecretList(t *testing.T) { diff --git a/feerefund.go b/feerefund.go index 01bc5a6624..5a39cfb7a1 100644 --- a/feerefund.go +++ b/feerefund.go @@ -23,12 +23,37 @@ type FeeRefundParams struct { ID *string `form:"-"` // Included in URL // A positive integer, in _cents (or local equivalent)_, representing how much of this fee to refund. Can refund only up to the remaining unrefunded amount of the fee. Amount *int64 `form:"amount"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *FeeRefundParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *FeeRefundParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // You can see a list of the refunds belonging to a specific application fee. Note that the 10 most recent refunds are always available by default on the application fee object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional refunds. type FeeRefundListParams struct { ListParams `form:"*"` ID *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *FeeRefundListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // `Application Fee Refund` objects allow you to refund an application fee that diff --git a/feerefund/client.go b/feerefund/client.go index 7b0121fd50..1f5e0ef4cc 100644 --- a/feerefund/client.go +++ b/feerefund/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /application_fees/{id}/refunds APIs. diff --git a/file.go b/file.go index 8da5d4de4e..26f00a88b1 100644 --- a/file.go +++ b/file.go @@ -9,7 +9,7 @@ package stripe import ( "bytes" "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" "io" "mime/multipart" "net/url" @@ -43,10 +43,17 @@ type FileListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The file purpose to filter queries by. If none is provided, files will not be filtered by purpose. Purpose *string `form:"purpose"` } +// AddExpand appends a new field to expand. +func (p *FileListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Optional parameters to automatically create a [file link](https://stripe.com/docs/api#file_links) for the newly created file. type FileFileLinkDataParams struct { Params `form:"*"` @@ -58,11 +65,22 @@ type FileFileLinkDataParams struct { Metadata map[string]string `form:"metadata"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *FileFileLinkDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // To upload a file to Stripe, you'll need to send a request of type multipart/form-data. The request should contain the file you would like to upload, as well as the parameters for creating a file. // // All of Stripe's officially supported Client libraries should have support for sending multipart/form-data. type FileParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // FileReader is a reader with the contents of the file that should be uploaded. FileReader io.Reader @@ -74,6 +92,11 @@ type FileParams struct { Purpose *string `form:"purpose"` } +// AddExpand appends a new field to expand. +func (p *FileParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // This is an object representing a file hosted on Stripe's servers. The // file may have been uploaded by yourself using the [create file](https://stripe.com/docs/api#create_file) // request (for example, when uploading dispute evidence) or it may have @@ -116,36 +139,36 @@ type FileList struct { // GetBody gets an appropriate multipart form payload to use in a request body // to create a new file. -func (f *FileParams) GetBody() (*bytes.Buffer, string, error) { +func (p *FileParams) GetBody() (*bytes.Buffer, string, error) { body := &bytes.Buffer{} writer := multipart.NewWriter(body) - if f.Purpose != nil { - err := writer.WriteField("purpose", StringValue(f.Purpose)) + if p.Purpose != nil { + err := writer.WriteField("purpose", StringValue(p.Purpose)) if err != nil { return nil, "", err } } - if f.FileReader != nil && f.Filename != nil { + if p.FileReader != nil && p.Filename != nil { part, err := writer.CreateFormFile( "file", - filepath.Base(StringValue(f.Filename)), + filepath.Base(StringValue(p.Filename)), ) if err != nil { return nil, "", err } - _, err = io.Copy(part, f.FileReader) + _, err = io.Copy(part, p.FileReader) if err != nil { return nil, "", err } } - if f.FileLinkData != nil { + if p.FileLinkData != nil { values := &form.Values{} - form.AppendToPrefixed(values, f.FileLinkData, []string{"file_link_data"}) + form.AppendToPrefixed(values, p.FileLinkData, []string{"file_link_data"}) params, err := url.ParseQuery(values.Encode()) if err != nil { diff --git a/file/client.go b/file/client.go index 959af39d05..6e950b7893 100644 --- a/file/client.go +++ b/file/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /files APIs. @@ -99,9 +99,5 @@ func (i *Iter) FileList() *stripe.FileList { } func getC() Client { - return Client{ - stripe.GetBackend(stripe.UploadsBackend), - stripe.GetBackend(stripe.UploadsBackend), - stripe.Key, - } + return Client{stripe.GetBackend(stripe.APIBackend), stripe.GetBackend(stripe.UploadsBackend), stripe.Key} } diff --git a/filelink.go b/filelink.go index bed56fff64..6759a7ebb7 100644 --- a/filelink.go +++ b/filelink.go @@ -6,21 +6,39 @@ package stripe -import "github.com/stripe/stripe-go/v74/form" +import "github.com/stripe/stripe-go/v75/form" // Retrieves the file link with the given ID. type FileLinkParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A future timestamp after which the link will no longer be usable, or `now` to expire the link immediately. ExpiresAt *int64 `form:"expires_at"` ExpiresAtNow *bool `form:"-"` // See custom AppendTo // The ID of the file. The file's `purpose` must be one of the following: `business_icon`, `business_logo`, `customer_signature`, `dispute_evidence`, `finance_report_run`, `identity_document_downloadable`, `pci_document`, `selfie`, `sigma_scheduled_query`, `tax_document_user_upload`, or `terminal_reader_splashscreen`. File *string `form:"file"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *FileLinkParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *FileLinkParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // AppendTo implements custom encoding logic for FileLinkParams. -func (f *FileLinkParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(f.ExpiresAtNow) { +func (p *FileLinkParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.ExpiresAtNow) { body.Add(form.FormatKey(append(keyParts, "expires_at")), "now") } } @@ -30,12 +48,19 @@ type FileLinkListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Filter links by their expiration status. By default, all links are returned. Expired *bool `form:"expired"` // Only return links for the given file. File *string `form:"file"` } +// AddExpand appends a new field to expand. +func (p *FileLinkListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // To share the contents of a `File` object with non-Stripe users, you can // create a `FileLink`. `FileLink`s contain a URL that can be used to // retrieve the contents of the file without authentication. diff --git a/filelink/client.go b/filelink/client.go index c264c00dee..90ca2ff43d 100644 --- a/filelink/client.go +++ b/filelink/client.go @@ -10,8 +10,8 @@ package filelink import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /file_links APIs. diff --git a/financialconnections/account/client.go b/financialconnections/account/client.go index f58560ac38..b3c8d71b15 100644 --- a/financialconnections/account/client.go +++ b/financialconnections/account/client.go @@ -10,8 +10,8 @@ package account import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /financial_connections/accounts APIs. diff --git a/financialconnections/session/client.go b/financialconnections/session/client.go index ab11ae577d..778b82890b 100644 --- a/financialconnections/session/client.go +++ b/financialconnections/session/client.go @@ -10,7 +10,7 @@ package session import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /financial_connections/sessions APIs. diff --git a/financialconnections_account.go b/financialconnections_account.go index f23e581936..23c75d9367 100644 --- a/financialconnections_account.go +++ b/financialconnections_account.go @@ -124,33 +124,68 @@ type FinancialConnectionsAccountListParams struct { ListParams `form:"*"` // If present, only return accounts that belong to the specified account holder. `account_holder[customer]` and `account_holder[account]` are mutually exclusive. AccountHolder *FinancialConnectionsAccountListAccountHolderParams `form:"account_holder"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // If present, only return accounts that were collected as part of the given session. Session *string `form:"session"` } +// AddExpand appends a new field to expand. +func (p *FinancialConnectionsAccountListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the details of an Financial Connections Account. type FinancialConnectionsAccountParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *FinancialConnectionsAccountParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Lists all owners for a given Account type FinancialConnectionsAccountListOwnersParams struct { ListParams `form:"*"` Account *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The ID of the ownership object to fetch owners from. Ownership *string `form:"ownership"` } +// AddExpand appends a new field to expand. +func (p *FinancialConnectionsAccountListOwnersParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Refreshes the data associated with a Financial Connections Account. type FinancialConnectionsAccountRefreshParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The list of account features that you would like to refresh. Features []*string `form:"features"` } +// AddExpand appends a new field to expand. +func (p *FinancialConnectionsAccountRefreshParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Disables your access to a Financial Connections Account. You will no longer be able to access data associated with the account (e.g. balances, transactions). type FinancialConnectionsAccountDisconnectParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *FinancialConnectionsAccountDisconnectParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The account holder that this account belongs to. diff --git a/financialconnections_session.go b/financialconnections_session.go index d23f69ff06..19477f7e31 100644 --- a/financialconnections_session.go +++ b/financialconnections_session.go @@ -47,6 +47,8 @@ type FinancialConnectionsSessionParams struct { Params `form:"*"` // The account holder to link accounts for. AccountHolder *FinancialConnectionsSessionAccountHolderParams `form:"account_holder"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Filters to restrict the kinds of accounts to collect. Filters *FinancialConnectionsSessionFiltersParams `form:"filters"` // List of data features that you would like to request access to. @@ -57,6 +59,11 @@ type FinancialConnectionsSessionParams struct { ReturnURL *string `form:"return_url"` } +// AddExpand appends a new field to expand. +func (p *FinancialConnectionsSessionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The account holder for whom accounts are collected in this session. type FinancialConnectionsSessionAccountHolder struct { // The ID of the Stripe account this account belongs to. Should only be present if `account_holder.type` is `account`. diff --git a/identity/verificationreport/client.go b/identity/verificationreport/client.go index 5c70c5e475..dbaf5d8fae 100644 --- a/identity/verificationreport/client.go +++ b/identity/verificationreport/client.go @@ -10,8 +10,8 @@ package verificationreport import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /identity/verification_reports APIs. diff --git a/identity/verificationsession/client.go b/identity/verificationsession/client.go index add46ba00f..c3d2dd1429 100644 --- a/identity/verificationsession/client.go +++ b/identity/verificationsession/client.go @@ -10,8 +10,8 @@ package verificationsession import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /identity/verification_sessions APIs. diff --git a/identity_verificationreport.go b/identity_verificationreport.go index 17e9bbc60d..c17009ea50 100644 --- a/identity_verificationreport.go +++ b/identity_verificationreport.go @@ -108,6 +108,13 @@ const ( // Retrieves an existing VerificationReport type IdentityVerificationReportParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *IdentityVerificationReportParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // List all verification reports. @@ -115,12 +122,19 @@ type IdentityVerificationReportListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return VerificationReports of this type Type *string `form:"type"` // Only return VerificationReports created by this VerificationSession ID. It is allowed to provide a VerificationIntent ID. VerificationSession *string `form:"verification_session"` } +// AddExpand appends a new field to expand. +func (p *IdentityVerificationReportListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Date of birth as it appears in the document. type IdentityVerificationReportDocumentDOB struct { // Numerical day between 1 and 31. diff --git a/identity_verificationsession.go b/identity_verificationsession.go index abf9ebcaa0..248bdcef89 100644 --- a/identity_verificationsession.go +++ b/identity_verificationsession.go @@ -104,6 +104,10 @@ type IdentityVerificationSessionOptionsParams struct { // Related guide: [Verify your users' identity documents](https://stripe.com/docs/identity/verify-identity-documents) type IdentityVerificationSessionParams struct { Params `form:"*"` + // 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"` // A set of options for the session's verification checks. Options *IdentityVerificationSessionOptionsParams `form:"options"` // The URL that the user will be redirected to upon completing the verification flow. @@ -112,20 +116,48 @@ type IdentityVerificationSessionParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *IdentityVerificationSessionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IdentityVerificationSessionParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of VerificationSessions type IdentityVerificationSessionListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return VerificationSessions with this status. [Learn more about the lifecycle of sessions](https://stripe.com/docs/identity/how-sessions-work). Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *IdentityVerificationSessionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A VerificationSession object can be canceled when it is in requires_input [status](https://stripe.com/docs/identity/how-sessions-work). // // Once canceled, future submission attempts are disabled. This cannot be undone. [Learn more](https://stripe.com/docs/identity/verification-sessions#cancel). type IdentityVerificationSessionCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *IdentityVerificationSessionCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Redact a VerificationSession to remove all collected information from Stripe. This will redact @@ -149,6 +181,13 @@ type IdentityVerificationSessionCancelParams struct { // [Learn more](https://stripe.com/docs/identity/verification-sessions#redact). type IdentityVerificationSessionRedactParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *IdentityVerificationSessionRedactParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // If present, this property tells you the last error encountered when processing the verification. diff --git a/invoice.go b/invoice.go index 7f6b1c2156..c795110f89 100644 --- a/invoice.go +++ b/invoice.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // The status of the most recent automated tax calculation for this invoice. @@ -138,24 +138,21 @@ type InvoiceShippingCostTaxTaxabilityReason string // List of values that InvoiceShippingCostTaxTaxabilityReason can take const ( - InvoiceShippingCostTaxTaxabilityReasonCustomerExempt InvoiceShippingCostTaxTaxabilityReason = "customer_exempt" - InvoiceShippingCostTaxTaxabilityReasonExcludedTerritory InvoiceShippingCostTaxTaxabilityReason = "excluded_territory" - InvoiceShippingCostTaxTaxabilityReasonJurisdictionUnsupported InvoiceShippingCostTaxTaxabilityReason = "jurisdiction_unsupported" - InvoiceShippingCostTaxTaxabilityReasonNotCollecting InvoiceShippingCostTaxTaxabilityReason = "not_collecting" - InvoiceShippingCostTaxTaxabilityReasonNotSubjectToTax InvoiceShippingCostTaxTaxabilityReason = "not_subject_to_tax" - InvoiceShippingCostTaxTaxabilityReasonNotSupported InvoiceShippingCostTaxTaxabilityReason = "not_supported" - InvoiceShippingCostTaxTaxabilityReasonPortionProductExempt InvoiceShippingCostTaxTaxabilityReason = "portion_product_exempt" - InvoiceShippingCostTaxTaxabilityReasonPortionReducedRated InvoiceShippingCostTaxTaxabilityReason = "portion_reduced_rated" - InvoiceShippingCostTaxTaxabilityReasonPortionStandardRated InvoiceShippingCostTaxTaxabilityReason = "portion_standard_rated" - InvoiceShippingCostTaxTaxabilityReasonProductExempt InvoiceShippingCostTaxTaxabilityReason = "product_exempt" - InvoiceShippingCostTaxTaxabilityReasonProductExemptHoliday InvoiceShippingCostTaxTaxabilityReason = "product_exempt_holiday" - InvoiceShippingCostTaxTaxabilityReasonProportionallyRated InvoiceShippingCostTaxTaxabilityReason = "proportionally_rated" - InvoiceShippingCostTaxTaxabilityReasonReducedRated InvoiceShippingCostTaxTaxabilityReason = "reduced_rated" - InvoiceShippingCostTaxTaxabilityReasonReverseCharge InvoiceShippingCostTaxTaxabilityReason = "reverse_charge" - InvoiceShippingCostTaxTaxabilityReasonStandardRated InvoiceShippingCostTaxTaxabilityReason = "standard_rated" - InvoiceShippingCostTaxTaxabilityReasonTaxableBasisReduced InvoiceShippingCostTaxTaxabilityReason = "taxable_basis_reduced" - InvoiceShippingCostTaxTaxabilityReasonVATExempt InvoiceShippingCostTaxTaxabilityReason = "vat_exempt" - InvoiceShippingCostTaxTaxabilityReasonZeroRated InvoiceShippingCostTaxTaxabilityReason = "zero_rated" + InvoiceShippingCostTaxTaxabilityReasonCustomerExempt InvoiceShippingCostTaxTaxabilityReason = "customer_exempt" + InvoiceShippingCostTaxTaxabilityReasonNotCollecting InvoiceShippingCostTaxTaxabilityReason = "not_collecting" + InvoiceShippingCostTaxTaxabilityReasonNotSubjectToTax InvoiceShippingCostTaxTaxabilityReason = "not_subject_to_tax" + InvoiceShippingCostTaxTaxabilityReasonNotSupported InvoiceShippingCostTaxTaxabilityReason = "not_supported" + InvoiceShippingCostTaxTaxabilityReasonPortionProductExempt InvoiceShippingCostTaxTaxabilityReason = "portion_product_exempt" + InvoiceShippingCostTaxTaxabilityReasonPortionReducedRated InvoiceShippingCostTaxTaxabilityReason = "portion_reduced_rated" + InvoiceShippingCostTaxTaxabilityReasonPortionStandardRated InvoiceShippingCostTaxTaxabilityReason = "portion_standard_rated" + InvoiceShippingCostTaxTaxabilityReasonProductExempt InvoiceShippingCostTaxTaxabilityReason = "product_exempt" + InvoiceShippingCostTaxTaxabilityReasonProductExemptHoliday InvoiceShippingCostTaxTaxabilityReason = "product_exempt_holiday" + InvoiceShippingCostTaxTaxabilityReasonProportionallyRated InvoiceShippingCostTaxTaxabilityReason = "proportionally_rated" + InvoiceShippingCostTaxTaxabilityReasonReducedRated InvoiceShippingCostTaxTaxabilityReason = "reduced_rated" + InvoiceShippingCostTaxTaxabilityReasonReverseCharge InvoiceShippingCostTaxTaxabilityReason = "reverse_charge" + InvoiceShippingCostTaxTaxabilityReasonStandardRated InvoiceShippingCostTaxTaxabilityReason = "standard_rated" + InvoiceShippingCostTaxTaxabilityReasonTaxableBasisReduced InvoiceShippingCostTaxTaxabilityReason = "taxable_basis_reduced" + InvoiceShippingCostTaxTaxabilityReasonZeroRated InvoiceShippingCostTaxTaxabilityReason = "zero_rated" ) // The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview) @@ -198,10 +195,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type InvoiceSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *InvoiceSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Settings for automatic tax lookup for this invoice preview. type InvoiceAutomaticTaxParams struct { // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. @@ -301,6 +305,15 @@ type InvoiceUpcomingInvoiceItemParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceUpcomingInvoiceItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice. // // Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount. @@ -320,6 +333,8 @@ type InvoiceUpcomingParams struct { CustomerDetails *InvoiceUpcomingCustomerDetailsParams `form:"customer_details"` // The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. This only works for coupons directly applied to the invoice. To apply a coupon to a subscription, you must use the `coupon` parameter instead. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. Discounts []*InvoiceDiscountParams `form:"discounts"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // List of invoice items to add or update in the upcoming invoice preview. InvoiceItems []*InvoiceUpcomingInvoiceItemParams `form:"invoice_items"` // The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. @@ -355,15 +370,20 @@ type InvoiceUpcomingParams struct { SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"` } +// AddExpand appends a new field to expand. +func (p *InvoiceUpcomingParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // AppendTo implements custom encoding logic for InvoiceUpcomingParams. -func (i *InvoiceUpcomingParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(i.SubscriptionBillingCycleAnchorNow) { +func (p *InvoiceUpcomingParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.SubscriptionBillingCycleAnchorNow) { body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "now") } - if BoolValue(i.SubscriptionBillingCycleAnchorUnchanged) { + if BoolValue(p.SubscriptionBillingCycleAnchorUnchanged) { body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "unchanged") } - if BoolValue(i.SubscriptionTrialEndNow) { + if BoolValue(p.SubscriptionTrialEndNow) { body.Add(form.FormatKey(append(keyParts, "subscription_trial_end")), "now") } } @@ -559,6 +579,15 @@ type InvoiceShippingCostShippingRateDataParams struct { Type *string `form:"type"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceShippingCostShippingRateDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Settings for the cost of shipping for this invoice. type InvoiceShippingCostParams struct { // The ID of the shipping rate to use for this order. @@ -607,9 +636,9 @@ type InvoiceParams struct { Currency *string `form:"currency"` // The ID of the customer who will be billed. Customer *string `form:"customer"` - // A list of up to 4 custom fields to be displayed on the invoice. + // A list of up to 4 custom fields to be displayed on the invoice. If a value for `custom_fields` is specified, the list specified will replace the existing custom field list on this invoice. Pass an empty string to remove previously-defined fields. CustomFields []*InvoiceCustomFieldParams `form:"custom_fields"` - // The number of days from when the invoice is created until it is due. Valid only for invoices where `collection_method=send_invoice`. + // The number of days from which the invoice is created until it is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices. DaysUntilDue *int64 `form:"days_until_due"` // ID of the default payment method for the invoice. It must belong to the customer associated with the invoice. If not set, defaults to the subscription's default payment method, if any, or to the default payment method in the customer's invoice settings. DefaultPaymentMethod *string `form:"default_payment_method"` @@ -621,14 +650,18 @@ type InvoiceParams struct { Description *string `form:"description"` // The coupons to redeem into discounts for the invoice. If not specified, inherits the discount from the invoice's customer. Pass an empty string to avoid inheriting any discounts. Discounts []*InvoiceDiscountParams `form:"discounts"` - // The date on which payment for this invoice is due. Valid only for invoices where `collection_method=send_invoice`. + // The date on which payment for this invoice is due. Only valid for invoices where `collection_method=send_invoice`. This field can only be updated on `draft` invoices. DueDate *int64 `form:"due_date"` // The date when this invoice is in effect. Same as `finalized_at` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the invoice PDF and receipt. EffectiveAt *int64 `form:"effective_at"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Footer to be displayed on the invoice. Footer *string `form:"footer"` // Revise an existing invoice. The new invoice will be created in `status=draft`. See the [revision documentation](https://stripe.com/docs/invoicing/invoice-revisions) for more details. FromInvoice *InvoiceFromInvoiceParams `form:"from_invoice"` + // 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 account (if any) for which the funds of the invoice payment are intended. If set, the invoice will be presented with the branding and support information of the specified account. See the [Invoices with Connect](https://stripe.com/docs/billing/invoices/connect) documentation for details. OnBehalfOf *string `form:"on_behalf_of"` // Configuration settings for the PaymentIntent that is generated when the invoice is finalized. @@ -649,9 +682,25 @@ type InvoiceParams struct { TransferData *InvoiceTransferDataParams `form:"transfer_data"` } +// AddExpand appends a new field to expand. +func (p *InvoiceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Stripe automatically creates and then attempts to collect payment on invoices for customers on subscriptions according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to attempt payment on an invoice out of the normal collection schedule or for some other reason, you can do so. type InvoicePayParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // In cases where the source used to pay the invoice has insufficient funds, passing `forgive=true` controls whether a charge should be attempted for the full amount available on the source, up to the amount to fully pay the invoice. This effectively forgives the difference between the amount available on the source and the amount due. // // Passing `forgive=false` will fail the charge if the source hasn't been pre-funded with the right amount. An example for this case is with ACH Credit Transfers and wires: if the amount wired is less than the amount due by a small amount, you might want to forgive the difference. Defaults to `false`. @@ -668,6 +717,11 @@ type InvoicePayParams struct { Source *string `form:"source"` } +// AddExpand appends a new field to expand. +func (p *InvoicePayParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Settings for automatic tax lookup for this invoice preview. type InvoiceUpcomingLinesAutomaticTaxParams struct { // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. @@ -786,6 +840,15 @@ type InvoiceUpcomingLinesInvoiceItemParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceUpcomingLinesInvoiceItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. type InvoiceUpcomingLinesSubscriptionItemBillingThresholdsParams struct { // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)) @@ -840,6 +903,15 @@ type InvoiceUpcomingLinesSubscriptionItemParams struct { TaxRates []*string `form:"tax_rates"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceUpcomingLinesSubscriptionItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // When retrieving an upcoming invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. type InvoiceUpcomingLinesParams struct { ListParams `form:"*"` @@ -855,6 +927,8 @@ type InvoiceUpcomingLinesParams struct { CustomerDetails *InvoiceUpcomingLinesCustomerDetailsParams `form:"customer_details"` // The coupons to redeem into discounts for the invoice preview. If not specified, inherits the discount from the customer or subscription. This only works for coupons directly applied to the invoice. To apply a coupon to a subscription, you must use the `coupon` parameter instead. Pass an empty string to avoid inheriting any discounts. To preview the upcoming invoice for a subscription that hasn't been created, use `coupon` instead. Discounts []*InvoiceUpcomingLinesDiscountParams `form:"discounts"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // List of invoice items to add or update in the upcoming invoice preview. InvoiceItems []*InvoiceUpcomingLinesInvoiceItemParams `form:"invoice_items"` // The identifier of the schedule whose upcoming invoice you'd like to retrieve. Cannot be used with subscription or subscription fields. @@ -890,15 +964,20 @@ type InvoiceUpcomingLinesParams struct { SubscriptionTrialFromPlan *bool `form:"subscription_trial_from_plan"` } +// AddExpand appends a new field to expand. +func (p *InvoiceUpcomingLinesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // AppendTo implements custom encoding logic for InvoiceUpcomingLinesParams. -func (i *InvoiceUpcomingLinesParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(i.SubscriptionBillingCycleAnchorNow) { +func (p *InvoiceUpcomingLinesParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.SubscriptionBillingCycleAnchorNow) { body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "now") } - if BoolValue(i.SubscriptionBillingCycleAnchorUnchanged) { + if BoolValue(p.SubscriptionBillingCycleAnchorUnchanged) { body.Add(form.FormatKey(append(keyParts, "subscription_billing_cycle_anchor")), "unchanged") } - if BoolValue(i.SubscriptionTrialEndNow) { + if BoolValue(p.SubscriptionTrialEndNow) { body.Add(form.FormatKey(append(keyParts, "subscription_trial_end")), "now") } } @@ -922,17 +1001,31 @@ type InvoiceListParams struct { Customer *string `form:"customer"` DueDate *int64 `form:"due_date"` DueDateRange *RangeQueryParams `form:"due_date"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The status of the invoice, one of `draft`, `open`, `paid`, `uncollectible`, or `void`. [Learn more](https://stripe.com/docs/billing/invoices/workflow#workflow-overview) Status *string `form:"status"` // Only return invoices for the subscription specified by this subscription ID. Subscription *string `form:"subscription"` } +// AddExpand appends a new field to expand. +func (p *InvoiceListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method. type InvoiceFinalizeInvoiceParams struct { Params `form:"*"` // Controls whether Stripe performs [automatic collection](https://stripe.com/docs/invoicing/integration/automatic-advancement-collection) of the invoice. If `false`, the invoice's state doesn't automatically advance without an explicit action. AutoAdvance *bool `form:"auto_advance"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceFinalizeInvoiceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Stripe will automatically send invoices to customers according to your [subscriptions settings](https://dashboard.stripe.com/account/billing/automatic). However, if you'd like to manually send an invoice to your customer out of the normal schedule, you can do so. When sending invoices that have already been paid, there will be no reference to the payment in the email. @@ -940,23 +1033,52 @@ type InvoiceFinalizeInvoiceParams struct { // Requests made in test-mode result in no emails being sent, despite sending an invoice.sent event. type InvoiceSendInvoiceParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceSendInvoiceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Marking an invoice as uncollectible is useful for keeping track of bad debts that can be written off for accounting purposes. type InvoiceMarkUncollectibleParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceMarkUncollectibleParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. type InvoiceVoidInvoiceParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *InvoiceVoidInvoiceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // When retrieving an invoice, you'll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items. type InvoiceListLinesParams struct { ListParams `form:"*"` Invoice *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *InvoiceListLinesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type InvoiceAutomaticTax struct { // Whether Stripe automatically computes tax on this invoice. Note that incompatible invoice items (invoice items with manually specified [tax rates](https://stripe.com/docs/api/tax_rates), negative amounts, or `tax_behavior=unspecified`) cannot be added to automatic tax invoices. Enabled bool `json:"enabled"` diff --git a/invoice/client.go b/invoice/client.go index 22f2cca88e..534c5b4231 100644 --- a/invoice/client.go +++ b/invoice/client.go @@ -10,8 +10,8 @@ package invoice import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /invoices APIs. diff --git a/invoiceitem.go b/invoiceitem.go index 782df8b7e6..77406111e3 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -6,6 +6,8 @@ package stripe +import "encoding/json" + // 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:"*"` @@ -13,12 +15,19 @@ type InvoiceItemListParams struct { 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return invoice items belonging to this invoice. If none is provided, all invoice items will be returned. If specifying an invoice, no customer identifier is needed. Invoice *string `form:"invoice"` // Set to `true` to only show pending invoice items, which are not yet attached to any invoices. Set to `false` to only show invoice items already attached to invoices. If unspecified, no filter is applied. Pending *bool `form:"pending"` } +// AddExpand appends a new field to expand. +func (p *InvoiceItemListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The coupons to redeem into discounts for the invoice item or invoice line item. type InvoiceItemDiscountParams struct { // ID of the coupon to create a new discount for. @@ -64,8 +73,12 @@ type InvoiceItemParams struct { Discountable *bool `form:"discountable"` // The coupons & existing discounts which apply to the invoice item or invoice line item. Item discounts are applied before invoice discounts. Pass an empty string to remove previously-defined discounts. Discounts []*InvoiceItemDiscountParams `form:"discounts"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The ID of an existing invoice to add this invoice item to. When left blank, the invoice item will be added to the next upcoming scheduled invoice. This is useful when adding invoice items in response to an invoice.created webhook. You can only add invoice items to draft invoices and there is a maximum of 250 items per invoice. Invoice *string `form:"invoice"` + // 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 *InvoiceItemPeriodParams `form:"period"` // The ID of the price object. @@ -88,6 +101,20 @@ type InvoiceItemParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// AddExpand appends a new field to expand. +func (p *InvoiceItemParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *InvoiceItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Invoice Items represent the component lines of an [invoice](https://stripe.com/docs/api/invoices). An invoice item is added to an // invoice by creating or updating it with an `invoice` field, at which point it will be included as // [an invoice line item](https://stripe.com/docs/api/invoices/line_item) within @@ -155,3 +182,22 @@ type InvoiceItemList struct { ListMeta Data []*InvoiceItem `json:"data"` } + +// UnmarshalJSON handles deserialization of an InvoiceItem. +// This custom unmarshaling is needed because the resulting +// property may be an id or the full struct if it was expanded. +func (i *InvoiceItem) UnmarshalJSON(data []byte) error { + if id, ok := ParseID(data); ok { + i.ID = id + return nil + } + + type invoiceItem InvoiceItem + var v invoiceItem + if err := json.Unmarshal(data, &v); err != nil { + return err + } + + *i = InvoiceItem(v) + return nil +} diff --git a/invoiceitem/client.go b/invoiceitem/client.go index 8c300fd71f..ae924f172f 100644 --- a/invoiceitem/client.go +++ b/invoiceitem/client.go @@ -10,8 +10,8 @@ package invoiceitem import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /invoiceitems APIs. diff --git a/invoicelineitem.go b/invoicelineitem.go index e3e5f5bb64..d9a9c53fce 100644 --- a/invoicelineitem.go +++ b/invoicelineitem.go @@ -54,7 +54,7 @@ type InvoiceLineItem struct { // Unique identifier for the object. ID string `json:"id"` // The ID of the [invoice item](https://stripe.com/docs/api/invoiceitems) associated with this line item if any. - InvoiceItem string `json:"invoice_item"` + InvoiceItem *InvoiceItem `json:"invoice_item"` // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. Livemode bool `json:"livemode"` // 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. Note that for line items with `type=subscription` this will reflect the metadata of the subscription that caused the line item to be created. @@ -73,9 +73,9 @@ type InvoiceLineItem struct { // The quantity of the subscription, if the line item is a subscription or a proration. Quantity int64 `json:"quantity"` // The subscription that the invoice item pertains to, if any. - Subscription string `json:"subscription"` + Subscription *Subscription `json:"subscription"` // The subscription item that generated this line item. Left empty if the line item is not an explicit result of a subscription. - SubscriptionItem string `json:"subscription_item"` + SubscriptionItem *SubscriptionItem `json:"subscription_item"` // The amount of tax calculated per tax rate for this line item TaxAmounts []*InvoiceTotalTaxAmount `json:"tax_amounts"` // The tax rates which apply to the line item. diff --git a/issuing/authorization/client.go b/issuing/authorization/client.go index 70c706695b..f309bdd5ea 100644 --- a/issuing/authorization/client.go +++ b/issuing/authorization/client.go @@ -10,8 +10,8 @@ package authorization import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /issuing/authorizations APIs. diff --git a/issuing/card/client.go b/issuing/card/client.go index 558c6d860e..e2c8da9594 100644 --- a/issuing/card/client.go +++ b/issuing/card/client.go @@ -10,8 +10,8 @@ package card import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /issuing/cards APIs. diff --git a/issuing/cardholder/client.go b/issuing/cardholder/client.go index 0f4387d8f0..4c139b023e 100644 --- a/issuing/cardholder/client.go +++ b/issuing/cardholder/client.go @@ -11,8 +11,8 @@ package cardholder import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /issuing/cardholders APIs. diff --git a/issuing/dispute/client.go b/issuing/dispute/client.go index 85ec593871..623fab9f89 100644 --- a/issuing/dispute/client.go +++ b/issuing/dispute/client.go @@ -10,8 +10,8 @@ package dispute import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /issuing/disputes APIs. diff --git a/issuing/transaction/client.go b/issuing/transaction/client.go index ec360b811c..3377a78958 100644 --- a/issuing/transaction/client.go +++ b/issuing/transaction/client.go @@ -10,8 +10,8 @@ package transaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /issuing/transactions APIs. diff --git a/issuing_authorization.go b/issuing_authorization.go index b0870c4ea3..8a4365cce3 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -82,13 +82,38 @@ type IssuingAuthorizationListParams struct { Created *int64 `form:"created"` // Only return authorizations 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"` // Only return authorizations with the given status. One of `pending`, `closed`, or `reversed`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *IssuingAuthorizationListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves an Issuing Authorization object. type IssuingAuthorizationParams struct { Params `form:"*"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *IssuingAuthorizationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingAuthorizationParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. @@ -97,12 +122,48 @@ type IssuingAuthorizationApproveParams struct { Params `form:"*"` // If the authorization's `pending_request.is_amount_controllable` property is `true`, you may provide this value to control how much to hold for the authorization. Must be positive (use [`decline`](https://stripe.com/docs/api/issuing/authorizations/decline) to decline an authorization request). Amount *int64 `form:"amount"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *IssuingAuthorizationApproveParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingAuthorizationApproveParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations) flow. // You can also respond directly to the webhook request to decline an authorization (preferred). More details can be found [here](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling). type IssuingAuthorizationDeclineParams struct { Params `form:"*"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *IssuingAuthorizationDeclineParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingAuthorizationDeclineParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). diff --git a/issuing_card.go b/issuing_card.go index ad347c70fe..8e06067e1b 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -133,6 +133,8 @@ type IssuingCardListParams struct { Created *int64 `form:"created"` // Only return cards that were issued during the given date interval. CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return cards that have the given expiration month. ExpMonth *int64 `form:"exp_month"` // Only return cards that have the given expiration year. @@ -145,6 +147,11 @@ type IssuingCardListParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *IssuingCardListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Customs information for the shipment. type IssuingCardShippingCustomsParams struct { // The Economic Operators Registration and Identification (EORI) number to use for Customs. Required for bulk shipments to Europe. @@ -195,8 +202,12 @@ type IssuingCardParams struct { // The [Cardholder](https://stripe.com/docs/api#issuing_cardholder_object) object with which the card will be associated. Cardholder *string `form:"cardholder"` // The currency for the card. - Currency *string `form:"currency"` - FinancialAccount *string `form:"financial_account"` + Currency *string `form:"currency"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + FinancialAccount *string `form:"financial_account"` + // 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 desired new PIN for this card. PIN *IssuingCardPINParams `form:"pin"` // The card this is meant to be a replacement for (if any). @@ -216,6 +227,20 @@ type IssuingCardParams struct { CancellationReason *string `form:"cancellation_reason"` } +// AddExpand appends a new field to expand. +func (p *IssuingCardParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingCardParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The desired new PIN for this card. type IssuingCardPINParams struct { // The card's desired new PIN, encrypted under Stripe's public key. diff --git a/issuing_cardholder.go b/issuing_cardholder.go index ddc766009e..467e9aa1ed 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -74,6 +74,8 @@ type IssuingCardholderListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return cardholders that have the given email address. Email *string `form:"email"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return cardholders that have the given phone number. PhoneNumber *string `form:"phone_number"` // Only return cardholders that have the given status. One of `active`, `inactive`, or `blocked`. @@ -82,6 +84,11 @@ type IssuingCardholderListParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *IssuingCardholderListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The cardholder's billing address. type IssuingCardholderBillingParams struct { // The cardholder's billing address. @@ -179,22 +186,41 @@ type IssuingCardholderParams struct { Company *IssuingCardholderCompanyParams `form:"company"` // The cardholder's email address. Email *string `form:"email"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Additional information about an `individual` cardholder. Individual *IssuingCardholderIndividualParams `form:"individual"` + // 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 cardholder's name. This will be printed on cards issued to them. The maximum length of this field is 24 characters. This field cannot contain any special characters or numbers. Name *string `form:"name"` - // The cardholder's phone number. This is required for all cardholders who will be creating EU cards. See the [3D Secure documentation](https://stripe.com/docs/issuing/3d-secure) for more details. + // The cardholder's phone number. This will be transformed to [E.164](https://en.wikipedia.org/wiki/E.164) if it is not provided in that format already. This is required for all cardholders who will be creating EU cards. See the [3D Secure documentation](https://stripe.com/docs/issuing/3d-secure#when-is-3d-secure-applied) for more details. PhoneNumber *string `form:"phone_number"` // The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`. // This changes the language of the [3D Secure flow](https://stripe.com/docs/issuing/3d-secure) and one-time password messages sent to the cardholder. PreferredLocales []*string `form:"preferred_locales"` // Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. SpendingControls *IssuingCardholderSpendingControlsParams `form:"spending_controls"` - // Specifies whether to permit authorizations on this cardholder's cards. + // Specifies whether to permit authorizations on this cardholder's cards. Defaults to `active`. Status *string `form:"status"` // One of `individual` or `company`. See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details. Type *string `form:"type"` } + +// AddExpand appends a new field to expand. +func (p *IssuingCardholderParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingCardholderParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type IssuingCardholderBilling struct { Address *Address `json:"address"` } diff --git a/issuing_dispute.go b/issuing_dispute.go index d696e23ce4..e6af4ec56c 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -86,12 +86,19 @@ type IssuingDisputeListParams struct { Created *int64 `form:"created"` // Select 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"` // Select Issuing disputes with the given status. Status *string `form:"status"` // Select the Issuing dispute for the given transaction. Transaction *string `form:"transaction"` } +// AddExpand appends a new field to expand. +func (p *IssuingDisputeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Evidence provided when `reason` is 'canceled'. type IssuingDisputeEvidenceCanceledParams struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. @@ -225,20 +232,57 @@ type IssuingDisputeTreasuryParams struct { // Creates an Issuing Dispute object. Individual pieces of evidence within the evidence object are optional at this point. Stripe only validates that required evidence is present during submission. Refer to [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence) for more details about evidence requirements. type IssuingDisputeParams struct { Params `form:"*"` - // The dispute amount in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). + // The dispute amount in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). If not set, defaults to the full transaction amount. Amount *int64 `form:"amount"` // Evidence provided for the dispute. Evidence *IssuingDisputeEvidenceParams `form:"evidence"` + // 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 ID of the issuing transaction to create a dispute for. For transaction on Treasury FinancialAccounts, use `treasury.received_debit`. Transaction *string `form:"transaction"` // Params for disputes related to Treasury FinancialAccounts Treasury *IssuingDisputeTreasuryParams `form:"treasury"` } +// AddExpand appends a new field to expand. +func (p *IssuingDisputeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingDisputeParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Submits an Issuing Dispute to the card network. Stripe validates that all evidence fields required for the dispute's reason are present. For more details, see [Dispute reasons and evidence](https://stripe.com/docs/issuing/purchases/disputes#dispute-reasons-and-evidence). type IssuingDisputeSubmitParams struct { Params `form:"*"` + // 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"` } + +// AddExpand appends a new field to expand. +func (p *IssuingDisputeSubmitParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingDisputeSubmitParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type IssuingDisputeEvidenceCanceled struct { // (ID of a [file upload](https://stripe.com/docs/guides/file-upload)) Additional documentation supporting the dispute. AdditionalDocumentation *File `json:"additional_documentation"` diff --git a/issuing_transaction.go b/issuing_transaction.go index dab16c2522..9210749eac 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -59,13 +59,38 @@ type IssuingTransactionListParams struct { 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"` // Only return transactions that have the given type. One of `capture` or `refund`. Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *IssuingTransactionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves an Issuing Transaction object. type IssuingTransactionParams struct { Params `form:"*"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *IssuingTransactionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *IssuingTransactionParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // Detailed breakdown of amount components. These amounts are denominated in `currency` and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal). diff --git a/lineitem.go b/lineitem.go index aa362994b4..4c40acbe9d 100644 --- a/lineitem.go +++ b/lineitem.go @@ -11,24 +11,21 @@ type LineItemTaxTaxabilityReason string // List of values that LineItemTaxTaxabilityReason can take const ( - LineItemTaxTaxabilityReasonCustomerExempt LineItemTaxTaxabilityReason = "customer_exempt" - LineItemTaxTaxabilityReasonExcludedTerritory LineItemTaxTaxabilityReason = "excluded_territory" - LineItemTaxTaxabilityReasonJurisdictionUnsupported LineItemTaxTaxabilityReason = "jurisdiction_unsupported" - LineItemTaxTaxabilityReasonNotCollecting LineItemTaxTaxabilityReason = "not_collecting" - LineItemTaxTaxabilityReasonNotSubjectToTax LineItemTaxTaxabilityReason = "not_subject_to_tax" - LineItemTaxTaxabilityReasonNotSupported LineItemTaxTaxabilityReason = "not_supported" - LineItemTaxTaxabilityReasonPortionProductExempt LineItemTaxTaxabilityReason = "portion_product_exempt" - LineItemTaxTaxabilityReasonPortionReducedRated LineItemTaxTaxabilityReason = "portion_reduced_rated" - LineItemTaxTaxabilityReasonPortionStandardRated LineItemTaxTaxabilityReason = "portion_standard_rated" - LineItemTaxTaxabilityReasonProductExempt LineItemTaxTaxabilityReason = "product_exempt" - LineItemTaxTaxabilityReasonProductExemptHoliday LineItemTaxTaxabilityReason = "product_exempt_holiday" - LineItemTaxTaxabilityReasonProportionallyRated LineItemTaxTaxabilityReason = "proportionally_rated" - LineItemTaxTaxabilityReasonReducedRated LineItemTaxTaxabilityReason = "reduced_rated" - LineItemTaxTaxabilityReasonReverseCharge LineItemTaxTaxabilityReason = "reverse_charge" - LineItemTaxTaxabilityReasonStandardRated LineItemTaxTaxabilityReason = "standard_rated" - LineItemTaxTaxabilityReasonTaxableBasisReduced LineItemTaxTaxabilityReason = "taxable_basis_reduced" - LineItemTaxTaxabilityReasonVATExempt LineItemTaxTaxabilityReason = "vat_exempt" - LineItemTaxTaxabilityReasonZeroRated LineItemTaxTaxabilityReason = "zero_rated" + LineItemTaxTaxabilityReasonCustomerExempt LineItemTaxTaxabilityReason = "customer_exempt" + LineItemTaxTaxabilityReasonNotCollecting LineItemTaxTaxabilityReason = "not_collecting" + LineItemTaxTaxabilityReasonNotSubjectToTax LineItemTaxTaxabilityReason = "not_subject_to_tax" + LineItemTaxTaxabilityReasonNotSupported LineItemTaxTaxabilityReason = "not_supported" + LineItemTaxTaxabilityReasonPortionProductExempt LineItemTaxTaxabilityReason = "portion_product_exempt" + LineItemTaxTaxabilityReasonPortionReducedRated LineItemTaxTaxabilityReason = "portion_reduced_rated" + LineItemTaxTaxabilityReasonPortionStandardRated LineItemTaxTaxabilityReason = "portion_standard_rated" + LineItemTaxTaxabilityReasonProductExempt LineItemTaxTaxabilityReason = "product_exempt" + LineItemTaxTaxabilityReasonProductExemptHoliday LineItemTaxTaxabilityReason = "product_exempt_holiday" + LineItemTaxTaxabilityReasonProportionallyRated LineItemTaxTaxabilityReason = "proportionally_rated" + LineItemTaxTaxabilityReasonReducedRated LineItemTaxTaxabilityReason = "reduced_rated" + LineItemTaxTaxabilityReasonReverseCharge LineItemTaxTaxabilityReason = "reverse_charge" + LineItemTaxTaxabilityReasonStandardRated LineItemTaxTaxabilityReason = "standard_rated" + LineItemTaxTaxabilityReasonTaxableBasisReduced LineItemTaxTaxabilityReason = "taxable_basis_reduced" + LineItemTaxTaxabilityReasonZeroRated LineItemTaxTaxabilityReason = "zero_rated" ) // The discounts applied to the line item. diff --git a/loginlink.go b/loginlink.go index 4eba08c648..2cd966ffc4 100644 --- a/loginlink.go +++ b/loginlink.go @@ -12,6 +12,13 @@ package stripe type LoginLinkParams struct { Params `form:"*"` Account *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *LoginLinkParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Login Links are single-use login link for an Express account to access their Stripe dashboard. diff --git a/loginlink/client.go b/loginlink/client.go index e22ce114eb..1fac962a05 100644 --- a/loginlink/client.go +++ b/loginlink/client.go @@ -11,7 +11,7 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /accounts/{account}/login_links APIs. diff --git a/mandate.go b/mandate.go index c6c935f09c..4e23c00295 100644 --- a/mandate.go +++ b/mandate.go @@ -93,7 +93,15 @@ const ( // Retrieves a Mandate object. type MandateParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *MandateParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type MandateCustomerAcceptanceOffline struct{} type MandateCustomerAcceptanceOnline struct { // The IP address from which the Mandate was accepted by the customer. diff --git a/mandate/client.go b/mandate/client.go index ab0913169b..0c9b84105d 100644 --- a/mandate/client.go +++ b/mandate/client.go @@ -10,7 +10,7 @@ package mandate import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /mandates APIs. diff --git a/paymentintent.go b/paymentintent.go index aed192f01b..256fc077dd 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -765,10 +765,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type PaymentIntentSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *PaymentIntentSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // When enabled, this PaymentIntent will accept payment methods that you have enabled in the Dashboard and are compatible with this PaymentIntent's other parameters. type PaymentIntentAutomaticPaymentMethodsParams struct { // Controls whether this PaymentIntent will accept redirect-based payment methods. @@ -949,6 +956,15 @@ type PaymentIntentPaymentMethodDataParams struct { Zip *PaymentIntentPaymentMethodDataZipParams `form:"zip"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentIntentPaymentMethodDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Additional fields for Mandate creation type PaymentIntentPaymentMethodOptionsACSSDebitMandateOptionsParams struct { // A URL for custom mandate text to render during confirmation step. @@ -1619,6 +1635,12 @@ type PaymentIntentRadarOptionsParams struct { // For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). type PaymentIntentTransferDataParams struct { // The amount that will be transferred automatically when a charge succeeds. + // The amount is capped at the total transaction amount and if no amount is set, + // the full amount is transferred. + // + // If you intend to collect a fee and you need a more robust reporting experience, using + // [application_fee_amount](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-application_fee_amount) + // might be a better fit for your integration. Amount *int64 `form:"amount"` // If specified, successful charges will be attributed to the destination // account for tax reporting, and the funds from charges will be transferred @@ -1662,13 +1684,19 @@ type PaymentIntentParams struct { Customer *string `form:"customer"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // ID of the mandate to be used for this payment. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). Mandate *string `form:"mandate"` // This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/payment_intents/create#create_payment_intent-confirm). MandateData *PaymentIntentMandateDataParams `form:"mandate_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. 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 Stripe account ID for which these funds are intended. For details, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). OnBehalfOf *string `form:"on_behalf_of"` - // ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://stripe.com/docs/payments/payment-methods/transitioning#compatibility) object) to attach to this PaymentIntent. + // ID of the payment method (a PaymentMethod, Card, or [compatible Source](https://stripe.com/docs/payments/payment-methods#compatibility) object) to attach to this PaymentIntent. + // + // If neither the `payment_method` parameter nor the `source` parameter are provided with `confirm=true`, `source` will be automatically populated with `customer.default_source` to improve the migration experience for users of the Charges API. We recommend that you explicitly provide the `payment_method` going forward. PaymentMethod *string `form:"payment_method"` // If provided, this hash will be used to create a PaymentMethod. The new PaymentMethod will appear // in the [payment_method](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method) @@ -1676,7 +1704,7 @@ type PaymentIntentParams struct { PaymentMethodData *PaymentIntentPaymentMethodDataParams `form:"payment_method_data"` // Payment-method-specific configuration for this PaymentIntent. PaymentMethodOptions *PaymentIntentPaymentMethodOptionsParams `form:"payment_method_options"` - // The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. Use automatic_payment_methods to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods). + // The list of payment method types (e.g. card) that this PaymentIntent is allowed to use. If this is not provided, defaults to ["card"]. Use automatic_payment_methods to manage payment methods from the [Stripe Dashboard](https://dashboard.stripe.com/settings/payment_methods). PaymentMethodTypes []*string `form:"payment_method_types"` // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. RadarOptions *PaymentIntentRadarOptionsParams `form:"radar_options"` @@ -1711,6 +1739,20 @@ type PaymentIntentParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// AddExpand appends a new field to expand. +func (p *PaymentIntentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentIntentParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of PaymentIntents. type PaymentIntentListParams struct { ListParams `form:"*"` @@ -1720,6 +1762,13 @@ type PaymentIntentListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return PaymentIntents for the customer specified by this customer ID. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PaymentIntentListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information. @@ -1757,6 +1806,8 @@ type PaymentIntentConfirmParams struct { CaptureMethod *string `form:"capture_method"` // Set to `true` to fail the payment attempt if the PaymentIntent transitions into `requires_action`. This parameter is intended for simpler integrations that do not handle customer actions, like [saving cards without authentication](https://stripe.com/docs/payments/save-card-without-authentication). ErrorOnRequiresAction *bool `form:"error_on_requires_action"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // ID of the mandate to be used for this payment. Mandate *string `form:"mandate"` // This hash contains details about the Mandate to create @@ -1793,6 +1844,11 @@ type PaymentIntentConfirmParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// AddExpand appends a new field to expand. +func (p *PaymentIntentConfirmParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A PaymentIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_capture, requires_confirmation, requires_action or, [in rare cases](https://stripe.com/docs/payments/intents), processing. // // Once canceled, no additional charges will be made by the PaymentIntent and any operations on the PaymentIntent will fail with an error. For PaymentIntents with a status of requires_capture, the remaining amount_capturable will automatically be refunded. @@ -1802,6 +1858,13 @@ type PaymentIntentCancelParams struct { Params `form:"*"` // Reason for canceling this PaymentIntent. Possible values are `duplicate`, `fraudulent`, `requested_by_customer`, or `abandoned` CancellationReason *string `form:"cancellation_reason"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PaymentIntentCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Capture the funds of an existing uncaptured PaymentIntent when its status is requires_capture. @@ -1815,6 +1878,10 @@ type PaymentIntentCaptureParams struct { AmountToCapture *int64 `form:"amount_to_capture"` // 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. The amount of the application fee collected will be capped at the total payment amount. For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). ApplicationFeeAmount *int64 `form:"application_fee_amount"` + // 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"` // For non-card charges, you can use this value as the complete description that appears on your customers' statements. Must contain at least one letter, maximum 22 characters. StatementDescriptor *string `form:"statement_descriptor"` // Provides information about a card payment that customers see on their statements. Concatenated with the prefix (shortened descriptor) or statement descriptor that's set on the account to form the complete statement descriptor. Maximum 22 characters for the concatenated descriptor. @@ -1824,6 +1891,20 @@ type PaymentIntentCaptureParams struct { TransferData *PaymentIntentTransferDataParams `form:"transfer_data"` } +// AddExpand appends a new field to expand. +func (p *PaymentIntentCaptureParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentIntentCaptureParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The parameters used to automatically create a Transfer when the payment is captured. // For more information, see the PaymentIntents [use case for connected accounts](https://stripe.com/docs/payments/connected-accounts). type PaymentIntentIncrementAuthorizationTransferDataParams struct { @@ -1863,6 +1944,10 @@ type PaymentIntentIncrementAuthorizationParams struct { ApplicationFeeAmount *int64 `form:"application_fee_amount"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // 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"` // For non-card charges, you can use this value as the complete description that appears on your customers' statements. Must contain at least one letter, maximum 22 characters. StatementDescriptor *string `form:"statement_descriptor"` // The parameters used to automatically create a Transfer when the payment is captured. @@ -1870,6 +1955,20 @@ type PaymentIntentIncrementAuthorizationParams struct { TransferData *PaymentIntentIncrementAuthorizationTransferDataParams `form:"transfer_data"` } +// AddExpand appends a new field to expand. +func (p *PaymentIntentIncrementAuthorizationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentIntentIncrementAuthorizationParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Verifies microdeposits on a PaymentIntent object. type PaymentIntentVerifyMicrodepositsParams struct { Params `form:"*"` @@ -1877,6 +1976,13 @@ type PaymentIntentVerifyMicrodepositsParams struct { Amounts []*int64 `form:"amounts"` // A six-character code starting with SM present in the microdeposit sent to the bank account. DescriptorCode *string `form:"descriptor_code"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PaymentIntentVerifyMicrodepositsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Manually reconcile the remaining amount for a customer_balance PaymentIntent. @@ -1892,7 +1998,15 @@ type PaymentIntentApplyCustomerBalanceParams struct { Amount *int64 `form:"amount"` // 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *PaymentIntentApplyCustomerBalanceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type PaymentIntentAmountDetailsTip struct { // Portion of the amount that corresponds to a tip. Amount int64 `json:"amount"` diff --git a/paymentintent/client.go b/paymentintent/client.go index 3020647658..2470d16f1c 100644 --- a/paymentintent/client.go +++ b/paymentintent/client.go @@ -10,8 +10,8 @@ package paymentintent import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /payment_intents APIs. diff --git a/paymentlink.go b/paymentlink.go index c75f472e12..78a853edd8 100644 --- a/paymentlink.go +++ b/paymentlink.go @@ -150,6 +150,13 @@ type PaymentLinkListParams struct { ListParams `form:"*"` // Only return payment links that are active or inactive (e.g., pass `false` to list all inactive payment links). Active *bool `form:"active"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PaymentLinkListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Configuration when `type=hosted_confirmation`. @@ -297,6 +304,15 @@ type PaymentLinkInvoiceCreationInvoiceDataParams struct { RenderingOptions *PaymentLinkInvoiceCreationInvoiceDataRenderingOptionsParams `form:"rendering_options"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentLinkInvoiceCreationInvoiceDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Generate a post-purchase Invoice for one-time payments. type PaymentLinkInvoiceCreationParams struct { // Whether the feature is enabled @@ -418,10 +434,14 @@ type PaymentLinkParams struct { CustomFields []*PaymentLinkCustomFieldParams `form:"custom_fields"` // Display additional text for your customers using custom text. CustomText *PaymentLinkCustomTextParams `form:"custom_text"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Generate a post-purchase Invoice for one-time payments. InvoiceCreation *PaymentLinkInvoiceCreationParams `form:"invoice_creation"` // The line items representing what is being sold. Each line item represents an item being sold. Up to 20 line items are supported. LineItems []*PaymentLinkLineItemParams `form:"line_items"` + // 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 associated with this Payment Link will automatically be copied to [checkout sessions](https://stripe.com/docs/api/checkout/sessions) created by this payment link. + Metadata map[string]string `form:"metadata"` // The account on behalf of which to charge. OnBehalfOf *string `form:"on_behalf_of"` // A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in `payment` mode. @@ -432,7 +452,7 @@ type PaymentLinkParams struct { // // If you'd like information on how to collect a payment method outside of Checkout, read the guide on [configuring subscriptions with a free trial](https://stripe.com/docs/payments/checkout/free-trials). PaymentMethodCollection *string `form:"payment_method_collection"` - // The list of payment method types that customers can use. Pass an empty string to enable dynamic payment methods that use your [payment method settings](https://dashboard.stripe.com/settings/payment_methods). + // The list of payment method types that customers can use. If no value is passed, Stripe will dynamically show relevant payment methods from your [payment method settings](https://dashboard.stripe.com/settings/payment_methods) (20+ payment methods [supported](https://stripe.com/docs/payments/payment-methods/integration-options#payment-method-product-support)). PaymentMethodTypes []*string `form:"payment_method_types"` // Controls phone number collection settings during checkout. // @@ -452,11 +472,33 @@ type PaymentLinkParams struct { TransferData *PaymentLinkTransferDataParams `form:"transfer_data"` } +// AddExpand appends a new field to expand. +func (p *PaymentLinkParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentLinkParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // When retrieving a payment link, 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. type PaymentLinkListLineItemsParams struct { ListParams `form:"*"` PaymentLink *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PaymentLinkListLineItemsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } + type PaymentLinkAfterCompletionHostedConfirmation struct { // The custom message that is displayed to the customer after the purchase is complete. CustomMessage string `json:"custom_message"` diff --git a/paymentlink/client.go b/paymentlink/client.go index 05a9fa5b3d..0636122217 100644 --- a/paymentlink/client.go +++ b/paymentlink/client.go @@ -10,8 +10,8 @@ package paymentlink import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /payment_links APIs. diff --git a/paymentmethod.go b/paymentmethod.go index 57ed37a705..81fc9fc168 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -406,7 +406,7 @@ type PaymentMethodSofortParams struct { // If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method. type PaymentMethodUSBankAccountParams struct { - // Bank account type. + // Account holder type: individual or company. AccountHolderType *string `form:"account_holder_type"` // Account number of the bank account. AccountNumber *string `form:"account_number"` @@ -457,6 +457,8 @@ type PaymentMethodParams struct { CustomerBalance *PaymentMethodCustomerBalanceParams `form:"customer_balance"` // If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method. EPS *PaymentMethodEPSParams `form:"eps"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method. FPX *PaymentMethodFPXParams `form:"fpx"` // If this is a `giropay` PaymentMethod, this hash contains details about the Giropay payment method. @@ -473,6 +475,8 @@ type PaymentMethodParams struct { Konbini *PaymentMethodKonbiniParams `form:"konbini"` // If this is an `Link` PaymentMethod, this hash contains details about the Link payment method. Link *PaymentMethodLinkParams `form:"link"` + // 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"` // If this is an `oxxo` PaymentMethod, this hash contains details about the OXXO payment method. OXXO *PaymentMethodOXXOParams `form:"oxxo"` // If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method. @@ -506,15 +510,36 @@ type PaymentMethodParams struct { PaymentMethod *string `form:"payment_method"` } +// AddExpand appends a new field to expand. +func (p *PaymentMethodParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentMethodParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of PaymentMethods for Treasury flows. If you want to list the PaymentMethods attached to a Customer for payments, you should use the [List a Customer's PaymentMethods](https://stripe.com/docs/api/payment_methods/customer_list) API instead. type PaymentMethodListParams struct { ListParams `form:"*"` // The ID of the customer whose PaymentMethods will be retrieved. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // An optional filter on the list, based on the object `type` field. Without the filter, the list includes all current and future payment method types. If your integration expects only one type of payment method in the response, make sure to provide a type value in the request. Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *PaymentMethodListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Attaches a PaymentMethod object to a Customer. // // To attach a new PaymentMethod to a customer for future payments, we recommend you use a [SetupIntent](https://stripe.com/docs/api/setup_intents) @@ -532,12 +557,27 @@ type PaymentMethodAttachParams struct { Params `form:"*"` // The ID of the customer to which to attach the PaymentMethod. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PaymentMethodAttachParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer. type PaymentMethodDetachParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *PaymentMethodDetachParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type PaymentMethodACSSDebit struct { // Name of the bank associated with the bank account. BankName string `json:"bank_name"` diff --git a/paymentmethod/client.go b/paymentmethod/client.go index becf22ac7f..9d81bb3448 100644 --- a/paymentmethod/client.go +++ b/paymentmethod/client.go @@ -10,8 +10,8 @@ package paymentmethod import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /payment_methods APIs. diff --git a/paymentsource.go b/paymentsource.go index 1e7fbd1bef..95a19f7ed1 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -9,7 +9,7 @@ package stripe import ( "encoding/json" "fmt" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) type PaymentSourceType string @@ -26,10 +26,17 @@ const ( type PaymentSourceListParams struct { ListParams `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Filter sources according to a particular object type. Object *string `form:"object"` } +// AddExpand appends a new field to expand. +func (p *PaymentSourceListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // PaymentSourceSourceParams is a union struct used to describe an // arbitrary payment source. type PaymentSourceSourceParams struct { @@ -92,10 +99,14 @@ type PaymentSourceParams struct { AddressState *string `form:"address_state"` // ZIP or postal code. AddressZip *string `form:"address_zip"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Two digit number representing the card's expiration month. ExpMonth *string `form:"exp_month"` // Four digit number representing the card's expiration year. ExpYear *string `form:"exp_year"` + // 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"` // Cardholder name. Name *string `form:"name"` Owner *PaymentSourceOwnerParams `form:"owner"` @@ -103,6 +114,21 @@ type PaymentSourceParams struct { Source *PaymentSourceSourceParams `form:"*"` // PaymentSourceSourceParams has custom encoding so brought to top level with "*" Validate *bool `form:"validate"` } + +// AddExpand appends a new field to expand. +func (p *PaymentSourceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PaymentSourceParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type PaymentSourceOwnerParams struct { // Owner's address. Address *AddressParams `form:"address"` @@ -119,9 +145,17 @@ type PaymentSourceVerifyParams struct { Params `form:"*"` Customer *string `form:"-"` // Included in URL // Two positive integers, in *cents*, equal to the values of the microdeposits sent to the bank account. - Amounts [2]int64 `form:"amounts"` // Amounts is used when verifying bank accounts - Values []*string `form:"values"` // Values is used when verifying sources + Amounts [2]int64 `form:"amounts"` // Amounts is used when verifying bank accounts + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + Values []*string `form:"values"` // Values is used when verifying sources } + +// AddExpand appends a new field to expand. +func (p *PaymentSourceVerifyParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type PaymentSource struct { APIResource BankAccount *BankAccount `json:"-"` diff --git a/paymentsource/client.go b/paymentsource/client.go index 1cf46fae02..a938b31916 100644 --- a/paymentsource/client.go +++ b/paymentsource/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /customers/{customer}/sources APIs. diff --git a/payout.go b/payout.go index 72d8537ac0..416b8ad0a7 100644 --- a/payout.go +++ b/payout.go @@ -99,6 +99,10 @@ type PayoutParams struct { Description *string `form:"description"` // The ID of a bank account or a card to send the payout to. If no destination is supplied, the default external account for the specified currency will be used. Destination *string `form:"destination"` + // 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 method used to send this payout, which can be `standard` or `instant`. `instant` is only supported for payouts to debit cards. (See [Instant payouts for marketplaces for more information](https://stripe.com/blog/instant-payouts-for-marketplaces).) Method *string `form:"method"` // The balance type of your Stripe balance to draw this payout from. Balances for different payment sources are kept separately. You can find the amounts with the balances API. One of `bank_account`, `card`, or `fpx`. @@ -107,6 +111,20 @@ type PayoutParams struct { StatementDescriptor *string `form:"statement_descriptor"` } +// AddExpand appends a new field to expand. +func (p *PayoutParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PayoutParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of existing payouts sent to third-party bank accounts or that Stripe has sent you. The payouts are returned in sorted order, with the most recently created payouts appearing first. type PayoutListParams struct { ListParams `form:"*"` @@ -116,15 +134,40 @@ type PayoutListParams struct { 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. + Expand []*string `form:"expand"` // Only return payouts that have the given status: `pending`, `paid`, `failed`, or `canceled`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *PayoutListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Reverses a payout by debiting the destination bank account. Only payouts for connected accounts to US bank accounts may be reversed at this time. If the payout is in the pending status, /v1/payouts/:id/cancel should be used instead. // // By requesting a reversal via /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account has authorized the debit on the bank account and that no other authorization is required. type PayoutReverseParams struct { Params `form:"*"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *PayoutReverseParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PayoutReverseParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // A `Payout` object is created when you receive funds from Stripe, or when you diff --git a/payout/client.go b/payout/client.go index 05ad548bca..acc7394af4 100644 --- a/payout/client.go +++ b/payout/client.go @@ -10,8 +10,8 @@ package payout import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /payouts APIs. diff --git a/person.go b/person.go index 7905a3507e..4ed9613743 100644 --- a/person.go +++ b/person.go @@ -84,10 +84,17 @@ type PersonListRelationshipParams struct { type PersonListParams struct { ListParams `form:"*"` Account *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Filters on the list of people returned based on the person's relationship to the account's company. Relationship *PersonListRelationshipParams `form:"relationship"` } +// AddExpand appends a new field to expand. +func (p *PersonListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The Kana variation of the person's address (Japan only). type PersonAddressKanaParams struct { // City or ward. @@ -210,6 +217,8 @@ type PersonParams struct { Documents *PersonDocumentsParams `form:"documents"` // The person's email address. Email *string `form:"email"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The person's first name. FirstName *string `form:"first_name"` // The Kana variation of the person's first name (Japan only). @@ -232,6 +241,8 @@ type PersonParams struct { LastNameKanji *string `form:"last_name_kanji"` // The person's maiden name. MaidenName *string `form:"maiden_name"` + // 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 country where the person is a national. Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)), or "XX" if unavailable. Nationality *string `form:"nationality"` // A [person token](https://stripe.com/docs/connect/account-tokens), used to securely provide details to the person. @@ -250,6 +261,20 @@ type PersonParams struct { Verification *PersonVerificationParams `form:"verification"` } +// AddExpand appends a new field to expand. +func (p *PersonParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PersonParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The Kana variation of the person's address (Japan only). type PersonAddressKana struct { // City/Ward. diff --git a/person/client.go b/person/client.go index b74811cb42..ea9f56a55f 100644 --- a/person/client.go +++ b/person/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /accounts/{account}/persons APIs. diff --git a/plan.go b/plan.go index 094ec198e8..4b7a2fc316 100644 --- a/plan.go +++ b/plan.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" "strconv" ) @@ -79,10 +79,17 @@ type PlanListParams struct { Created *int64 `form:"created"` // A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return plans for the given product. Product *string `form:"product"` } +// AddExpand appends a new field to expand. +func (p *PlanListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The product the plan belongs to. This cannot be changed once it has been used in a subscription or subscription schedule. type PlanProductParams struct { // Whether the product is currently available for purchase. Defaults to `true`. @@ -103,6 +110,15 @@ type PlanProductParams struct { UnitLabel *string `form:"unit_label"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PlanProductParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. type PlanTierParams struct { Params `form:"*"` @@ -142,7 +158,7 @@ type PlanTransformUsageParams struct { // You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration. type PlanParams struct { Params `form:"*"` - // Whether the plan is currently available for new subscriptions. + // Whether the plan is currently available for new subscriptions. Defaults to `true`. Active *bool `form:"active"` // Specifies a usage aggregation strategy for plans of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. Defaults to `sum`. AggregateUsage *string `form:"aggregate_usage"` @@ -154,15 +170,20 @@ type PlanParams struct { BillingScheme *string `form:"billing_scheme"` // 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes. ID *string `form:"id"` // Specifies billing frequency. Either `day`, `week`, `month` or `year`. Interval *string `form:"interval"` // The number of intervals between subscription billings. For example, `interval=month` and `interval_count=3` bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). IntervalCount *int64 `form:"interval_count"` + // 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"` // A brief description of the plan, hidden from customers. - Nickname *string `form:"nickname"` - Product *PlanProductParams `form:"product"` + Nickname *string `form:"nickname"` + // The product the plan belongs to. This cannot be changed once it has been used in a subscription or subscription schedule. + Product *PlanProductParams `form:"product"` // Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. Tiers []*PlanTierParams `form:"tiers"` // Defines if the tiering price should be `graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows. @@ -175,6 +196,20 @@ type PlanParams struct { UsageType *string `form:"usage_type"` } +// AddExpand appends a new field to expand. +func (p *PlanParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PlanParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Each element represents a pricing tier. This parameter requires `billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`. type PlanTier struct { // Price for the entire tier. diff --git a/plan/client.go b/plan/client.go index 0614e15c64..4746b1f006 100644 --- a/plan/client.go +++ b/plan/client.go @@ -10,8 +10,8 @@ package plan import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /plans APIs. diff --git a/price.go b/price.go index 549e0af666..c35fec624f 100644 --- a/price.go +++ b/price.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // Describes how to compute the price per period. Either `per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes. @@ -104,10 +104,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type PriceSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *PriceSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Only return prices with these recurring fields. type PriceListRecurringParams struct { // Filter by billing frequency. Either `day`, `week`, `month` or `year`. @@ -127,6 +134,8 @@ type PriceListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return prices for the given currency. Currency *string `form:"currency"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return the price with these lookup_keys, if any exist. LookupKeys []*string `form:"lookup_keys"` // Only return prices for the given product. @@ -137,6 +146,11 @@ type PriceListParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *PriceListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. type PriceCurrencyOptionsCustomUnitAmountParams struct { // Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. @@ -217,6 +231,15 @@ type PriceProductDataParams struct { UnitLabel *string `form:"unit_label"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PriceProductDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The recurring components of a price such as `interval` and `usage_type`. type PriceRecurringParams struct { // Specifies a usage aggregation strategy for prices of `usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. Defaults to `sum`. @@ -274,8 +297,12 @@ type PriceParams struct { CurrencyOptions map[string]*PriceCurrencyOptionsParams `form:"currency_options"` // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. CustomUnitAmount *PriceCustomUnitAmountParams `form:"custom_unit_amount"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters. LookupKey *string `form:"lookup_key"` + // 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"` // A brief description of the price, hidden from customers. Nickname *string `form:"nickname"` // The ID of the product that this price will belong to. @@ -300,6 +327,20 @@ type PriceParams struct { UnitAmountDecimal *float64 `form:"unit_amount_decimal,high_precision"` } +// AddExpand appends a new field to expand. +func (p *PriceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PriceParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. type PriceCurrencyOptionsCustomUnitAmount struct { // The maximum unit amount the customer can specify for this item. diff --git a/price/client.go b/price/client.go index ebeb183838..cff87d01df 100644 --- a/price/client.go +++ b/price/client.go @@ -10,8 +10,8 @@ package price import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /prices APIs. diff --git a/product.go b/product.go index b4bf44116c..03c21ea1b2 100644 --- a/product.go +++ b/product.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // The type of the product. The product is either of type `good`, which is eligible for use with Orders and SKUs, or `service`, which is eligible for use with Subscriptions and Plans. @@ -26,10 +26,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type ProductSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *ProductSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links. type ProductDefaultPriceDataCurrencyOptionsCustomUnitAmountParams struct { // Pass in `true` to enable `custom_unit_amount`, otherwise omit `custom_unit_amount`. @@ -117,7 +124,7 @@ type ProductPackageDimensionsParams struct { // Creates a new product object. type ProductParams struct { Params `form:"*"` - // Whether the product is available for purchase. + // Whether the product is currently available for purchase. Defaults to `true`. Active *bool `form:"active"` // The ID of the [Price](https://stripe.com/docs/api/prices) object that is the default price for this product. DefaultPrice *string `form:"default_price"` @@ -125,10 +132,14 @@ type ProductParams struct { DefaultPriceData *ProductDefaultPriceDataParams `form:"default_price_data"` // 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // An identifier will be randomly generated by Stripe. You can optionally override this ID, but the ID must be unique across all products in your Stripe account. ID *string `form:"id"` // 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"` // The dimensions of this product for shipping purposes. @@ -150,6 +161,20 @@ type ProductParams struct { URL *string `form:"url"` } +// AddExpand appends a new field to expand. +func (p *ProductParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *ProductParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first. type ProductListParams struct { ListParams `form:"*"` @@ -159,6 +184,8 @@ type ProductListParams struct { Created *int64 `form:"created"` // Only return products 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"` // Only return products with the given IDs. Cannot be used with [starting_after](https://stripe.com/docs/api#list_products-starting_after) or [ending_before](https://stripe.com/docs/api#list_products-ending_before). IDs []*string `form:"ids"` // Only return products that can be shipped (i.e., physical, not digital products). @@ -169,6 +196,11 @@ type ProductListParams struct { URL *string `form:"url"` } +// AddExpand appends a new field to expand. +func (p *ProductListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // The dimensions of this product for shipping purposes. type ProductPackageDimensions struct { // Height, in inches. diff --git a/product/client.go b/product/client.go index 284a39257d..23d060c77d 100644 --- a/product/client.go +++ b/product/client.go @@ -10,8 +10,8 @@ package product import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /products APIs. diff --git a/promotioncode.go b/promotioncode.go index 2e26cde6f6..7f880de514 100644 --- a/promotioncode.go +++ b/promotioncode.go @@ -11,7 +11,7 @@ import "encoding/json" // Retrieves the promotion code with the given ID. In order to retrieve a promotion code by the customer-facing code use [list](https://stripe.com/docs/api/promotion_codes/list) with the desired code. type PromotionCodeParams struct { Params `form:"*"` - // Whether the promotion code is currently active. + // Whether the promotion code is currently active. A promotion code can only be reactivated when the coupon is still valid and the promotion code is otherwise redeemable. Active *bool `form:"active"` // The customer-facing code. Regardless of case, this code must be unique across all active promotion codes for a specific customer. If left blank, we will generate one automatically. Code *string `form:"code"` @@ -19,14 +19,32 @@ type PromotionCodeParams struct { Coupon *string `form:"coupon"` // The customer that this promotion code can be used by. If not set, the promotion code can be used by all customers. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The timestamp at which this promotion code will expire. If the coupon has specified a `redeems_by`, then this value cannot be after the coupon's `redeems_by`. ExpiresAt *int64 `form:"expires_at"` // A positive integer specifying the number of times the promotion code can be redeemed. If the coupon has specified a `max_redemptions`, then this value cannot be greater than the coupon's `max_redemptions`. MaxRedemptions *int64 `form:"max_redemptions"` + // 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"` // Settings that restrict the redemption of the promotion code. Restrictions *PromotionCodeRestrictionsParams `form:"restrictions"` } +// AddExpand appends a new field to expand. +func (p *PromotionCodeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *PromotionCodeParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Promotion codes defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). type PromotionCodeRestrictionsCurrencyOptionsParams struct { // Minimum amount required to redeem this Promotion Code into a Coupon (e.g., a purchase must be $100 or more to work). @@ -60,6 +78,13 @@ type PromotionCodeListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return promotion codes that are restricted to this customer. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *PromotionCodeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Promotion code restrictions defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies). diff --git a/promotioncode/client.go b/promotioncode/client.go index fd567edd81..ee4dbff04f 100644 --- a/promotioncode/client.go +++ b/promotioncode/client.go @@ -10,8 +10,8 @@ package promotioncode import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /promotion_codes APIs. diff --git a/quote.go b/quote.go index 40d6da290c..7bc091bb9f 100644 --- a/quote.go +++ b/quote.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // The status of the most recent automated tax calculation for this quote. @@ -46,24 +46,21 @@ type QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason string // List of values that QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason can take const ( - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "excluded_territory" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "jurisdiction_unsupported" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonVATExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "vat_exempt" - QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" + QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" ) // 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. @@ -71,24 +68,21 @@ type QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason string // List of values that QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason can take const ( - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "excluded_territory" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "jurisdiction_unsupported" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonVATExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "vat_exempt" - QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" + QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" ) // The status of the quote. @@ -107,24 +101,21 @@ type QuoteTotalDetailsBreakdownTaxTaxabilityReason string // List of values that QuoteTotalDetailsBreakdownTaxTaxabilityReason can take const ( - QuoteTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory QuoteTotalDetailsBreakdownTaxTaxabilityReason = "excluded_territory" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported QuoteTotalDetailsBreakdownTaxTaxabilityReason = "jurisdiction_unsupported" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonVATExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "vat_exempt" - QuoteTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonCustomerExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "customer_exempt" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotCollecting QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_collecting" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotSubjectToTax QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_subject_to_tax" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonNotSupported QuoteTotalDetailsBreakdownTaxTaxabilityReason = "not_supported" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionProductExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_product_exempt" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionReducedRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_reduced_rated" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonPortionStandardRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "portion_standard_rated" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonProductExempt QuoteTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonProductExemptHoliday QuoteTotalDetailsBreakdownTaxTaxabilityReason = "product_exempt_holiday" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonProportionallyRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "proportionally_rated" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonReducedRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "reduced_rated" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonReverseCharge QuoteTotalDetailsBreakdownTaxTaxabilityReason = "reverse_charge" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonStandardRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "standard_rated" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonTaxableBasisReduced QuoteTotalDetailsBreakdownTaxTaxabilityReason = "taxable_basis_reduced" + QuoteTotalDetailsBreakdownTaxTaxabilityReasonZeroRated QuoteTotalDetailsBreakdownTaxTaxabilityReason = "zero_rated" ) // Retrieves the quote with the given ID. @@ -146,6 +137,8 @@ type QuoteParams struct { Description *string `form:"description"` // The discounts applied to the quote. You can only set up to one discount. Discounts []*QuoteDiscountParams `form:"discounts"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // 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. ExpiresAt *int64 `form:"expires_at"` // 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. @@ -158,6 +151,8 @@ type QuoteParams struct { InvoiceSettings *QuoteInvoiceSettingsParams `form:"invoice_settings"` // 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. LineItems []*QuoteLineItemParams `form:"line_items"` + // 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 account on behalf of which to charge. OnBehalfOf *string `form:"on_behalf_of"` // 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. @@ -168,6 +163,20 @@ type QuoteParams struct { TransferData *QuoteTransferDataParams `form:"transfer_data"` } +// AddExpand appends a new field to expand. +func (p *QuoteParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *QuoteParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Settings for automatic tax lookup for this quote and resulting invoices and subscriptions. type QuoteAutomaticTaxParams struct { // Controls whether Stripe will automatically compute tax on the resulting invoices or subscriptions as well as the quote itself. @@ -238,8 +247,8 @@ type QuoteSubscriptionDataParams struct { } // AppendTo implements custom encoding logic for QuoteSubscriptionDataParams. -func (q *QuoteSubscriptionDataParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(q.EffectiveDateCurrentPeriodEnd) { +func (p *QuoteSubscriptionDataParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.EffectiveDateCurrentPeriodEnd) { body.Add(form.FormatKey(append(keyParts, "effective_date")), "current_period_end") } } @@ -267,45 +276,95 @@ type QuoteListParams struct { ListParams `form:"*"` // The ID of the customer whose quotes will be retrieved. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The status of the quote. Status *string `form:"status"` // 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. TestClock *string `form:"test_clock"` } +// AddExpand appends a new field to expand. +func (p *QuoteListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Cancels the quote. type QuoteCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *QuoteCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Finalizes the quote. type QuoteFinalizeQuoteParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A future timestamp on which the quote will be canceled if in `open` or `draft` status. Measured in seconds since the Unix epoch. ExpiresAt *int64 `form:"expires_at"` } +// AddExpand appends a new field to expand. +func (p *QuoteFinalizeQuoteParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Accepts the specified quote. type QuoteAcceptParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *QuoteAcceptParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // 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. type QuoteListLineItemsParams struct { ListParams `form:"*"` Quote *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *QuoteListLineItemsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // 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. type QuoteListComputedUpfrontLineItemsParams struct { ListParams `form:"*"` Quote *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *QuoteListComputedUpfrontLineItemsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Download the PDF for a finalized quote type QuotePDFParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *QuotePDFParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type QuoteAutomaticTax struct { // Automatically calculate taxes Enabled bool `json:"enabled"` diff --git a/quote/client.go b/quote/client.go index 493f904390..62098da859 100644 --- a/quote/client.go +++ b/quote/client.go @@ -10,16 +10,15 @@ package quote import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /quotes APIs. type Client struct { - B stripe.Backend - PDFBackend stripe.Backend - BUploads stripe.Backend - Key string + B stripe.Backend + BUploads stripe.Backend + Key string } // New creates a new quote. @@ -108,11 +107,7 @@ func PDF(id string, params *stripe.QuotePDFParams) (*stripe.APIStream, error) { func (c Client) PDF(id string, params *stripe.QuotePDFParams) (*stripe.APIStream, error) { path := stripe.FormatURLPath("/v1/quotes/%s/pdf", id) stream := &stripe.APIStream{} - backend := c.PDFBackend - if backend == nil { - backend = c.BUploads - } - err := backend.CallStreaming(http.MethodGet, path, c.Key, params, stream) + err := c.BUploads.CallStreaming(http.MethodGet, path, c.Key, params, stream) return stream, err } @@ -225,10 +220,5 @@ func (i *LineItemIter) LineItemList() *stripe.LineItemList { } func getC() Client { - return Client{ - stripe.GetBackend(stripe.APIBackend), - stripe.GetBackend(stripe.UploadsBackend), - stripe.GetBackend(stripe.UploadsBackend), - stripe.Key, - } + return Client{stripe.GetBackend(stripe.APIBackend), stripe.GetBackend(stripe.UploadsBackend), stripe.Key} } diff --git a/radar/earlyfraudwarning/client.go b/radar/earlyfraudwarning/client.go index a60996db8d..36a9a66c6b 100644 --- a/radar/earlyfraudwarning/client.go +++ b/radar/earlyfraudwarning/client.go @@ -10,8 +10,8 @@ package earlyfraudwarning import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /radar/early_fraud_warnings APIs. diff --git a/radar/valuelist/client.go b/radar/valuelist/client.go index dfab24b3af..0a527404b1 100644 --- a/radar/valuelist/client.go +++ b/radar/valuelist/client.go @@ -10,8 +10,8 @@ package valuelist import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /radar/value_lists APIs. diff --git a/radar/valuelistitem/client.go b/radar/valuelistitem/client.go index ffb11cc916..a90404fbe6 100644 --- a/radar/valuelistitem/client.go +++ b/radar/valuelistitem/client.go @@ -11,8 +11,8 @@ package valuelistitem import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /radar/value_list_items APIs. diff --git a/radar_earlyfraudwarning.go b/radar_earlyfraudwarning.go index 25ad4fc3de..0688b009b0 100644 --- a/radar_earlyfraudwarning.go +++ b/radar_earlyfraudwarning.go @@ -25,15 +25,29 @@ type RadarEarlyFraudWarningListParams struct { ListParams `form:"*"` // Only return early fraud warnings for the charge specified by this charge ID. Charge *string `form:"charge"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return early fraud warnings for charges that were created by the PaymentIntent specified by this PaymentIntent ID. PaymentIntent *string `form:"payment_intent"` } +// AddExpand appends a new field to expand. +func (p *RadarEarlyFraudWarningListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the details of an early fraud warning that has previously been created. // // Please refer to the [early fraud warning](https://stripe.com/docs/api#early_fraud_warning_object) object reference for more details. type RadarEarlyFraudWarningParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *RadarEarlyFraudWarningParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // An early fraud warning indicates that the card issuer has notified us that a diff --git a/radar_valuelist.go b/radar_valuelist.go index 4521fba97d..14fe6eaa74 100644 --- a/radar_valuelist.go +++ b/radar_valuelist.go @@ -32,6 +32,13 @@ type RadarValueListListParams struct { Contains *string `form:"contains"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *RadarValueListListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Creates a new ValueList object, which can then be referenced in rules. @@ -39,12 +46,30 @@ type RadarValueListParams struct { Params `form:"*"` // The name of the value list for use in rules. Alias *string `form:"alias"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Type of the items in the value list. One of `card_fingerprint`, `us_bank_account_fingerprint`, `sepa_debit_fingerprint`, `card_bin`, `email`, `ip_address`, `country`, `string`, `case_sensitive_string`, or `customer_id`. Use `string` if the item type is unknown or mixed. ItemType *string `form:"item_type"` + // 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 human-readable name of the value list. Name *string `form:"name"` } +// AddExpand appends a new field to expand. +func (p *RadarValueListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *RadarValueListParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Value lists allow you to group values together which can then be referenced in rules. // // Related guide: [Default Stripe lists](https://stripe.com/docs/radar/lists#managing-list-items) diff --git a/radar_valuelistitem.go b/radar_valuelistitem.go index f2eb4d4ed7..a91623abcb 100644 --- a/radar_valuelistitem.go +++ b/radar_valuelistitem.go @@ -11,21 +11,35 @@ type RadarValueListItemListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Return items belonging to the parent list whose value matches the specified value (using an "is like" match). Value *string `form:"value"` // Identifier for the parent value list this item belongs to. ValueList *string `form:"value_list"` } +// AddExpand appends a new field to expand. +func (p *RadarValueListItemListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Creates a new ValueListItem object, which is added to the specified parent value list. type RadarValueListItemParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The value of the item (whose type must match the type of the parent value list). Value *string `form:"value"` // The identifier of the value list which the created item will be added to. ValueList *string `form:"value_list"` } +// AddExpand appends a new field to expand. +func (p *RadarValueListItemParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Value list items allow you to add specific values to a given Radar value list, which can then be used in rules. // // Related guide: [Managing list items](https://stripe.com/docs/radar/lists#managing-list-items) diff --git a/refund.go b/refund.go index ed02050d1f..349ad91cb8 100644 --- a/refund.go +++ b/refund.go @@ -48,10 +48,17 @@ type RefundListParams struct { Charge *string `form:"charge"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return refunds for the PaymentIntent specified by this ID. PaymentIntent *string `form:"payment_intent"` } +// AddExpand appends a new field to expand. +func (p *RefundListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Create a refund. type RefundParams struct { Params `form:"*"` @@ -62,8 +69,12 @@ type RefundParams struct { Currency *string `form:"currency"` // Customer whose customer balance to refund from. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // For payment methods without native refund support (e.g., Konbini, PromptPay), use this email from the customer to receive refund instructions. InstructionsEmail *string `form:"instructions_email"` + // 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"` // Origin of the refund Origin *string `form:"origin"` PaymentIntent *string `form:"payment_intent"` @@ -72,12 +83,34 @@ type RefundParams struct { ReverseTransfer *bool `form:"reverse_transfer"` } +// AddExpand appends a new field to expand. +func (p *RefundParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *RefundParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Cancels a refund with a status of requires_action. // // Refunds in other states cannot be canceled, and only refunds for payment methods that require customer action will enter the requires_action state. type RefundCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *RefundCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type RefundNextActionDisplayDetailsEmailSent struct { // The timestamp when the email was sent. EmailSentAt int64 `json:"email_sent_at"` diff --git a/refund/client.go b/refund/client.go index f8ce6bc5b8..ef9f0d8d51 100644 --- a/refund/client.go +++ b/refund/client.go @@ -10,8 +10,8 @@ package refund import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /refunds APIs. diff --git a/reporting/reportrun/client.go b/reporting/reportrun/client.go index ad2c1376a6..edc585bcc2 100644 --- a/reporting/reportrun/client.go +++ b/reporting/reportrun/client.go @@ -10,8 +10,8 @@ package reportrun import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /reporting/report_runs APIs. diff --git a/reporting/reporttype/client.go b/reporting/reporttype/client.go index 9f5ef5f399..2df9a3d1b7 100644 --- a/reporting/reporttype/client.go +++ b/reporting/reporttype/client.go @@ -10,8 +10,8 @@ package reporttype import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /reporting/report_types APIs. diff --git a/reporting_reportrun.go b/reporting_reportrun.go index 1bbbc0cc98..6597f6cfa4 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -22,12 +22,19 @@ const ( // Retrieves the details of an existing Report Run. type ReportingReportRunParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Parameters specifying how the report should be run. Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation. Parameters *ReportingReportRunParametersParams `form:"parameters"` // The ID of the [report type](https://stripe.com/docs/reporting/statements/api#report-types) to run, such as `"balance.summary.1"`. ReportType *string `form:"report_type"` } +// AddExpand appends a new field to expand. +func (p *ReportingReportRunParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Parameters specifying how the report should be run. Different Report Types have different required and optional parameters, listed in the [API Access to Reports](https://stripe.com/docs/reporting/statements/api) documentation. type ReportingReportRunParametersParams struct { // The set of report columns to include in the report output. If omitted, the Report Type is run with its default column set. @@ -53,7 +60,15 @@ type ReportingReportRunListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *ReportingReportRunListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type ReportingReportRunParameters struct { // The set of output columns requested for inclusion in the report run. Columns []string `json:"columns"` diff --git a/reporting_reporttype.go b/reporting_reporttype.go index dca3498fe7..a60613bae7 100644 --- a/reporting_reporttype.go +++ b/reporting_reporttype.go @@ -9,11 +9,25 @@ package stripe // Retrieves the details of a Report Type. (Certain report types require a [live-mode API key](https://stripe.com/docs/keys#test-live-modes).) type ReportingReportTypeParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ReportingReportTypeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Returns a full list of Report Types. type ReportingReportTypeListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ReportingReportTypeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The Report Type resource corresponds to a particular type of report, such as diff --git a/review.go b/review.go index d14c0eb387..1df533c42c 100644 --- a/review.go +++ b/review.go @@ -48,16 +48,37 @@ type ReviewListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ReviewListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves a Review object. type ReviewParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ReviewParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Approves a Review object, closing it and removing it from the list of reviews. type ReviewApproveParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ReviewApproveParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Information related to the location of the payment. Note that this information is an approximation and attempts to locate the nearest population center - it should not be used to determine a specific address. diff --git a/review/client.go b/review/client.go index 44302b094c..4f20e2159c 100644 --- a/review/client.go +++ b/review/client.go @@ -10,8 +10,8 @@ package review import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /reviews APIs. diff --git a/setupattempt.go b/setupattempt.go index 39830a603c..9ee6e61fd4 100644 --- a/setupattempt.go +++ b/setupattempt.go @@ -108,10 +108,18 @@ type SetupAttemptListParams struct { // can be a string with an integer Unix timestamp, or it can be a // dictionary with a number of different query options. CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return SetupAttempts created by the SetupIntent specified by // this ID. SetupIntent *string `form:"setup_intent"` } + +// AddExpand appends a new field to expand. +func (p *SetupAttemptListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type SetupAttemptPaymentMethodDetailsACSSDebit struct{} type SetupAttemptPaymentMethodDetailsAUBECSDebit struct{} type SetupAttemptPaymentMethodDetailsBACSDebit struct{} diff --git a/setupattempt/client.go b/setupattempt/client.go index 5c5c120bc7..3f025c557f 100644 --- a/setupattempt/client.go +++ b/setupattempt/client.go @@ -11,8 +11,8 @@ package setupattempt import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /setup_attempts APIs. diff --git a/setupintent.go b/setupintent.go index 300adf93f6..615151cca0 100644 --- a/setupintent.go +++ b/setupintent.go @@ -239,7 +239,7 @@ type SetupIntentMandateDataCustomerAcceptanceParams struct { Offline *SetupIntentMandateDataCustomerAcceptanceOfflineParams `form:"offline"` // If this is a Mandate accepted online, this hash contains details about the online acceptance. Online *SetupIntentMandateDataCustomerAcceptanceOnlineParams `form:"online"` - // The type of customer acceptance information included with the Mandate. + // The type of customer acceptance information included with the Mandate. One of `online` or `offline`. Type MandateCustomerAcceptanceType `form:"type"` } @@ -499,6 +499,15 @@ type SetupIntentPaymentMethodDataParams struct { Zip *SetupIntentPaymentMethodDataZipParams `form:"zip"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SetupIntentPaymentMethodDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Additional fields for Mandate creation type SetupIntentPaymentMethodOptionsACSSDebitMandateOptionsParams struct { // A URL for custom mandate text to render during confirmation step. @@ -654,12 +663,16 @@ type SetupIntentParams struct { Customer *string `form:"customer"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Indicates the directions of money movement for which this payment method is intended to be used. // // Include `inbound` if you intend to use the payment method as the origin to pull funds from. Include `outbound` if you intend to use the payment method as the destination to send funds to. You can include both if you intend to use the payment method for both purposes. FlowDirections []*string `form:"flow_directions"` // This hash contains details about the Mandate to create. This parameter can only be used with [`confirm=true`](https://stripe.com/docs/api/setup_intents/create#create_setup_intent-confirm). MandateData *SetupIntentMandateDataParams `form:"mandate_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. 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 Stripe account ID for which this SetupIntent is created. OnBehalfOf *string `form:"on_behalf_of"` // ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent. @@ -681,6 +694,20 @@ type SetupIntentParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// AddExpand appends a new field to expand. +func (p *SetupIntentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SetupIntentParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of SetupIntents. type SetupIntentListParams struct { ListParams `form:"*"` @@ -694,10 +721,17 @@ type SetupIntentListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return SetupIntents for the customer specified by this customer ID. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return SetupIntents associated with the specified payment method. PaymentMethod *string `form:"payment_method"` } +// AddExpand appends a new field to expand. +func (p *SetupIntentListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method. type SetupIntentConfirmPaymentMethodDataACSSDebitParams struct { // Customer's bank account number. @@ -948,6 +982,15 @@ type SetupIntentConfirmPaymentMethodDataParams struct { Zip *SetupIntentConfirmPaymentMethodDataZipParams `form:"zip"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SetupIntentConfirmPaymentMethodDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Confirm that your customer intends to set up the current or // provided payment method. For example, you would confirm a SetupIntent // when a customer hits the “Save” button on a payment method management @@ -964,6 +1007,8 @@ type SetupIntentConfirmPaymentMethodDataParams struct { // confirmation limit is reached. type SetupIntentConfirmParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // This hash contains details about the Mandate to create MandateData *SetupIntentMandateDataParams `form:"mandate_data"` // ID of the payment method (a PaymentMethod, Card, or saved Source object) to attach to this SetupIntent. @@ -981,6 +1026,11 @@ type SetupIntentConfirmParams struct { UseStripeSDK *bool `form:"use_stripe_sdk"` } +// AddExpand appends a new field to expand. +func (p *SetupIntentConfirmParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A SetupIntent object can be canceled when it is in one of these statuses: requires_payment_method, requires_confirmation, or requires_action. // // Once canceled, setup is abandoned and any operations on the SetupIntent will fail with an error. @@ -988,6 +1038,13 @@ type SetupIntentCancelParams struct { Params `form:"*"` // Reason for canceling this SetupIntent. Possible values are `abandoned`, `requested_by_customer`, or `duplicate` CancellationReason *string `form:"cancellation_reason"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *SetupIntentCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Verifies microdeposits on a SetupIntent object. @@ -997,6 +1054,13 @@ type SetupIntentVerifyMicrodepositsParams struct { Amounts []*int64 `form:"amounts"` // A six-character code starting with SM present in the microdeposit sent to the bank account. DescriptorCode *string `form:"descriptor_code"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *SetupIntentVerifyMicrodepositsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Settings for dynamic payment methods compatible with this Setup Intent diff --git a/setupintent/client.go b/setupintent/client.go index 4f499ffbc8..79bdb4faa3 100644 --- a/setupintent/client.go +++ b/setupintent/client.go @@ -10,8 +10,8 @@ package setupintent import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /setup_intents APIs. diff --git a/shippingrate.go b/shippingrate.go index 31ae48251d..6416a2e27a 100644 --- a/shippingrate.go +++ b/shippingrate.go @@ -71,6 +71,13 @@ type ShippingRateListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return shipping rates for the given currency. Currency *string `form:"currency"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *ShippingRateListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. @@ -124,8 +131,12 @@ type ShippingRateParams struct { DeliveryEstimate *ShippingRateDeliveryEstimateParams `form:"delivery_estimate"` // The name of the shipping rate, meant to be displayable to the customer. This will appear on CheckoutSessions. DisplayName *string `form:"display_name"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Describes a fixed amount to charge for shipping. Must be present if type is `fixed_amount`. FixedAmount *ShippingRateFixedAmountParams `form:"fixed_amount"` + // 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"` // Specifies whether the rate is considered inclusive of taxes or exclusive of taxes. One of `inclusive`, `exclusive`, or `unspecified`. TaxBehavior *string `form:"tax_behavior"` // A [tax code](https://stripe.com/docs/tax/tax-categories) ID. The Shipping tax code is `txcd_92010001`. @@ -134,6 +145,20 @@ type ShippingRateParams struct { Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *ShippingRateParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *ShippingRateParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The upper bound of the estimated range. If empty, represents no upper bound i.e., infinite. type ShippingRateDeliveryEstimateMaximum struct { // A unit of time. diff --git a/shippingrate/client.go b/shippingrate/client.go index 21bc0dd042..5d693a567a 100644 --- a/shippingrate/client.go +++ b/shippingrate/client.go @@ -10,8 +10,8 @@ package shippingrate import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /shipping_rates APIs. diff --git a/sigma/scheduledqueryrun/client.go b/sigma/scheduledqueryrun/client.go index 2967d1b02b..cdc8c8c1ac 100644 --- a/sigma/scheduledqueryrun/client.go +++ b/sigma/scheduledqueryrun/client.go @@ -11,8 +11,8 @@ package scheduledqueryrun import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /sigma/scheduled_query_runs APIs. diff --git a/sigma_scheduledqueryrun.go b/sigma_scheduledqueryrun.go index 62950075ea..4fdd86d99b 100644 --- a/sigma_scheduledqueryrun.go +++ b/sigma_scheduledqueryrun.go @@ -20,12 +20,27 @@ const ( // Returns a list of scheduled query runs. type SigmaScheduledQueryRunListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *SigmaScheduledQueryRunListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves the details of an scheduled query run. type SigmaScheduledQueryRunParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *SigmaScheduledQueryRunParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type SigmaScheduledQueryRunError struct { // Information about the run failure. Message string `json:"message"` diff --git a/source.go b/source.go index 0239f2b0be..d3f91e1fc7 100644 --- a/source.go +++ b/source.go @@ -106,6 +106,13 @@ const ( type SourceDetachParams struct { Params `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *SourceDetachParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information. @@ -119,10 +126,14 @@ type SourceParams struct { Currency *string `form:"currency"` // The `Customer` to whom the original source is attached to. Must be set when the original source is not a `Source` (e.g., `Card`). Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The authentication `flow` of the source to create. `flow` is one of `redirect`, `receiver`, `code_verification`, `none`. It is generally inferred unless a type supports multiple flows. Flow *string `form:"flow"` // Information about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status. Mandate *SourceMandateParams `form:"mandate"` + // 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 source to share. OriginalSource *string `form:"original_source"` // Information about the owner of the payment instrument that may be used or required by particular source types. @@ -142,6 +153,20 @@ type SourceParams struct { Usage *string `form:"usage"` } +// AddExpand appends a new field to expand. +func (p *SourceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SourceParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The parameters required to store a mandate accepted offline. Should only be set if `mandate[type]` is `offline` type SourceMandateAcceptanceOfflineParams struct { // An email to contact you with if a copy of the mandate is requested, required if `type` is `offline`. diff --git a/source/client.go b/source/client.go index a7ed089e83..fca7bc078b 100644 --- a/source/client.go +++ b/source/client.go @@ -11,7 +11,7 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /sources APIs. diff --git a/sourcetransaction.go b/sourcetransaction.go index 6c1dfe74cd..bf61461e7a 100644 --- a/sourcetransaction.go +++ b/sourcetransaction.go @@ -10,7 +10,15 @@ package stripe type SourceTransactionListParams struct { ListParams `form:"*"` Source *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *SourceTransactionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type SourceTransactionACHCreditTransfer struct { // Customer data associated with the transfer. CustomerData string `json:"customer_data"` diff --git a/sourcetransaction/client.go b/sourcetransaction/client.go index 8e4746b7aa..3243990f58 100644 --- a/sourcetransaction/client.go +++ b/sourcetransaction/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /sources/:source_id/transactions APIs. diff --git a/subscription.go b/subscription.go index 2504e0d6a2..f3c1b6f7e6 100644 --- a/subscription.go +++ b/subscription.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // The customer submitted reason for why they cancelled, if the subscription was cancelled explicitly by the user. @@ -228,10 +228,17 @@ const ( // to an hour behind during outages. Search functionality is not available to merchants in India. type SubscriptionSearchParams struct { SearchParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results. Page *string `form:"page"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionSearchParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Filter subscriptions by their automatic tax settings. type SubscriptionListAutomaticTaxParams struct { // Enabled automatic tax calculation which will automatically compute tax rates on all invoices generated by the subscription. @@ -253,6 +260,8 @@ type SubscriptionListParams struct { CurrentPeriodStartRange *RangeQueryParams `form:"current_period_start"` // The ID of the customer whose subscriptions will be retrieved. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The ID of the plan whose subscriptions will be retrieved. Plan *string `form:"plan"` // Filter for subscriptions that contain this recurring price ID. @@ -263,6 +272,11 @@ type SubscriptionListParams struct { TestClock *string `form:"test_clock"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A list of prices and quantities that will generate invoice items appended to the next invoice for this subscription. You may pass up to 20 items. type SubscriptionAddInvoiceItemParams struct { // The ID of the price object. @@ -314,6 +328,15 @@ type SubscriptionItemsParams struct { TaxRates []*string `form:"tax_rates"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SubscriptionItemsParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Additional fields for Mandate creation type SubscriptionPaymentSettingsPaymentMethodOptionsACSSDebitMandateOptionsParams struct { // Transaction type of the mandate. @@ -464,7 +487,7 @@ type SubscriptionParams struct { AutomaticTax *SubscriptionAutomaticTaxParams `form:"automatic_tax"` // For new subscriptions, a past timestamp to backdate the subscription's start date to. If set, the first invoice will contain a proration for the timespan between the start date and the current time. Can be combined with trials and the billing cycle anchor. BackdateStartDate *int64 `form:"backdate_start_date"` - // Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). + // A future timestamp to anchor the subscription's [billing cycle](https://stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with `month` or `year` intervals, the day of the month for subsequent invoices. The timestamp is in UTC format. BillingCycleAnchor *int64 `form:"billing_cycle_anchor"` BillingCycleAnchorNow *bool `form:"-"` // See custom AppendTo BillingCycleAnchorUnchanged *bool `form:"-"` // See custom AppendTo @@ -494,27 +517,35 @@ type SubscriptionParams struct { DefaultTaxRates []*string `form:"default_tax_rates"` // 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. Description *string `form:"description"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A list of up to 20 subscription items, each with an attached price. Items []*SubscriptionItemsParams `form:"items"` + // 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"` // Indicates if a customer is on or off-session while an invoice payment is attempted. OffSession *bool `form:"off_session"` // The account on behalf of which to charge, for each of the subscription's invoices. OnBehalfOf *string `form:"on_behalf_of"` // If specified, payment collection for this subscription will be paused. PauseCollection *SubscriptionPauseCollectionParams `form:"pause_collection"` - // Use `allow_incomplete` to transition the subscription to `status=past_due` if a payment is required but cannot be paid. This allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. + // Only applies to subscriptions with `collection_method=charge_automatically`. + // + // Use `allow_incomplete` to create subscriptions with `status=incomplete` if the first invoice cannot be paid. Creating subscriptions with this status allows you to manage scenarios where additional user actions are needed to pay a subscription's invoice. For example, SCA regulation may require 3DS authentication to complete payment. See the [SCA Migration Guide](https://stripe.com/docs/billing/migration/strong-customer-authentication) for Billing to learn more. This is the default behavior. // - // Use `default_incomplete` to transition the subscription to `status=past_due` when payment is required and await explicit confirmation of the invoice's payment intent. This allows simpler management of scenarios where additional user actions are needed to pay a subscription's invoice. Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. + // Use `default_incomplete` to create Subscriptions with `status=incomplete` when the first invoice requires payment, otherwise start as active. Subscriptions transition to `status=active` when successfully confirming the payment intent on the first invoice. This allows simpler management of scenarios where additional user actions are needed to pay a subscription's invoice. Such as failed payments, [SCA regulation](https://stripe.com/docs/billing/migration/strong-customer-authentication), or collecting a mandate for a bank debit payment method. If the payment intent is not confirmed within 23 hours subscriptions transition to `status=incomplete_expired`, which is a terminal state. // - // Use `pending_if_incomplete` to update the subscription using [pending updates](https://stripe.com/docs/billing/subscriptions/pending-updates). When you use `pending_if_incomplete` you can only pass the parameters [supported by pending updates](https://stripe.com/docs/billing/pending-updates-reference#supported-attributes). + // Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's first invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not create a subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. // - // Use `error_if_incomplete` if you want Stripe to return an HTTP 402 status code if a subscription's invoice cannot be paid. For example, if a payment method requires 3DS authentication due to SCA regulation and further user action is needed, this parameter does not update the subscription and returns an error instead. This was the default behavior for API versions prior to 2019-03-14. See the [changelog](https://stripe.com/docs/upgrades#2019-03-14) to learn more. + // `pending_if_incomplete` is only used with updates and cannot be passed when creating a subscription. + // + // Subscriptions with `collection_method=send_invoice` are automatically activated regardless of the first invoice status. PaymentBehavior *string `form:"payment_behavior"` // Payment settings to pass to invoices created by the subscription. PaymentSettings *SubscriptionPaymentSettingsParams `form:"payment_settings"` // Specifies an interval for how often to bill for any pending invoice items. It is analogous to calling [Create an invoice](https://stripe.com/docs/api#create_invoice) for the given subscription at the specified interval. PendingInvoiceItemInterval *SubscriptionPendingInvoiceItemIntervalParams `form:"pending_invoice_item_interval"` - // The promotion code to apply to this subscription. A promotion code applied to a subscription will only affect invoices created for that particular subscription. + // 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`. ProrationBehavior *string `form:"proration_behavior"` @@ -522,7 +553,7 @@ type SubscriptionParams struct { ProrationDate *int64 `form:"proration_date"` // If specified, the funds from the subscription's invoices will be transferred to the destination and the ID of the resulting transfers will be found on the resulting charges. This will be unset if you POST an empty value. TransferData *SubscriptionTransferDataParams `form:"transfer_data"` - // Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. This will always overwrite any trials that might apply via a subscribed plan. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. + // Unix timestamp representing the end of the trial period the customer will get before being charged for the first time. If set, trial_end will override the default trial period of the plan the customer is being subscribed to. The special value `now` can be provided to end the customer's trial immediately. Can be at most two years from `billing_cycle_anchor`. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. TrialEnd *int64 `form:"trial_end"` TrialEndNow *bool `form:"-"` // See custom AppendTo // Indicates if a plan's `trial_period_days` should be applied to the subscription. Setting `trial_end` per subscription is preferred, and this defaults to `false`. Setting this flag to `true` together with `trial_end` is not allowed. See [Using trial periods on subscriptions](https://stripe.com/docs/billing/subscriptions/trials) to learn more. @@ -533,15 +564,29 @@ type SubscriptionParams struct { TrialSettings *SubscriptionTrialSettingsParams `form:"trial_settings"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SubscriptionParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // AppendTo implements custom encoding logic for SubscriptionParams. -func (s *SubscriptionParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(s.BillingCycleAnchorNow) { +func (p *SubscriptionParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.BillingCycleAnchorNow) { body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "now") } - if BoolValue(s.BillingCycleAnchorUnchanged) { + if BoolValue(p.BillingCycleAnchorUnchanged) { body.Add(form.FormatKey(append(keyParts, "billing_cycle_anchor")), "unchanged") } - if BoolValue(s.TrialEndNow) { + if BoolValue(p.TrialEndNow) { body.Add(form.FormatKey(append(keyParts, "trial_end")), "now") } } @@ -579,23 +624,37 @@ type SubscriptionCancelParams struct { Params `form:"*"` // Details about why this subscription was cancelled CancellationDetails *SubscriptionCancelCancellationDetailsParams `form:"cancellation_details"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Will generate a final invoice that invoices for any un-invoiced metered usage and new/pending proration invoice items. InvoiceNow *bool `form:"invoice_now"` // Will generate a proration invoice item that credits remaining unused time until the subscription period end. Prorate *bool `form:"prorate"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Initiates resumption of a paused subscription, optionally resetting the billing cycle anchor and creating prorations. If a resumption invoice is generated, it must be paid or marked uncollectible before the subscription will be unpaused. If payment succeeds the subscription will become active, and if payment fails the subscription will be past_due. The resumption invoice will void automatically if not paid by the expiration date. type SubscriptionResumeParams struct { Params `form:"*"` // Either `now` or `unchanged`. Setting the value to `now` resets the subscription's billing cycle anchor to the current time (in UTC). Setting the value to `unchanged` advances the subscription's billing cycle anchor to the period that surrounds the current time. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). 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`. 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"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionResumeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Removes the currently applied discount on a subscription. type SubscriptionDeleteDiscountParams struct { Params `form:"*"` diff --git a/subscription/client.go b/subscription/client.go index 3af2168cb9..a96d40ed0a 100644 --- a/subscription/client.go +++ b/subscription/client.go @@ -10,8 +10,8 @@ package subscription import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /subscriptions APIs. diff --git a/subscriptionitem.go b/subscriptionitem.go index 136c0cfb1b..1deb0e6176 100644 --- a/subscriptionitem.go +++ b/subscriptionitem.go @@ -6,13 +6,22 @@ package stripe +import "encoding/json" + // Returns a list of your subscription items for a given subscription. type SubscriptionItemListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The ID of the subscription whose items will be retrieved. Subscription *string `form:"subscription"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionItemListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period. When updating, pass an empty string to remove previously-defined thresholds. type SubscriptionItemBillingThresholdsParams struct { // Number of units that meets the billing threshold to advance the subscription to a new billing period (e.g., it takes 10 $5 units to meet a $50 [monetary threshold](https://stripe.com/docs/api/subscriptions/update#update_subscription-billing_thresholds-amount_gte)) @@ -50,6 +59,10 @@ type SubscriptionItemParams struct { BillingThresholds *SubscriptionItemBillingThresholdsParams `form:"billing_thresholds"` // Delete all usage for the given subscription item. Allowed only when the current plan's `usage_type` is `metered`. ClearUsage *bool `form:"clear_usage"` + // 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"` // Only supported on update // Indicates if a customer is on or off-session while an invoice payment is attempted. OffSession *bool `form:"off_session"` @@ -79,12 +92,33 @@ type SubscriptionItemParams struct { TaxRates []*string `form:"tax_rates"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionItemParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SubscriptionItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // For the specified subscription item, returns a list of summary objects. Each object in the list provides usage information that's been summarized from multiple usage records and over a subscription billing period (e.g., 15 usage records in the month of September). // // The list is sorted in reverse-chronological order (newest first). The first list item represents the most current usage period that hasn't ended yet. Since new usage records can still be added, the returned summary information for the subscription item's ID should be seen as unstable until the subscription billing period ends. type SubscriptionItemUsageRecordSummariesParams struct { ListParams `form:"*"` SubscriptionItem *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *SubscriptionItemUsageRecordSummariesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period @@ -138,3 +172,22 @@ type SubscriptionItemList struct { ListMeta Data []*SubscriptionItem `json:"data"` } + +// UnmarshalJSON handles deserialization of a SubscriptionItem. +// This custom unmarshaling is needed because the resulting +// property may be an id or the full struct if it was expanded. +func (s *SubscriptionItem) UnmarshalJSON(data []byte) error { + if id, ok := ParseID(data); ok { + s.ID = id + return nil + } + + type subscriptionItem SubscriptionItem + var v subscriptionItem + if err := json.Unmarshal(data, &v); err != nil { + return err + } + + *s = SubscriptionItem(v) + return nil +} diff --git a/subscriptionitem/client.go b/subscriptionitem/client.go index 02f7aa7ddc..fc9b2f633a 100644 --- a/subscriptionitem/client.go +++ b/subscriptionitem/client.go @@ -10,8 +10,8 @@ package subscriptionitem import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /subscription_items APIs. diff --git a/subscriptionschedule.go b/subscriptionschedule.go index 385394b1fb..447dcf14f1 100644 --- a/subscriptionschedule.go +++ b/subscriptionschedule.go @@ -8,7 +8,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v74/form" + "github.com/stripe/stripe-go/v75/form" ) // Possible values are `phase_start` or `automatic`. If `phase_start` then billing cycle anchor of the subscription is set to the start of the phase when entering the phase. If `automatic` then the billing cycle anchor is automatically modified as needed when entering the phase. For more information, see the billing cycle [documentation](https://stripe.com/docs/billing/subscriptions/billing-cycle). @@ -79,6 +79,8 @@ type SubscriptionScheduleListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return subscription schedules for the given customer. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return subscription schedules that were released during the given date interval. ReleasedAt *int64 `form:"released_at"` // Only return subscription schedules that were released during the given date interval. @@ -87,6 +89,11 @@ type SubscriptionScheduleListParams struct { Scheduled *bool `form:"scheduled"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionScheduleListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // All invoices will be billed using the specified settings. type SubscriptionScheduleDefaultSettingsInvoiceSettingsParams struct { // Number of days within which a customer must pay invoices generated by this subscription schedule. This value will be `null` for subscription schedules where `collection_method=charge_automatically`. @@ -160,6 +167,15 @@ type SubscriptionSchedulePhaseItemParams struct { TaxRates []*string `form:"tax_rates"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SubscriptionSchedulePhaseItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. type SubscriptionSchedulePhaseParams struct { // A list of prices and quantities that will generate invoice items appended to the next invoice for this phase. You may pass up to 20 items. @@ -211,15 +227,24 @@ type SubscriptionSchedulePhaseParams struct { TrialEndNow *bool `form:"-"` // See custom AppendTo } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SubscriptionSchedulePhaseParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // AppendTo implements custom encoding logic for SubscriptionSchedulePhaseParams. -func (s *SubscriptionSchedulePhaseParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(s.EndDateNow) { +func (p *SubscriptionSchedulePhaseParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.EndDateNow) { body.Add(form.FormatKey(append(keyParts, "end_date")), "now") } - if BoolValue(s.TrialEndNow) { + if BoolValue(p.TrialEndNow) { body.Add(form.FormatKey(append(keyParts, "trial_end")), "now") } - if BoolValue(s.StartDateNow) { + if BoolValue(p.StartDateNow) { body.Add(form.FormatKey(append(keyParts, "start_date")), "now") } } @@ -233,8 +258,12 @@ type SubscriptionScheduleParams struct { DefaultSettings *SubscriptionScheduleDefaultSettingsParams `form:"default_settings"` // Behavior of the subscription schedule and underlying subscription when it ends. Possible values are `release` or `cancel` with the default being `release`. `release` will end the subscription schedule and keep the underlying subscription running.`cancel` will end the subscription schedule and cancel the underlying subscription. EndBehavior *string `form:"end_behavior"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Migrate an existing subscription to be managed by a subscription schedule. If this parameter is set, a subscription schedule will be created using the subscription's item(s), set to auto-renew using the subscription's interval. When using this parameter, other parameters (such as phase values) cannot be set. To create a subscription schedule with other modifications, we recommend making two separate API calls. FromSubscription *string `form:"from_subscription"` + // 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"` // List representing phases of the subscription schedule. Each phase can be customized to have different durations, plans, and coupons. If there are multiple phases, the `end_date` of one phase will always equal the `start_date` of the next phase. Note that past phases can be omitted. Phases []*SubscriptionSchedulePhaseParams `form:"phases"` // If the update changes the current phase, indicates whether the changes should be prorated. The default value is `create_prorations`. @@ -244,9 +273,23 @@ type SubscriptionScheduleParams struct { StartDateNow *bool `form:"-"` // See custom AppendTo } +// AddExpand appends a new field to expand. +func (p *SubscriptionScheduleParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *SubscriptionScheduleParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // AppendTo implements custom encoding logic for SubscriptionScheduleParams. -func (s *SubscriptionScheduleParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(s.StartDateNow) { +func (p *SubscriptionScheduleParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.StartDateNow) { body.Add(form.FormatKey(append(keyParts, "start_date")), "now") } } @@ -254,19 +297,33 @@ func (s *SubscriptionScheduleParams) AppendTo(body *form.Values, keyParts []stri // Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active. type SubscriptionScheduleCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // If the subscription schedule is `active`, indicates if a final invoice will be generated that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to `true`. InvoiceNow *bool `form:"invoice_now"` // If the subscription schedule is `active`, indicates if the cancellation should be prorated. Defaults to `true`. Prorate *bool `form:"prorate"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionScheduleCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription's ID to the released_subscription property. type SubscriptionScheduleReleaseParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Keep any cancellation on the subscription that the schedule has set PreserveCancelDate *bool `form:"preserve_cancel_date"` } +// AddExpand appends a new field to expand. +func (p *SubscriptionScheduleReleaseParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Object representing the start and end dates for the current phase of the subscription schedule, if it is `active`. type SubscriptionScheduleCurrentPhase struct { // The end of this phase of the subscription schedule. diff --git a/subscriptionschedule/client.go b/subscriptionschedule/client.go index 6d97e49058..0b2bc1818b 100644 --- a/subscriptionschedule/client.go +++ b/subscriptionschedule/client.go @@ -10,8 +10,8 @@ package subscriptionschedule import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /subscription_schedules APIs. diff --git a/tax/calculation/client.go b/tax/calculation/client.go index 74f6da6d3f..d66144b597 100644 --- a/tax/calculation/client.go +++ b/tax/calculation/client.go @@ -10,8 +10,8 @@ package calculation import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /tax/calculations APIs. diff --git a/tax/settings/client.go b/tax/settings/client.go index 7fe5e9d380..30ace62733 100644 --- a/tax/settings/client.go +++ b/tax/settings/client.go @@ -10,7 +10,7 @@ package settings import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /tax/settings APIs. diff --git a/tax/transaction/client.go b/tax/transaction/client.go index 9e493601a4..bdafd53e65 100644 --- a/tax/transaction/client.go +++ b/tax/transaction/client.go @@ -10,8 +10,8 @@ package transaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /tax/transactions APIs. diff --git a/tax_calculation.go b/tax_calculation.go index 1bfd2d9b56..08af30b11a 100644 --- a/tax_calculation.go +++ b/tax_calculation.go @@ -270,6 +270,8 @@ type TaxCalculationParams struct { Customer *string `form:"customer"` // Details about the customer, including address and tax IDs. CustomerDetails *TaxCalculationCustomerDetailsParams `form:"customer_details"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A list of items the customer is purchasing. LineItems []*TaxCalculationLineItemParams `form:"line_items"` // Shipping cost details to be used for the calculation. @@ -278,10 +280,22 @@ type TaxCalculationParams struct { TaxDate *int64 `form:"tax_date"` } +// AddExpand appends a new field to expand. +func (p *TaxCalculationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the line items of a persisted tax calculation as a collection. type TaxCalculationListLineItemsParams struct { ListParams `form:"*"` Calculation *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TaxCalculationListLineItemsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The customer's tax IDs (for example, EU VAT numbers). diff --git a/tax_settings.go b/tax_settings.go index 14797995d0..9c6b384c70 100644 --- a/tax_settings.go +++ b/tax_settings.go @@ -30,10 +30,17 @@ type TaxSettingsParams struct { Params `form:"*"` // Default configuration to be used on Stripe Tax calculations. Defaults *TaxSettingsDefaultsParams `form:"defaults"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The place where your business is located. HeadOffice *TaxSettingsHeadOfficeParams `form:"head_office"` } +// AddExpand appends a new field to expand. +func (p *TaxSettingsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Default configuration to be used on Stripe Tax calculations. type TaxSettingsDefaultsParams struct { // Specifies the default [tax behavior](https://stripe.com/docs/tax/products-prices-tax-categories-tax-behavior#tax-behavior) to be used when the item's price has unspecified tax behavior. One of inclusive, exclusive, or inferred_by_currency. Once specified, it cannot be changed back to null. diff --git a/tax_transaction.go b/tax_transaction.go index 20453ffe77..82a914fd25 100644 --- a/tax_transaction.go +++ b/tax_transaction.go @@ -182,6 +182,13 @@ const ( // Retrieves a Tax Transaction object. type TaxTransactionParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TaxTransactionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The line item amounts to reverse. @@ -200,6 +207,15 @@ type TaxTransactionCreateReversalLineItemParams struct { Reference *string `form:"reference"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TaxTransactionCreateReversalLineItemParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // The shipping cost to reverse. type TaxTransactionCreateReversalShippingCostParams struct { // The amount to reverse, in negative integer cents. @@ -211,8 +227,12 @@ type TaxTransactionCreateReversalShippingCostParams struct { // Partially or fully reverses a previously created Transaction. type TaxTransactionCreateReversalParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The line item amounts to reverse. LineItems []*TaxTransactionCreateReversalLineItemParams `form:"line_items"` + // 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"` // If `partial`, the provided line item or shipping cost amounts are reversed. If `full`, the original transaction is fully reversed. Mode *string `form:"mode"` // The ID of the Transaction to partially or fully reverse. @@ -223,19 +243,58 @@ type TaxTransactionCreateReversalParams struct { ShippingCost *TaxTransactionCreateReversalShippingCostParams `form:"shipping_cost"` } +// AddExpand appends a new field to expand. +func (p *TaxTransactionCreateReversalParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TaxTransactionCreateReversalParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Creates a Tax Transaction from a calculation. type TaxTransactionCreateFromCalculationParams struct { Params `form:"*"` // Tax Calculation ID to be used as input when creating the transaction. Calculation *string `form:"calculation"` + // 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"` // A custom order or sale identifier, such as 'myOrder_123'. Must be unique across all transactions, including reversals. Reference *string `form:"reference"` } +// AddExpand appends a new field to expand. +func (p *TaxTransactionCreateFromCalculationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TaxTransactionCreateFromCalculationParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Retrieves the line items of a committed standalone transaction as a collection. type TaxTransactionListLineItemsParams struct { ListParams `form:"*"` Transaction *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TaxTransactionListLineItemsParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // The customer's tax IDs (for example, EU VAT numbers). diff --git a/taxcode.go b/taxcode.go index 89ca5679c9..11bdd7fdef 100644 --- a/taxcode.go +++ b/taxcode.go @@ -11,11 +11,25 @@ import "encoding/json" // A list of [all tax codes available](https://stripe.com/docs/tax/tax-categories) to add to Products in order to allow specific tax calculations. type TaxCodeListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TaxCodeListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves the details of an existing tax code. Supply the unique tax code ID and Stripe will return the corresponding tax code information. type TaxCodeParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TaxCodeParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // [Tax codes](https://stripe.com/docs/tax/tax-categories) classify goods and services for tax purposes. diff --git a/taxcode/client.go b/taxcode/client.go index 1ac0fb81ca..4ab01e198b 100644 --- a/taxcode/client.go +++ b/taxcode/client.go @@ -10,8 +10,8 @@ package taxcode import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /tax_codes APIs. diff --git a/taxid.go b/taxid.go index a5508e9f1f..04df07e045 100644 --- a/taxid.go +++ b/taxid.go @@ -97,16 +97,30 @@ const ( type TaxIDParams struct { Params `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Type of the tax ID, one of `ad_nrt`, `ae_trn`, `ar_cuit`, `au_abn`, `au_arn`, `bg_uic`, `bo_tin`, `br_cnpj`, `br_cpf`, `ca_bn`, `ca_gst_hst`, `ca_pst_bc`, `ca_pst_mb`, `ca_pst_sk`, `ca_qst`, `ch_vat`, `cl_tin`, `cn_tin`, `co_nit`, `cr_tin`, `do_rcn`, `ec_ruc`, `eg_tin`, `es_cif`, `eu_oss_vat`, `eu_vat`, `gb_vat`, `ge_vat`, `hk_br`, `hu_tin`, `id_npwp`, `il_vat`, `in_gst`, `is_vat`, `jp_cn`, `jp_rn`, `jp_trn`, `ke_pin`, `kr_brn`, `li_uid`, `mx_rfc`, `my_frp`, `my_itn`, `my_sst`, `no_vat`, `nz_gst`, `pe_ruc`, `ph_tin`, `ro_tin`, `rs_pib`, `ru_inn`, `ru_kpp`, `sa_vat`, `sg_gst`, `sg_uen`, `si_tin`, `sv_nit`, `th_vat`, `tr_tin`, `tw_vat`, `ua_vat`, `us_ein`, `uy_ruc`, `ve_rif`, `vn_tin`, or `za_vat` Type *string `form:"type"` // Value of the tax ID. Value *string `form:"value"` } +// AddExpand appends a new field to expand. +func (p *TaxIDParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Returns a list of tax IDs for a customer. type TaxIDListParams struct { ListParams `form:"*"` Customer *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TaxIDListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Tax ID verification information. diff --git a/taxid/client.go b/taxid/client.go index 9430c04621..1ce066cb37 100644 --- a/taxid/client.go +++ b/taxid/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /customers/{customer}/tax_ids APIs. diff --git a/taxrate.go b/taxrate.go index f5b7b53007..8e97332f25 100644 --- a/taxrate.go +++ b/taxrate.go @@ -37,10 +37,17 @@ type TaxRateListParams struct { Created *int64 `form:"created"` // Optional range for filtering created date. CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Optional flag to filter by tax rates that are inclusive (or those that are not inclusive). Inclusive *bool `form:"inclusive"` } +// AddExpand appends a new field to expand. +func (p *TaxRateListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Creates a new tax rate. type TaxRateParams struct { Params `form:"*"` @@ -52,10 +59,14 @@ type TaxRateParams struct { Description *string `form:"description"` // The display name of the tax rate, which will be shown to users. DisplayName *string `form:"display_name"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // 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"` + // 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"` // This represents the tax rate percent out of 100. 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. @@ -64,6 +75,20 @@ type TaxRateParams struct { TaxType *string `form:"tax_type"` } +// AddExpand appends a new field to expand. +func (p *TaxRateParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TaxRateParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // 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. // // Related guide: [Tax rates](https://stripe.com/docs/billing/taxes/tax-rates) diff --git a/taxrate/client.go b/taxrate/client.go index 1e13e38c9f..d548c3f665 100644 --- a/taxrate/client.go +++ b/taxrate/client.go @@ -10,8 +10,8 @@ package taxrate import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /tax_rates APIs. diff --git a/terminal/configuration/client.go b/terminal/configuration/client.go index 2b46db1023..bd0b7ec04a 100644 --- a/terminal/configuration/client.go +++ b/terminal/configuration/client.go @@ -10,8 +10,8 @@ package configuration import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /terminal/configurations APIs. diff --git a/terminal/connectiontoken/client.go b/terminal/connectiontoken/client.go index 21abdb3a79..295b3d1af5 100644 --- a/terminal/connectiontoken/client.go +++ b/terminal/connectiontoken/client.go @@ -10,7 +10,7 @@ package connectiontoken import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /terminal/connection_tokens APIs. diff --git a/terminal/location/client.go b/terminal/location/client.go index f515ba452b..50ecc3431c 100644 --- a/terminal/location/client.go +++ b/terminal/location/client.go @@ -10,8 +10,8 @@ package location import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /terminal/locations APIs. diff --git a/terminal/reader/client.go b/terminal/reader/client.go index ac0b20787a..6c8e0bc1da 100644 --- a/terminal/reader/client.go +++ b/terminal/reader/client.go @@ -10,8 +10,8 @@ package reader import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /terminal/readers APIs. diff --git a/terminal_configuration.go b/terminal_configuration.go index 1ed05cad3b..c733dda06a 100644 --- a/terminal_configuration.go +++ b/terminal_configuration.go @@ -195,18 +195,33 @@ type TerminalConfigurationParams struct { Params `form:"*"` // An object containing device type specific settings for BBPOS WisePOS E readers BBPOSWisePOSE *TerminalConfigurationBBPOSWisePOSEParams `form:"bbpos_wisepos_e"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Tipping configurations for readers supporting on-reader tips Tipping *TerminalConfigurationTippingParams `form:"tipping"` // An object containing device type specific settings for Verifone P400 readers VerifoneP400 *TerminalConfigurationVerifoneP400Params `form:"verifone_p400"` } +// AddExpand appends a new field to expand. +func (p *TerminalConfigurationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Returns a list of Configuration objects. type TerminalConfigurationListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // if present, only return the account default or non-default configurations. IsAccountDefault *bool `form:"is_account_default"` } + +// AddExpand appends a new field to expand. +func (p *TerminalConfigurationListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type TerminalConfigurationBBPOSWisePOSE struct { // A File ID representing an image you would like displayed on the reader. Splashscreen *File `json:"splashscreen"` diff --git a/terminal_connectiontoken.go b/terminal_connectiontoken.go index 4ca9731865..268c0f57cf 100644 --- a/terminal_connectiontoken.go +++ b/terminal_connectiontoken.go @@ -9,10 +9,17 @@ package stripe // To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. On your backend, add an endpoint that creates and returns a connection token. type TerminalConnectionTokenParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The id of the location that this connection token is scoped to. If specified the connection token will only be usable with readers assigned to that location, otherwise the connection token will be usable with all readers. Note that location scoping only applies to internet-connected readers. For more details, see [the docs on scoping connection tokens](https://stripe.com/docs/terminal/fleet/locations#connection-tokens). Location *string `form:"location"` } +// AddExpand appends a new field to expand. +func (p *TerminalConnectionTokenParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A Connection Token is used by the Stripe Terminal SDK to connect to a reader. // // Related guide: [Fleet management](https://stripe.com/docs/terminal/fleet/locations) diff --git a/terminal_location.go b/terminal_location.go index 7fbcd818c5..d15cf648ab 100644 --- a/terminal_location.go +++ b/terminal_location.go @@ -17,11 +17,36 @@ type TerminalLocationParams struct { ConfigurationOverrides *string `form:"configuration_overrides"` // A name for the location. DisplayName *string `form:"display_name"` + // 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"` +} + +// AddExpand appends a new field to expand. +func (p *TerminalLocationParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TerminalLocationParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value } // Returns a list of Location objects. type TerminalLocationListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TerminalLocationListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // A Location represents a grouping of readers. diff --git a/terminal_reader.go b/terminal_reader.go index 8d72694884..eeda2322da 100644 --- a/terminal_reader.go +++ b/terminal_reader.go @@ -61,25 +61,50 @@ const ( // Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. type TerminalReaderParams struct { Params `form:"*"` - // The new label of the reader. + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` + // Custom label given to the reader for easier identification. If no label is specified, the registration code will be used. Label *string `form:"label"` // The location to assign the reader to. Location *string `form:"location"` + // 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"` // A code generated by the reader used for registering to an account. RegistrationCode *string `form:"registration_code"` } +// AddExpand appends a new field to expand. +func (p *TerminalReaderParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TerminalReaderParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of Reader objects. type TerminalReaderListParams struct { ListParams `form:"*"` // Filters readers by device type DeviceType *string `form:"device_type"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A location ID to filter the response list to only readers at the specific location Location *string `form:"location"` // A status filter to filter readers to only offline or online readers Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TerminalReaderListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Tipping configuration for this transaction. type TerminalReaderProcessPaymentIntentProcessConfigTippingParams struct { // Amount used to calculate tip suggestions on tipping selection screen for this transaction. Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency). @@ -97,12 +122,19 @@ type TerminalReaderProcessPaymentIntentProcessConfigParams struct { // Initiates a payment flow on a Reader. type TerminalReaderProcessPaymentIntentParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // PaymentIntent ID PaymentIntent *string `form:"payment_intent"` // Configuration overrides ProcessConfig *TerminalReaderProcessPaymentIntentProcessConfigParams `form:"process_config"` } +// AddExpand appends a new field to expand. +func (p *TerminalReaderProcessPaymentIntentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Configuration overrides type TerminalReaderProcessSetupIntentProcessConfigParams struct{} @@ -111,15 +143,29 @@ type TerminalReaderProcessSetupIntentParams struct { Params `form:"*"` // Customer Consent Collected CustomerConsentCollected *bool `form:"customer_consent_collected"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Configuration overrides ProcessConfig *TerminalReaderProcessSetupIntentProcessConfigParams `form:"process_config"` // SetupIntent ID SetupIntent *string `form:"setup_intent"` } +// AddExpand appends a new field to expand. +func (p *TerminalReaderProcessSetupIntentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Cancels the current reader action. type TerminalReaderCancelActionParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TerminalReaderCancelActionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Array of line items that were purchased. @@ -149,10 +195,17 @@ type TerminalReaderSetReaderDisplayParams struct { Params `form:"*"` // Cart Cart *TerminalReaderSetReaderDisplayCartParams `form:"cart"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Type Type *string `form:"type"` } +// AddExpand appends a new field to expand. +func (p *TerminalReaderSetReaderDisplayParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Initiates a refund on a Reader type TerminalReaderRefundPaymentParams struct { Params `form:"*"` @@ -160,6 +213,10 @@ type TerminalReaderRefundPaymentParams struct { Amount *int64 `form:"amount"` // ID of the Charge to refund. Charge *string `form:"charge"` + // 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"` // ID of the PaymentIntent to refund. PaymentIntent *string `form:"payment_intent"` // Boolean indicating whether the application fee should be refunded when refunding this charge. If a full charge refund is given, the full application fee will be refunded. Otherwise, the application fee will be refunded in an amount proportional to the amount of the charge refunded. An application fee can be refunded only by the application that created the charge. @@ -168,6 +225,20 @@ type TerminalReaderRefundPaymentParams struct { ReverseTransfer *bool `form:"reverse_transfer"` } +// AddExpand appends a new field to expand. +func (p *TerminalReaderRefundPaymentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TerminalReaderRefundPaymentParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Represents a per-transaction tipping configuration type TerminalReaderActionProcessPaymentIntentProcessConfigTipping struct { // Amount used to calculate tip suggestions on tipping selection screen for this transaction. Must be a positive integer in the smallest currency unit (e.g., 100 cents to represent $1.00 or 100 to represent ¥100, a zero-decimal currency). diff --git a/testhelpers/customer/client.go b/testhelpers/customer/client.go index 6ce9939a2f..d81a104f79 100644 --- a/testhelpers/customer/client.go +++ b/testhelpers/customer/client.go @@ -10,7 +10,7 @@ package customer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /customers APIs. diff --git a/testhelpers/issuing/card/client.go b/testhelpers/issuing/card/client.go index d02c6aed02..c50ba15350 100644 --- a/testhelpers/issuing/card/client.go +++ b/testhelpers/issuing/card/client.go @@ -10,7 +10,7 @@ package card import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /issuing/cards APIs. diff --git a/testhelpers/refund/client.go b/testhelpers/refund/client.go index 483884c12c..3985904d8e 100644 --- a/testhelpers/refund/client.go +++ b/testhelpers/refund/client.go @@ -10,7 +10,7 @@ package refund import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /refunds APIs. diff --git a/testhelpers/terminal/reader/client.go b/testhelpers/terminal/reader/client.go index a6a0f820fa..3786b6f15a 100644 --- a/testhelpers/terminal/reader/client.go +++ b/testhelpers/terminal/reader/client.go @@ -10,7 +10,7 @@ package reader import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /terminal/readers APIs. diff --git a/testhelpers/testclock/client.go b/testhelpers/testclock/client.go index d43f79654e..615026a930 100644 --- a/testhelpers/testclock/client.go +++ b/testhelpers/testclock/client.go @@ -10,8 +10,8 @@ package testclock import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /test_helpers/test_clocks APIs. diff --git a/testhelpers/treasury/inboundtransfer/client.go b/testhelpers/treasury/inboundtransfer/client.go index 255322fbf4..d56820e762 100644 --- a/testhelpers/treasury/inboundtransfer/client.go +++ b/testhelpers/treasury/inboundtransfer/client.go @@ -10,7 +10,7 @@ package inboundtransfer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /treasury/inbound_transfers APIs. diff --git a/testhelpers/treasury/outboundpayment/client.go b/testhelpers/treasury/outboundpayment/client.go index 26adb82ed7..db057ecf0c 100644 --- a/testhelpers/treasury/outboundpayment/client.go +++ b/testhelpers/treasury/outboundpayment/client.go @@ -10,7 +10,7 @@ package outboundpayment import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /treasury/outbound_payments APIs. diff --git a/testhelpers/treasury/outboundtransfer/client.go b/testhelpers/treasury/outboundtransfer/client.go index 945b133157..40670e0766 100644 --- a/testhelpers/treasury/outboundtransfer/client.go +++ b/testhelpers/treasury/outboundtransfer/client.go @@ -10,7 +10,7 @@ package outboundtransfer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /treasury/outbound_transfers APIs. diff --git a/testhelpers/treasury/receivedcredit/client.go b/testhelpers/treasury/receivedcredit/client.go index 9459e3e6bc..833af4b758 100644 --- a/testhelpers/treasury/receivedcredit/client.go +++ b/testhelpers/treasury/receivedcredit/client.go @@ -10,7 +10,7 @@ package receivedcredit import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /treasury/received_credits APIs. diff --git a/testhelpers/treasury/receiveddebit/client.go b/testhelpers/treasury/receiveddebit/client.go index 68c1e329ef..1335503e8e 100644 --- a/testhelpers/treasury/receiveddebit/client.go +++ b/testhelpers/treasury/receiveddebit/client.go @@ -10,7 +10,7 @@ package receiveddebit import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /treasury/received_debits APIs. diff --git a/testhelpers_customer.go b/testhelpers_customer.go index a328d1a21b..dc6b7de6b8 100644 --- a/testhelpers_customer.go +++ b/testhelpers_customer.go @@ -13,6 +13,13 @@ type TestHelpersCustomerFundCashBalanceParams struct { Amount *int64 `form:"amount"` // 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"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // A description of the test funding. This simulates free-text references supplied by customers when making bank transfers to their cash balance. You can use this to test how Stripe's [reconciliation algorithm](https://stripe.com/docs/payments/customer-balance/reconciliation) applies to different user inputs. Reference *string `form:"reference"` } + +// AddExpand appends a new field to expand. +func (p *TestHelpersCustomerFundCashBalanceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} diff --git a/testhelpers_refund.go b/testhelpers_refund.go index 6d0889afb9..fbba1dd22f 100644 --- a/testhelpers_refund.go +++ b/testhelpers_refund.go @@ -9,4 +9,11 @@ package stripe // Expire a refund with a status of requires_action. type TestHelpersRefundExpireParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersRefundExpireParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } diff --git a/testhelpers_testclock.go b/testhelpers_testclock.go index c249b2d5e3..f5ca0525bd 100644 --- a/testhelpers_testclock.go +++ b/testhelpers_testclock.go @@ -21,24 +21,45 @@ const ( // Retrieves a test clock. type TestHelpersTestClockParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The initial frozen time for this test clock. FrozenTime *int64 `form:"frozen_time"` // The name for this test clock. Name *string `form:"name"` } +// AddExpand appends a new field to expand. +func (p *TestHelpersTestClockParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Returns a list of your test clocks. type TestHelpersTestClockListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTestClockListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready. type TestHelpersTestClockAdvanceParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The time to advance the test clock. Must be after the test clock's current frozen time. Cannot be more than two intervals in the future from the shortest subscription in this test clock. If there are no subscriptions in this test clock, it cannot be more than two years in the future. FrozenTime *int64 `form:"frozen_time"` } +// AddExpand appends a new field to expand. +func (p *TestHelpersTestClockAdvanceParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A test clock enables deterministic control over objects in testmode. With a test clock, you can create // objects at a frozen time in the past or future, and advance to a specific future time to observe webhooks and state changes. After the clock advances, // you can either validate the current state of your scenario (and test your assumptions), change the current state of your scenario (and test more complex scenarios), or keep advancing forward in time. diff --git a/testhelpersissuing_card.go b/testhelpersissuing_card.go index 783cfbb98c..4171b973fc 100644 --- a/testhelpersissuing_card.go +++ b/testhelpersissuing_card.go @@ -9,19 +9,47 @@ package stripe // Updates the shipping status of the specified Issuing Card object to delivered. type TestHelpersIssuingCardDeliverCardParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersIssuingCardDeliverCardParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Updates the shipping status of the specified Issuing Card object to shipped. type TestHelpersIssuingCardShipCardParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersIssuingCardShipCardParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Updates the shipping status of the specified Issuing Card object to returned. type TestHelpersIssuingCardReturnCardParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersIssuingCardReturnCardParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Updates the shipping status of the specified Issuing Card object to failure. type TestHelpersIssuingCardFailCardParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersIssuingCardFailCardParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } diff --git a/testhelpersterminal_reader.go b/testhelpersterminal_reader.go index 47fc84498f..abab5df94e 100644 --- a/testhelpersterminal_reader.go +++ b/testhelpersterminal_reader.go @@ -25,8 +25,15 @@ type TestHelpersTerminalReaderPresentPaymentMethodParams struct { AmountTip *int64 `form:"amount_tip"` // Simulated data for the card_present payment method. CardPresent *TestHelpersTerminalReaderPresentPaymentMethodCardPresentParams `form:"card_present"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Simulated data for the interac_present payment method. InteracPresent *TestHelpersTerminalReaderPresentPaymentMethodInteracPresentParams `form:"interac_present"` // Simulated payment type. Type *string `form:"type"` } + +// AddExpand appends a new field to expand. +func (p *TestHelpersTerminalReaderPresentPaymentMethodParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} diff --git a/testhelperstreasury_inboundtransfer.go b/testhelperstreasury_inboundtransfer.go index 263a20726e..0453f6611a 100644 --- a/testhelperstreasury_inboundtransfer.go +++ b/testhelperstreasury_inboundtransfer.go @@ -9,6 +9,13 @@ package stripe // Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. type TestHelpersTreasuryInboundTransferSucceedParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryInboundTransferSucceedParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Details about a failed InboundTransfer. @@ -20,11 +27,25 @@ type TestHelpersTreasuryInboundTransferFailFailureDetailsParams struct { // Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. type TestHelpersTreasuryInboundTransferFailParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Details about a failed InboundTransfer. FailureDetails *TestHelpersTreasuryInboundTransferFailFailureDetailsParams `form:"failure_details"` } +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryInboundTransferFailParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state. type TestHelpersTreasuryInboundTransferReturnInboundTransferParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryInboundTransferReturnInboundTransferParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } diff --git a/testhelperstreasury_outboundpayment.go b/testhelperstreasury_outboundpayment.go index a3bf8de955..129fefb381 100644 --- a/testhelperstreasury_outboundpayment.go +++ b/testhelperstreasury_outboundpayment.go @@ -9,11 +9,25 @@ package stripe // Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state. type TestHelpersTreasuryOutboundPaymentFailParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryOutboundPaymentFailParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state. type TestHelpersTreasuryOutboundPaymentPostParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryOutboundPaymentPostParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Optional hash to set the the return code. @@ -25,6 +39,13 @@ type TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentReturnedDetailsParam // Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state. type TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Optional hash to set the the return code. ReturnedDetails *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentReturnedDetailsParams `form:"returned_details"` } + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryOutboundPaymentReturnOutboundPaymentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} diff --git a/testhelperstreasury_outboundtransfer.go b/testhelperstreasury_outboundtransfer.go index cd5cea25a5..126b2ed0d0 100644 --- a/testhelperstreasury_outboundtransfer.go +++ b/testhelperstreasury_outboundtransfer.go @@ -9,11 +9,25 @@ package stripe // Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state. type TestHelpersTreasuryOutboundTransferFailParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryOutboundTransferFailParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state. type TestHelpersTreasuryOutboundTransferPostParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryOutboundTransferPostParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Details about a returned OutboundTransfer. @@ -25,6 +39,13 @@ type TestHelpersTreasuryOutboundTransferReturnOutboundTransferReturnedDetailsPar // Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state. type TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Details about a returned OutboundTransfer. ReturnedDetails *TestHelpersTreasuryOutboundTransferReturnOutboundTransferReturnedDetailsParams `form:"returned_details"` } + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryOutboundTransferReturnOutboundTransferParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} diff --git a/testhelperstreasury_receivedcredit.go b/testhelperstreasury_receivedcredit.go index 876e52d7de..2ef9e0880a 100644 --- a/testhelperstreasury_receivedcredit.go +++ b/testhelperstreasury_receivedcredit.go @@ -33,6 +33,8 @@ type TestHelpersTreasuryReceivedCreditParams struct { Currency *string `form:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount to send funds to. FinancialAccount *string `form:"financial_account"` // Initiating payment method details for the object. @@ -40,3 +42,8 @@ type TestHelpersTreasuryReceivedCreditParams struct { // The rails used for the object. Network *string `form:"network"` } + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryReceivedCreditParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} diff --git a/testhelperstreasury_receiveddebit.go b/testhelperstreasury_receiveddebit.go index 2786b8ae12..07d7e6d86e 100644 --- a/testhelperstreasury_receiveddebit.go +++ b/testhelperstreasury_receiveddebit.go @@ -33,6 +33,8 @@ type TestHelpersTreasuryReceivedDebitParams struct { Currency *string `form:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount to pull funds from. FinancialAccount *string `form:"financial_account"` // Initiating payment method details for the object. @@ -40,3 +42,8 @@ type TestHelpersTreasuryReceivedDebitParams struct { // The rails used for the object. Network *string `form:"network"` } + +// AddExpand appends a new field to expand. +func (p *TestHelpersTreasuryReceivedDebitParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} diff --git a/token.go b/token.go index ef6a27ca0c..a7f9692c33 100644 --- a/token.go +++ b/token.go @@ -30,12 +30,19 @@ type TokenParams struct { Customer *string `form:"customer"` // The updated CVC value this token will represent. CVCUpdate *TokenCVCUpdateParams `form:"cvc_update"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Information for the person this token will represent. Person *PersonParams `form:"person"` // The PII this token will represent. PII *TokenPIIParams `form:"pii"` } +// AddExpand appends a new field to expand. +func (p *TokenParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Information for the account this token will represent. type TokenAccountParams struct { // The business type. diff --git a/token/client.go b/token/client.go index 1bf0ba1f8b..00947c9677 100644 --- a/token/client.go +++ b/token/client.go @@ -10,7 +10,7 @@ package token import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /tokens APIs. diff --git a/topup.go b/topup.go index 4ab60a4e80..1ef1da73f8 100644 --- a/topup.go +++ b/topup.go @@ -29,6 +29,10 @@ type TopupParams struct { Currency *string `form:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // 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 ID of a source to transfer funds from. For most users, this should be left unspecified which will use the bank account that was set up in the dashboard for the specified currency. In test mode, this can be a test bank token (see [Testing Top-ups](https://stripe.com/docs/connect/testing#testing-top-ups)). Source *string `form:"source"` // Extra information about a top-up for the source's bank statement. Limited to 15 ASCII characters. @@ -37,6 +41,20 @@ type TopupParams struct { TransferGroup *string `form:"transfer_group"` } +// AddExpand appends a new field to expand. +func (p *TopupParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TopupParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of top-ups. type TopupListParams struct { ListParams `form:"*"` @@ -48,10 +66,17 @@ type TopupListParams struct { Created *int64 `form:"created"` // A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options. CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return top-ups that have the given status. One of `canceled`, `failed`, `pending` or `succeeded`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TopupListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // To top up your Stripe balance, you create a top-up object. You can retrieve // individual top-ups, as well as list all top-ups. Top-ups are identified by a // unique, random ID. diff --git a/topup/client.go b/topup/client.go index 42830cdd83..988c87c492 100644 --- a/topup/client.go +++ b/topup/client.go @@ -10,8 +10,8 @@ package topup import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /topups APIs. diff --git a/transfer.go b/transfer.go index 7568acc61b..0613a37e28 100644 --- a/transfer.go +++ b/transfer.go @@ -29,6 +29,10 @@ type TransferParams struct { Description *string `form:"description"` // The ID of a connected Stripe account. [See the Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers) for details. Destination *string `form:"destination"` + // 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"` // You can use this parameter to transfer funds from a charge before they are added to your available balance. A pending balance will transfer immediately but the funds will not become available until the original charge becomes available. [See the Connect documentation](https://stripe.com/docs/connect/separate-charges-and-transfers#transfer-availability) for details. SourceTransaction *string `form:"source_transaction"` // The source balance to use for this transfer. One of `bank_account`, `card`, or `fpx`. For most users, this will default to `card`. @@ -37,6 +41,20 @@ type TransferParams struct { TransferGroup *string `form:"transfer_group"` } +// AddExpand appends a new field to expand. +func (p *TransferParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TransferParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // 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:"*"` @@ -44,10 +62,17 @@ type TransferListParams struct { CreatedRange *RangeQueryParams `form:"created"` // Only return transfers for the destination specified by this account ID. Destination *string `form:"destination"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Only return transfers with the specified transfer group. TransferGroup *string `form:"transfer_group"` } +// AddExpand appends a new field to expand. +func (p *TransferListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // A `Transfer` object is created when you move funds between Stripe accounts as // part of Connect. // diff --git a/transfer/client.go b/transfer/client.go index 9d647d08b2..844ba3b5dd 100644 --- a/transfer/client.go +++ b/transfer/client.go @@ -10,8 +10,8 @@ package transfer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /transfers APIs. diff --git a/transferreversal.go b/transferreversal.go index 63b3a380b3..33fc8a7d8d 100644 --- a/transferreversal.go +++ b/transferreversal.go @@ -20,14 +20,39 @@ type TransferReversalParams struct { Amount *int64 `form:"amount"` // An arbitrary string which you can attach to a reversal object. It is displayed alongside the reversal in the Dashboard. This will be unset if you POST an empty value. Description *string `form:"description"` + // 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"` // Boolean indicating whether the application fee should be refunded when reversing this transfer. If a full transfer reversal is given, the full application fee will be refunded. Otherwise, the application fee will be refunded with an amount proportional to the amount of the transfer reversed. RefundApplicationFee *bool `form:"refund_application_fee"` } +// AddExpand appends a new field to expand. +func (p *TransferReversalParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TransferReversalParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // You can see a list of the reversals belonging to a specific transfer. Note that the 10 most recent reversals are always available by default on the transfer object. If you need more than those 10, you can use this API method and the limit and starting_after parameters to page through additional reversals. type TransferReversalListParams struct { ListParams `form:"*"` ID *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TransferReversalListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // [Stripe Connect](https://stripe.com/docs/connect) platforms can reverse transfers made to a diff --git a/transferreversal/client.go b/transferreversal/client.go index 8f462addd5..a2d817936d 100644 --- a/transferreversal/client.go +++ b/transferreversal/client.go @@ -11,8 +11,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /transfers/{id}/reversals APIs. diff --git a/treasury/creditreversal/client.go b/treasury/creditreversal/client.go index 24b10de890..c267d72862 100644 --- a/treasury/creditreversal/client.go +++ b/treasury/creditreversal/client.go @@ -10,8 +10,8 @@ package creditreversal import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/credit_reversals APIs. diff --git a/treasury/debitreversal/client.go b/treasury/debitreversal/client.go index 547392d030..cd520400af 100644 --- a/treasury/debitreversal/client.go +++ b/treasury/debitreversal/client.go @@ -10,8 +10,8 @@ package debitreversal import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/debit_reversals APIs. diff --git a/treasury/financialaccount/client.go b/treasury/financialaccount/client.go index c025f14d9a..db6225f5ec 100644 --- a/treasury/financialaccount/client.go +++ b/treasury/financialaccount/client.go @@ -10,8 +10,8 @@ package financialaccount import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/financial_accounts APIs. diff --git a/treasury/inboundtransfer/client.go b/treasury/inboundtransfer/client.go index f65a7eaed6..453f530e17 100644 --- a/treasury/inboundtransfer/client.go +++ b/treasury/inboundtransfer/client.go @@ -10,8 +10,8 @@ package inboundtransfer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/inbound_transfers APIs. diff --git a/treasury/outboundpayment/client.go b/treasury/outboundpayment/client.go index d697ae7419..0408d77ec1 100644 --- a/treasury/outboundpayment/client.go +++ b/treasury/outboundpayment/client.go @@ -10,8 +10,8 @@ package outboundpayment import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/outbound_payments APIs. diff --git a/treasury/outboundtransfer/client.go b/treasury/outboundtransfer/client.go index ebd19f17c0..15bfdb6b6d 100644 --- a/treasury/outboundtransfer/client.go +++ b/treasury/outboundtransfer/client.go @@ -10,8 +10,8 @@ package outboundtransfer import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/outbound_transfers APIs. diff --git a/treasury/receivedcredit/client.go b/treasury/receivedcredit/client.go index 4ad8c170c8..74985026e8 100644 --- a/treasury/receivedcredit/client.go +++ b/treasury/receivedcredit/client.go @@ -10,8 +10,8 @@ package receivedcredit import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/received_credits APIs. diff --git a/treasury/receiveddebit/client.go b/treasury/receiveddebit/client.go index 89118a98c8..12f4276190 100644 --- a/treasury/receiveddebit/client.go +++ b/treasury/receiveddebit/client.go @@ -10,8 +10,8 @@ package receiveddebit import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/received_debits APIs. diff --git a/treasury/transaction/client.go b/treasury/transaction/client.go index 84e63a4d9a..75a0cd7db3 100644 --- a/treasury/transaction/client.go +++ b/treasury/transaction/client.go @@ -10,8 +10,8 @@ package transaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/transactions APIs. diff --git a/treasury/transactionentry/client.go b/treasury/transactionentry/client.go index 6e25491357..1902119013 100644 --- a/treasury/transactionentry/client.go +++ b/treasury/transactionentry/client.go @@ -10,8 +10,8 @@ package transactionentry import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /treasury/transaction_entries APIs. diff --git a/treasury_creditreversal.go b/treasury_creditreversal.go index 8ab67bc3e0..0f64913831 100644 --- a/treasury_creditreversal.go +++ b/treasury_creditreversal.go @@ -28,6 +28,8 @@ const ( // Returns a list of CreditReversals. type TreasuryCreditReversalListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // Only return CreditReversals for the ReceivedCredit ID. @@ -36,12 +38,36 @@ type TreasuryCreditReversalListParams struct { Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryCreditReversalListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Reverses a ReceivedCredit and creates a CreditReversal object. type TreasuryCreditReversalParams struct { Params `form:"*"` + // 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 ReceivedCredit to reverse. ReceivedCredit *string `form:"received_credit"` } + +// AddExpand appends a new field to expand. +func (p *TreasuryCreditReversalParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryCreditReversalParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + type TreasuryCreditReversalStatusTransitions struct { // Timestamp describing when the CreditReversal changed status to `posted` PostedAt int64 `json:"posted_at"` diff --git a/treasury_debitreversal.go b/treasury_debitreversal.go index 266f9faea6..aaa3b87b96 100644 --- a/treasury_debitreversal.go +++ b/treasury_debitreversal.go @@ -28,13 +28,33 @@ const ( // Reverses a ReceivedDebit and creates a DebitReversal object. type TreasuryDebitReversalParams struct { Params `form:"*"` + // 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 ReceivedDebit to reverse. ReceivedDebit *string `form:"received_debit"` } +// AddExpand appends a new field to expand. +func (p *TreasuryDebitReversalParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryDebitReversalParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of DebitReversals. type TreasuryDebitReversalListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // Only return DebitReversals for the ReceivedDebit ID. @@ -45,6 +65,11 @@ type TreasuryDebitReversalListParams struct { Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryDebitReversalListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Other flows linked to a DebitReversal. type TreasuryDebitReversalLinkedFlows struct { // Set if there is an Issuing dispute associated with the DebitReversal. diff --git a/treasury_financialaccount.go b/treasury_financialaccount.go index b65b986539..59aaf44356 100644 --- a/treasury_financialaccount.go +++ b/treasury_financialaccount.go @@ -13,7 +13,7 @@ type TreasuryFinancialAccountActiveFeature string const ( TreasuryFinancialAccountActiveFeatureCardIssuing TreasuryFinancialAccountActiveFeature = "card_issuing" TreasuryFinancialAccountActiveFeatureDepositInsurance TreasuryFinancialAccountActiveFeature = "deposit_insurance" - TreasuryFinancialAccountActiveFeatureFinancialAddressesAba TreasuryFinancialAccountActiveFeature = "financial_addresses.aba" + TreasuryFinancialAccountActiveFeatureFinancialAddressesABA TreasuryFinancialAccountActiveFeature = "financial_addresses.aba" TreasuryFinancialAccountActiveFeatureInboundTransfersACH TreasuryFinancialAccountActiveFeature = "inbound_transfers.ach" TreasuryFinancialAccountActiveFeatureIntraStripeFlows TreasuryFinancialAccountActiveFeature = "intra_stripe_flows" TreasuryFinancialAccountActiveFeatureOutboundPaymentsACH TreasuryFinancialAccountActiveFeature = "outbound_payments.ach" @@ -37,7 +37,7 @@ type TreasuryFinancialAccountFinancialAddressType string // List of values that TreasuryFinancialAccountFinancialAddressType can take const ( - TreasuryFinancialAccountFinancialAddressTypeAba TreasuryFinancialAccountFinancialAddressType = "aba" + TreasuryFinancialAccountFinancialAddressTypeABA TreasuryFinancialAccountFinancialAddressType = "aba" ) // The array of paths to pending Features in the Features hash. @@ -47,7 +47,7 @@ type TreasuryFinancialAccountPendingFeature string const ( TreasuryFinancialAccountPendingFeatureCardIssuing TreasuryFinancialAccountPendingFeature = "card_issuing" TreasuryFinancialAccountPendingFeatureDepositInsurance TreasuryFinancialAccountPendingFeature = "deposit_insurance" - TreasuryFinancialAccountPendingFeatureFinancialAddressesAba TreasuryFinancialAccountPendingFeature = "financial_addresses.aba" + TreasuryFinancialAccountPendingFeatureFinancialAddressesABA TreasuryFinancialAccountPendingFeature = "financial_addresses.aba" TreasuryFinancialAccountPendingFeatureInboundTransfersACH TreasuryFinancialAccountPendingFeature = "inbound_transfers.ach" TreasuryFinancialAccountPendingFeatureIntraStripeFlows TreasuryFinancialAccountPendingFeature = "intra_stripe_flows" TreasuryFinancialAccountPendingFeatureOutboundPaymentsACH TreasuryFinancialAccountPendingFeature = "outbound_payments.ach" @@ -82,7 +82,7 @@ type TreasuryFinancialAccountRestrictedFeature string const ( TreasuryFinancialAccountRestrictedFeatureCardIssuing TreasuryFinancialAccountRestrictedFeature = "card_issuing" TreasuryFinancialAccountRestrictedFeatureDepositInsurance TreasuryFinancialAccountRestrictedFeature = "deposit_insurance" - TreasuryFinancialAccountRestrictedFeatureFinancialAddressesAba TreasuryFinancialAccountRestrictedFeature = "financial_addresses.aba" + TreasuryFinancialAccountRestrictedFeatureFinancialAddressesABA TreasuryFinancialAccountRestrictedFeature = "financial_addresses.aba" TreasuryFinancialAccountRestrictedFeatureInboundTransfersACH TreasuryFinancialAccountRestrictedFeature = "inbound_transfers.ach" TreasuryFinancialAccountRestrictedFeatureIntraStripeFlows TreasuryFinancialAccountRestrictedFeature = "intra_stripe_flows" TreasuryFinancialAccountRestrictedFeatureOutboundPaymentsACH TreasuryFinancialAccountRestrictedFeature = "outbound_payments.ach" @@ -124,7 +124,7 @@ type TreasuryFinancialAccountFeaturesDepositInsuranceParams struct { } // Adds an ABA FinancialAddress to the FinancialAccount. -type TreasuryFinancialAccountFeaturesFinancialAddressesAbaParams struct { +type TreasuryFinancialAccountFeaturesFinancialAddressesABAParams struct { // Whether the FinancialAccount should have the Feature. Requested *bool `form:"requested"` } @@ -132,7 +132,7 @@ type TreasuryFinancialAccountFeaturesFinancialAddressesAbaParams struct { // Contains Features that add FinancialAddresses to the FinancialAccount. type TreasuryFinancialAccountFeaturesFinancialAddressesParams struct { // Adds an ABA FinancialAddress to the FinancialAccount. - Aba *TreasuryFinancialAccountFeaturesFinancialAddressesAbaParams `form:"aba"` + ABA *TreasuryFinancialAccountFeaturesFinancialAddressesABAParams `form:"aba"` } // Enables ACH Debits via the InboundTransfers API. @@ -222,19 +222,44 @@ type TreasuryFinancialAccountPlatformRestrictionsParams struct { // Creates a new FinancialAccount. For now, each connected account can only have one FinancialAccount. type TreasuryFinancialAccountParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Encodes whether a FinancialAccount has access to a particular feature, with a status enum and associated `status_details`. Stripe or the platform may control features via the requested field. Features *TreasuryFinancialAccountFeaturesParams `form:"features"` + // 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 set of functionalities that the platform can restrict on the FinancialAccount. PlatformRestrictions *TreasuryFinancialAccountPlatformRestrictionsParams `form:"platform_restrictions"` // The currencies the FinancialAccount can hold a balance in. SupportedCurrencies []*string `form:"supported_currencies"` } +// AddExpand appends a new field to expand. +func (p *TreasuryFinancialAccountParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryFinancialAccountParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of FinancialAccounts. type TreasuryFinancialAccountListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TreasuryFinancialAccountListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Encodes the FinancialAccount's ability to be used with the Issuing product, including attaching cards to and drawing funds from the FinancialAccount. @@ -250,7 +275,7 @@ type TreasuryFinancialAccountUpdateFeaturesDepositInsuranceParams struct { } // Adds an ABA FinancialAddress to the FinancialAccount. -type TreasuryFinancialAccountUpdateFeaturesFinancialAddressesAbaParams struct { +type TreasuryFinancialAccountUpdateFeaturesFinancialAddressesABAParams struct { // Whether the FinancialAccount should have the Feature. Requested *bool `form:"requested"` } @@ -258,7 +283,7 @@ type TreasuryFinancialAccountUpdateFeaturesFinancialAddressesAbaParams struct { // Contains Features that add FinancialAddresses to the FinancialAccount. type TreasuryFinancialAccountUpdateFeaturesFinancialAddressesParams struct { // Adds an ABA FinancialAddress to the FinancialAccount. - Aba *TreasuryFinancialAccountUpdateFeaturesFinancialAddressesAbaParams `form:"aba"` + ABA *TreasuryFinancialAccountUpdateFeaturesFinancialAddressesABAParams `form:"aba"` } // Enables ACH Debits via the InboundTransfers API. @@ -326,6 +351,8 @@ type TreasuryFinancialAccountUpdateFeaturesParams struct { CardIssuing *TreasuryFinancialAccountUpdateFeaturesCardIssuingParams `form:"card_issuing"` // Represents whether this FinancialAccount is eligible for deposit insurance. Various factors determine the insurance amount. DepositInsurance *TreasuryFinancialAccountUpdateFeaturesDepositInsuranceParams `form:"deposit_insurance"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Contains Features that add FinancialAddresses to the FinancialAccount. FinancialAddresses *TreasuryFinancialAccountUpdateFeaturesFinancialAddressesParams `form:"financial_addresses"` // Contains settings related to adding funds to a FinancialAccount from another Account with the same owner. @@ -338,9 +365,21 @@ type TreasuryFinancialAccountUpdateFeaturesParams struct { OutboundTransfers *TreasuryFinancialAccountUpdateFeaturesOutboundTransfersParams `form:"outbound_transfers"` } +// AddExpand appends a new field to expand. +func (p *TreasuryFinancialAccountUpdateFeaturesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves Features information associated with the FinancialAccount. type TreasuryFinancialAccountRetrieveFeaturesParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TreasuryFinancialAccountRetrieveFeaturesParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Balance information for the FinancialAccount @@ -354,7 +393,7 @@ type TreasuryFinancialAccountBalance struct { } // ABA Records contain U.S. bank account details per the ABA format. -type TreasuryFinancialAccountFinancialAddressAba struct { +type TreasuryFinancialAccountFinancialAddressABA struct { // The name of the person or business that owns the bank account. AccountHolderName string `json:"account_holder_name"` // The account number. @@ -370,7 +409,7 @@ type TreasuryFinancialAccountFinancialAddressAba struct { // The set of credentials that resolve to a FinancialAccount. type TreasuryFinancialAccountFinancialAddress struct { // ABA Records contain U.S. bank account details per the ABA format. - Aba *TreasuryFinancialAccountFinancialAddressAba `json:"aba"` + ABA *TreasuryFinancialAccountFinancialAddressABA `json:"aba"` // The list of networks that the address supports SupportedNetworks []TreasuryFinancialAccountFinancialAddressSupportedNetwork `json:"supported_networks"` // The type of financial address diff --git a/treasury_financialaccountfeatures.go b/treasury_financialaccountfeatures.go index 6041ef6b24..b35cacc694 100644 --- a/treasury_financialaccountfeatures.go +++ b/treasury_financialaccountfeatures.go @@ -97,48 +97,48 @@ const ( ) // Whether the Feature is operational. -type TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatus string +type TreasuryFinancialAccountFeaturesFinancialAddressesABAStatus string -// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatus can take +// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesABAStatus can take const ( - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusActive TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatus = "active" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusPending TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatus = "pending" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusRestricted TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatus = "restricted" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusActive TreasuryFinancialAccountFeaturesFinancialAddressesABAStatus = "active" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusPending TreasuryFinancialAccountFeaturesFinancialAddressesABAStatus = "pending" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusRestricted TreasuryFinancialAccountFeaturesFinancialAddressesABAStatus = "restricted" ) // Represents the reason why the status is `pending` or `restricted`. -type TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode string +type TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode string -// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode can take +// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode can take const ( - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeActivating TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "activating" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeCapabilityNotRequested TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "capability_not_requested" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeFinancialAccountClosed TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "financial_account_closed" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeRejectedOther TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "rejected_other" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeRejectedUnsupportedBusiness TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "rejected_unsupported_business" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeRequirementsPastDue TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "requirements_past_due" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeRequirementsPendingVerification TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "requirements_pending_verification" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeRestrictedByPlatform TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "restricted_by_platform" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCodeRestrictedOther TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode = "restricted_other" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeActivating TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "activating" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeCapabilityNotRequested TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "capability_not_requested" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeFinancialAccountClosed TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "financial_account_closed" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeRejectedOther TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "rejected_other" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeRejectedUnsupportedBusiness TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "rejected_unsupported_business" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeRequirementsPastDue TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "requirements_past_due" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeRequirementsPendingVerification TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "requirements_pending_verification" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeRestrictedByPlatform TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "restricted_by_platform" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCodeRestrictedOther TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode = "restricted_other" ) // Represents what the user should do, if anything, to activate the Feature. -type TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolution string +type TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolution string -// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolution can take +// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolution can take const ( - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolutionContactStripe TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolution = "contact_stripe" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolutionProvideInformation TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolution = "provide_information" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolutionRemoveRestriction TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolution = "remove_restriction" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolutionContactStripe TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolution = "contact_stripe" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolutionProvideInformation TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolution = "provide_information" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolutionRemoveRestriction TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolution = "remove_restriction" ) // The `platform_restrictions` that are restricting this Feature. -type TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestriction string +type TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestriction string -// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestriction can take +// List of values that TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestriction can take const ( - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestrictionInboundFlows TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestriction = "inbound_flows" - TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestrictionOutboundFlows TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestriction = "outbound_flows" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestrictionInboundFlows TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestriction = "inbound_flows" + TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestrictionOutboundFlows TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestriction = "outbound_flows" ) // Whether the Feature is operational. @@ -452,29 +452,29 @@ type TreasuryFinancialAccountFeaturesDepositInsurance struct { } // Additional details; includes at least one entry when the status is not `active`. -type TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetail struct { +type TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetail struct { // Represents the reason why the status is `pending` or `restricted`. - Code TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailCode `json:"code"` + Code TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailCode `json:"code"` // Represents what the user should do, if anything, to activate the Feature. - Resolution TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailResolution `json:"resolution"` + Resolution TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailResolution `json:"resolution"` // The `platform_restrictions` that are restricting this Feature. - Restriction TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetailRestriction `json:"restriction"` + Restriction TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetailRestriction `json:"restriction"` } // Toggle settings for enabling/disabling the ABA address feature -type TreasuryFinancialAccountFeaturesFinancialAddressesAba struct { +type TreasuryFinancialAccountFeaturesFinancialAddressesABA struct { // Whether the FinancialAccount should have the Feature. Requested bool `json:"requested"` // Whether the Feature is operational. - Status TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatus `json:"status"` + Status TreasuryFinancialAccountFeaturesFinancialAddressesABAStatus `json:"status"` // Additional details; includes at least one entry when the status is not `active`. - StatusDetails []*TreasuryFinancialAccountFeaturesFinancialAddressesAbaStatusDetail `json:"status_details"` + StatusDetails []*TreasuryFinancialAccountFeaturesFinancialAddressesABAStatusDetail `json:"status_details"` } // Settings related to Financial Addresses features on a Financial Account type TreasuryFinancialAccountFeaturesFinancialAddresses struct { // Toggle settings for enabling/disabling the ABA address feature - Aba *TreasuryFinancialAccountFeaturesFinancialAddressesAba `json:"aba"` + ABA *TreasuryFinancialAccountFeaturesFinancialAddressesABA `json:"aba"` } // Additional details; includes at least one entry when the status is not `active`. diff --git a/treasury_inboundtransfer.go b/treasury_inboundtransfer.go index 1944e06695..e633488689 100644 --- a/treasury_inboundtransfer.go +++ b/treasury_inboundtransfer.go @@ -74,6 +74,13 @@ const ( // Cancels an InboundTransfer. type TreasuryInboundTransferCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TreasuryInboundTransferCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Creates an InboundTransfer. @@ -85,23 +92,48 @@ type TreasuryInboundTransferParams struct { Currency *string `form:"currency"` // An arbitrary string attached to the object. Often useful for displaying to users. Description *string `form:"description"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount to send funds to. FinancialAccount *string `form:"financial_account"` + // 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 origin payment method to be debited for the InboundTransfer. OriginPaymentMethod *string `form:"origin_payment_method"` // The complete description that appears on your customers' statements. Maximum 10 characters. StatementDescriptor *string `form:"statement_descriptor"` } +// AddExpand appends a new field to expand. +func (p *TreasuryInboundTransferParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryInboundTransferParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of InboundTransfers sent from the specified FinancialAccount. type TreasuryInboundTransferListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // Only return InboundTransfers that have the given status: `processing`, `succeeded`, `failed` or `canceled`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryInboundTransferListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Details about this InboundTransfer's failure. Only set when status is `failed`. type TreasuryInboundTransferFailureDetails struct { // Reason for the failure. diff --git a/treasury_outboundpayment.go b/treasury_outboundpayment.go index 8f929335a1..e7ed6ae045 100644 --- a/treasury_outboundpayment.go +++ b/treasury_outboundpayment.go @@ -119,6 +119,15 @@ type TreasuryOutboundPaymentDestinationPaymentMethodDataParams struct { USBankAccount *TreasuryOutboundPaymentDestinationPaymentMethodDataUSBankAccountParams `form:"us_bank_account"` } +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryOutboundPaymentDestinationPaymentMethodDataParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Optional fields for `us_bank_account`. type TreasuryOutboundPaymentDestinationPaymentMethodOptionsUSBankAccountParams struct { // The US bank account network that must be used for this OutboundPayment. If not set, we will default to the PaymentMethod's preferred network. @@ -158,27 +167,60 @@ type TreasuryOutboundPaymentParams struct { DestinationPaymentMethodOptions *TreasuryOutboundPaymentDestinationPaymentMethodOptionsParams `form:"destination_payment_method_options"` // End user details. EndUserDetails *TreasuryOutboundPaymentEndUserDetailsParams `form:"end_user_details"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount to pull funds from. FinancialAccount *string `form:"financial_account"` + // 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 description that appears on the receiving end for this OutboundPayment (for example, bank statement for external bank transfer). Maximum 10 characters for `ach` payments, 140 characters for `wire` payments, or 500 characters for `stripe` network transfers. The default value is `payment`. StatementDescriptor *string `form:"statement_descriptor"` } +// AddExpand appends a new field to expand. +func (p *TreasuryOutboundPaymentParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryOutboundPaymentParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of OutboundPayments sent from the specified FinancialAccount. type TreasuryOutboundPaymentListParams struct { ListParams `form:"*"` // Only return OutboundPayments sent to this customer. Customer *string `form:"customer"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // Only return OutboundPayments that have the given status: `processing`, `failed`, `posted`, `returned`, or `canceled`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryOutboundPaymentListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Cancel an OutboundPayment. type TreasuryOutboundPaymentCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *TreasuryOutboundPaymentCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type TreasuryOutboundPaymentDestinationPaymentMethodDetailsBillingDetails struct { Address *Address `json:"address"` // Email address. diff --git a/treasury_outboundtransfer.go b/treasury_outboundtransfer.go index 990892e95f..c7d12244bf 100644 --- a/treasury_outboundtransfer.go +++ b/treasury_outboundtransfer.go @@ -95,25 +95,58 @@ type TreasuryOutboundTransferParams struct { DestinationPaymentMethod *string `form:"destination_payment_method"` // Hash describing payment method configuration details. DestinationPaymentMethodOptions *TreasuryOutboundTransferDestinationPaymentMethodOptionsParams `form:"destination_payment_method_options"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount to pull funds from. FinancialAccount *string `form:"financial_account"` + // 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"` // Statement descriptor to be shown on the receiving end of an OutboundTransfer. Maximum 10 characters for `ach` transfers or 140 characters for `wire` transfers. The default value is `transfer`. StatementDescriptor *string `form:"statement_descriptor"` } +// AddExpand appends a new field to expand. +func (p *TreasuryOutboundTransferParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *TreasuryOutboundTransferParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // Returns a list of OutboundTransfers sent from the specified FinancialAccount. type TreasuryOutboundTransferListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // Only return OutboundTransfers that have the given status: `processing`, `canceled`, `failed`, `posted`, or `returned`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryOutboundTransferListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // An OutboundTransfer can be canceled if the funds have not yet been paid out. type TreasuryOutboundTransferCancelParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *TreasuryOutboundTransferCancelParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type TreasuryOutboundTransferDestinationPaymentMethodDetailsBillingDetails struct { Address *Address `json:"address"` // Email address. diff --git a/treasury_receivedcredit.go b/treasury_receivedcredit.go index 430b425d4e..04c656e733 100644 --- a/treasury_receivedcredit.go +++ b/treasury_receivedcredit.go @@ -96,6 +96,8 @@ type TreasuryReceivedCreditListLinkedFlowsParams struct { // Returns a list of ReceivedCredits. type TreasuryReceivedCreditListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount that received the funds. FinancialAccount *string `form:"financial_account"` // Only return ReceivedCredits described by the flow. @@ -104,10 +106,23 @@ type TreasuryReceivedCreditListParams struct { Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryReceivedCreditListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list. type TreasuryReceivedCreditParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *TreasuryReceivedCreditParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type TreasuryReceivedCreditInitiatingPaymentMethodDetailsBillingDetails struct { Address *Address `json:"address"` // Email address. diff --git a/treasury_receiveddebit.go b/treasury_receiveddebit.go index 9cb6e8f404..f547019bcb 100644 --- a/treasury_receiveddebit.go +++ b/treasury_receiveddebit.go @@ -79,16 +79,31 @@ const ( // Returns a list of ReceivedDebits. type TreasuryReceivedDebitListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The FinancialAccount that funds were pulled from. FinancialAccount *string `form:"financial_account"` // Only return ReceivedDebits that have the given status: `succeeded` or `failed`. Status *string `form:"status"` } +// AddExpand appends a new field to expand. +func (p *TreasuryReceivedDebitListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list type TreasuryReceivedDebitParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *TreasuryReceivedDebitParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type TreasuryReceivedDebitInitiatingPaymentMethodDetailsBillingDetails struct { Address *Address `json:"address"` // Email address. diff --git a/treasury_transaction.go b/treasury_transaction.go index 294b755bd7..e498551959 100644 --- a/treasury_transaction.go +++ b/treasury_transaction.go @@ -53,6 +53,13 @@ const ( // Retrieves the details of an existing Transaction. type TreasuryTransactionParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TreasuryTransactionParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // A filter for the `status_transitions.posted_at` timestamp. When using this filter, `status=posted` and `order_by=posted_at` must also be specified. @@ -68,6 +75,8 @@ type TreasuryTransactionListParams struct { ListParams `form:"*"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // The results are in reverse chronological order by `created` or `posted_at`. The default is `created`. @@ -78,6 +87,11 @@ type TreasuryTransactionListParams struct { StatusTransitions *TreasuryTransactionListStatusTransitionsParams `form:"status_transitions"` } +// AddExpand appends a new field to expand. +func (p *TreasuryTransactionListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Change to a FinancialAccount's balance type TreasuryTransactionBalanceImpact struct { // The change made to funds the user can spend right now. diff --git a/treasury_transactionentry.go b/treasury_transactionentry.go index 212b901a6f..b0d1537094 100644 --- a/treasury_transactionentry.go +++ b/treasury_transactionentry.go @@ -68,6 +68,13 @@ const ( // Retrieves a TransactionEntry object. type TreasuryTransactionEntryParams struct { Params `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *TreasuryTransactionEntryParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // Retrieves a list of TransactionEntry objects. @@ -77,6 +84,8 @@ type TreasuryTransactionEntryListParams struct { CreatedRange *RangeQueryParams `form:"created"` EffectiveAt *int64 `form:"effective_at"` EffectiveAtRange *RangeQueryParams `form:"effective_at"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // Returns objects associated with this FinancialAccount. FinancialAccount *string `form:"financial_account"` // The results are in reverse chronological order by `created` or `effective_at`. The default is `created`. @@ -85,6 +94,11 @@ type TreasuryTransactionEntryListParams struct { Transaction *string `form:"transaction"` } +// AddExpand appends a new field to expand. +func (p *TreasuryTransactionEntryListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // Change to a FinancialAccount's balance type TreasuryTransactionEntryBalanceImpact struct { // The change made to funds the user can spend right now. diff --git a/usagerecord.go b/usagerecord.go index 6870187a05..a10404b437 100644 --- a/usagerecord.go +++ b/usagerecord.go @@ -6,7 +6,7 @@ package stripe -import "github.com/stripe/stripe-go/v74/form" +import "github.com/stripe/stripe-go/v75/form" // Possible values for the action parameter on usage record creation. const ( @@ -26,6 +26,8 @@ type UsageRecordParams struct { SubscriptionItem *string `form:"-"` // Included in URL // Valid values are `increment` (default) or `set`. When using `increment` the specified `quantity` will be added to the usage at the specified timestamp. The `set` action will overwrite the usage quantity at that timestamp. If the subscription has [billing thresholds](https://stripe.com/docs/api/subscriptions/object#subscription_object-billing_thresholds), `increment` is the only allowed value. Action *string `form:"action"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` // The usage quantity for the specified timestamp. Quantity *int64 `form:"quantity"` // The timestamp for the usage event. This timestamp must be within the current billing period of the subscription of the provided `subscription_item`, and must not be in the future. When passing `"now"`, Stripe records usage for the current time. Default is `"now"` if a value is not provided. @@ -33,9 +35,14 @@ type UsageRecordParams struct { TimestampNow *bool `form:"-"` // See custom AppendTo } +// AddExpand appends a new field to expand. +func (p *UsageRecordParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + // AppendTo implements custom encoding logic for UsageRecordParams. -func (u *UsageRecordParams) AppendTo(body *form.Values, keyParts []string) { - if BoolValue(u.TimestampNow) { +func (p *UsageRecordParams) AppendTo(body *form.Values, keyParts []string) { + if BoolValue(p.TimestampNow) { body.Add(form.FormatKey(append(keyParts, "timestamp")), "now") } } diff --git a/usagerecord/client.go b/usagerecord/client.go index 643e94f93a..ec87b515fe 100644 --- a/usagerecord/client.go +++ b/usagerecord/client.go @@ -10,7 +10,7 @@ package usagerecord import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" + stripe "github.com/stripe/stripe-go/v75" ) // Client is used to invoke /subscription_items/{subscription_item}/usage_records APIs. diff --git a/usagerecordsummary.go b/usagerecordsummary.go index 68e7d6b119..a4f0829508 100644 --- a/usagerecordsummary.go +++ b/usagerecordsummary.go @@ -12,7 +12,15 @@ package stripe type UsageRecordSummaryListParams struct { ListParams `form:"*"` SubscriptionItem *string `form:"-"` // Included in URL + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` } + +// AddExpand appends a new field to expand. +func (p *UsageRecordSummaryListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + type UsageRecordSummary struct { // Unique identifier for the object. ID string `json:"id"` diff --git a/usagerecordsummary/client.go b/usagerecordsummary/client.go index 5bc1a6b144..34fcc62f8b 100644 --- a/usagerecordsummary/client.go +++ b/usagerecordsummary/client.go @@ -10,8 +10,8 @@ package usagerecordsummary import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /subscription_items/{subscription_item}/usage_record_summaries APIs. diff --git a/webhookendpoint.go b/webhookendpoint.go index 1ce5519ab1..03da2e28c9 100644 --- a/webhookendpoint.go +++ b/webhookendpoint.go @@ -9,6 +9,13 @@ package stripe // Returns a list of your webhook endpoints. type WebhookEndpointListParams struct { ListParams `form:"*"` + // Specifies which fields in the response should be expanded. + Expand []*string `form:"expand"` +} + +// AddExpand appends a new field to expand. +func (p *WebhookEndpointListParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) } // A webhook endpoint must have a url and a list of enabled_events. You may optionally specify the Boolean connect parameter. If set to true, then a Connect webhook endpoint that notifies the specified url about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified url only about events from your account is created. You can also create webhook endpoints in the [webhooks settings](https://dashboard.stripe.com/account/webhooks) section of the Dashboard. @@ -22,6 +29,10 @@ type WebhookEndpointParams struct { Disabled *bool `form:"disabled"` // The list of events to enable for this endpoint. You may specify `['*']` to enable all events, except those that require explicit selection. EnabledEvents []*string `form:"enabled_events"` + // 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 URL of the webhook endpoint. URL *string `form:"url"` // This parameter is only available on creation. @@ -30,6 +41,20 @@ type WebhookEndpointParams struct { APIVersion *string `form:"api_version"` } +// AddExpand appends a new field to expand. +func (p *WebhookEndpointParams) AddExpand(f string) { + p.Expand = append(p.Expand, &f) +} + +// AddMetadata adds a new key-value pair to the Metadata. +func (p *WebhookEndpointParams) AddMetadata(key string, value string) { + if p.Metadata == nil { + p.Metadata = make(map[string]string) + } + + p.Metadata[key] = value +} + // You can configure [webhook endpoints](https://stripe.com/docs/webhooks/) via the API to be // notified about events that happen in your Stripe account or connected // accounts. diff --git a/webhookendpoint/client.go b/webhookendpoint/client.go index a343a8f771..3ecb10155c 100644 --- a/webhookendpoint/client.go +++ b/webhookendpoint/client.go @@ -10,8 +10,8 @@ package webhookendpoint import ( "net/http" - stripe "github.com/stripe/stripe-go/v74" - "github.com/stripe/stripe-go/v74/form" + stripe "github.com/stripe/stripe-go/v75" + "github.com/stripe/stripe-go/v75/form" ) // Client is used to invoke /webhook_endpoints APIs.