github.com/stripe/stripe-go/v76@v76.25.0/issuing_cardholder.go (about)

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  import "encoding/json"
    10  
    11  // The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`.
    12  //
    13  //	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.
    14  type IssuingCardholderPreferredLocale string
    15  
    16  // List of values that IssuingCardholderPreferredLocale can take
    17  const (
    18  	IssuingCardholderPreferredLocaleDE IssuingCardholderPreferredLocale = "de"
    19  	IssuingCardholderPreferredLocaleEN IssuingCardholderPreferredLocale = "en"
    20  	IssuingCardholderPreferredLocaleES IssuingCardholderPreferredLocale = "es"
    21  	IssuingCardholderPreferredLocaleFR IssuingCardholderPreferredLocale = "fr"
    22  	IssuingCardholderPreferredLocaleIT IssuingCardholderPreferredLocale = "it"
    23  )
    24  
    25  // If `disabled_reason` is present, all cards will decline authorizations with `cardholder_verification_required` reason.
    26  type IssuingCardholderRequirementsDisabledReason string
    27  
    28  // List of values that IssuingCardholderRequirementsDisabledReason can take
    29  const (
    30  	IssuingCardholderRequirementsDisabledReasonListed              IssuingCardholderRequirementsDisabledReason = "listed"
    31  	IssuingCardholderRequirementsDisabledReasonRejectedListed      IssuingCardholderRequirementsDisabledReason = "rejected.listed"
    32  	IssuingCardholderRequirementsDisabledReasonRequirementsPastDue IssuingCardholderRequirementsDisabledReason = "requirements.past_due"
    33  	IssuingCardholderRequirementsDisabledReasonUnderReview         IssuingCardholderRequirementsDisabledReason = "under_review"
    34  )
    35  
    36  // Interval (or event) to which the amount applies.
    37  type IssuingCardholderSpendingControlsSpendingLimitInterval string
    38  
    39  // List of values that IssuingCardholderSpendingControlsSpendingLimitInterval can take
    40  const (
    41  	IssuingCardholderSpendingControlsSpendingLimitIntervalAllTime          IssuingCardholderSpendingControlsSpendingLimitInterval = "all_time"
    42  	IssuingCardholderSpendingControlsSpendingLimitIntervalDaily            IssuingCardholderSpendingControlsSpendingLimitInterval = "daily"
    43  	IssuingCardholderSpendingControlsSpendingLimitIntervalMonthly          IssuingCardholderSpendingControlsSpendingLimitInterval = "monthly"
    44  	IssuingCardholderSpendingControlsSpendingLimitIntervalPerAuthorization IssuingCardholderSpendingControlsSpendingLimitInterval = "per_authorization"
    45  	IssuingCardholderSpendingControlsSpendingLimitIntervalWeekly           IssuingCardholderSpendingControlsSpendingLimitInterval = "weekly"
    46  	IssuingCardholderSpendingControlsSpendingLimitIntervalYearly           IssuingCardholderSpendingControlsSpendingLimitInterval = "yearly"
    47  )
    48  
    49  // Specifies whether to permit authorizations on this cardholder's cards.
    50  type IssuingCardholderStatus string
    51  
    52  // List of values that IssuingCardholderStatus can take
    53  const (
    54  	IssuingCardholderStatusActive   IssuingCardholderStatus = "active"
    55  	IssuingCardholderStatusBlocked  IssuingCardholderStatus = "blocked"
    56  	IssuingCardholderStatusInactive IssuingCardholderStatus = "inactive"
    57  )
    58  
    59  // One of `individual` or `company`. See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details.
    60  type IssuingCardholderType string
    61  
    62  // List of values that IssuingCardholderType can take
    63  const (
    64  	IssuingCardholderTypeCompany    IssuingCardholderType = "company"
    65  	IssuingCardholderTypeIndividual IssuingCardholderType = "individual"
    66  )
    67  
    68  // Returns a list of Issuing Cardholder objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
    69  type IssuingCardholderListParams struct {
    70  	ListParams `form:"*"`
    71  	// Only return cardholders that were created during the given date interval.
    72  	Created *int64 `form:"created"`
    73  	// Only return cardholders that were created during the given date interval.
    74  	CreatedRange *RangeQueryParams `form:"created"`
    75  	// Only return cardholders that have the given email address.
    76  	Email *string `form:"email"`
    77  	// Specifies which fields in the response should be expanded.
    78  	Expand []*string `form:"expand"`
    79  	// Only return cardholders that have the given phone number.
    80  	PhoneNumber *string `form:"phone_number"`
    81  	// Only return cardholders that have the given status. One of `active`, `inactive`, or `blocked`.
    82  	Status *string `form:"status"`
    83  	// Only return cardholders that have the given type. One of `individual` or `company`.
    84  	Type *string `form:"type"`
    85  }
    86  
    87  // AddExpand appends a new field to expand.
    88  func (p *IssuingCardholderListParams) AddExpand(f string) {
    89  	p.Expand = append(p.Expand, &f)
    90  }
    91  
    92  // The cardholder's billing address.
    93  type IssuingCardholderBillingParams struct {
    94  	// The cardholder's billing address.
    95  	Address *AddressParams `form:"address"`
    96  }
    97  
    98  // Additional information about a `company` cardholder.
    99  type IssuingCardholderCompanyParams struct {
   100  	// The entity's business ID number.
   101  	TaxID *string `form:"tax_id"`
   102  }
   103  
   104  // Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). Required for cards backed by a Celtic program.
   105  type IssuingCardholderIndividualCardIssuingUserTermsAcceptanceParams struct {
   106  	// The Unix timestamp marking when the cardholder accepted the Authorized User Terms. Required for Celtic Spend Card users.
   107  	Date *int64 `form:"date"`
   108  	// The IP address from which the cardholder accepted the Authorized User Terms. Required for Celtic Spend Card users.
   109  	IP *string `form:"ip"`
   110  	// The user agent of the browser from which the cardholder accepted the Authorized User Terms.
   111  	UserAgent *string `form:"user_agent"`
   112  }
   113  
   114  // Information related to the card_issuing program for this cardholder.
   115  type IssuingCardholderIndividualCardIssuingParams struct {
   116  	// Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). Required for cards backed by a Celtic program.
   117  	UserTermsAcceptance *IssuingCardholderIndividualCardIssuingUserTermsAcceptanceParams `form:"user_terms_acceptance"`
   118  }
   119  
   120  // The date of birth of this cardholder. Cardholders must be older than 13 years old.
   121  type IssuingCardholderIndividualDOBParams struct {
   122  	// The day of birth, between 1 and 31.
   123  	Day *int64 `form:"day"`
   124  	// The month of birth, between 1 and 12.
   125  	Month *int64 `form:"month"`
   126  	// The four-digit year of birth.
   127  	Year *int64 `form:"year"`
   128  }
   129  
   130  // An identifying document, either a passport or local ID card.
   131  type IssuingCardholderIndividualVerificationDocumentParams struct {
   132  	// The back of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
   133  	Back *string `form:"back"`
   134  	// The front of an ID returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
   135  	Front *string `form:"front"`
   136  }
   137  
   138  // Government-issued ID document for this cardholder.
   139  type IssuingCardholderIndividualVerificationParams struct {
   140  	// An identifying document, either a passport or local ID card.
   141  	Document *IssuingCardholderIndividualVerificationDocumentParams `form:"document"`
   142  }
   143  
   144  // Additional information about an `individual` cardholder.
   145  type IssuingCardholderIndividualParams struct {
   146  	// Information related to the card_issuing program for this cardholder.
   147  	CardIssuing *IssuingCardholderIndividualCardIssuingParams `form:"card_issuing"`
   148  	// The date of birth of this cardholder. Cardholders must be older than 13 years old.
   149  	DOB *IssuingCardholderIndividualDOBParams `form:"dob"`
   150  	// The first name of this cardholder. Required before activating Cards. This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters.
   151  	FirstName *string `form:"first_name"`
   152  	// The last name of this cardholder. Required before activating Cards. This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters.
   153  	LastName *string `form:"last_name"`
   154  	// Government-issued ID document for this cardholder.
   155  	Verification *IssuingCardholderIndividualVerificationParams `form:"verification"`
   156  }
   157  
   158  // Limit spending with amount-based rules that apply across this cardholder's cards.
   159  type IssuingCardholderSpendingControlsSpendingLimitParams struct {
   160  	// Maximum amount allowed to spend per interval.
   161  	Amount *int64 `form:"amount"`
   162  	// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. Omitting this field will apply the limit to all categories.
   163  	Categories []*string `form:"categories"`
   164  	// Interval (or event) to which the amount applies.
   165  	Interval *string `form:"interval"`
   166  }
   167  
   168  // Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
   169  type IssuingCardholderSpendingControlsParams struct {
   170  	// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. All other categories will be blocked. Cannot be set with `blocked_categories`.
   171  	AllowedCategories []*string `form:"allowed_categories"`
   172  	// Array of strings containing representing countries from which authorizations will be allowed. Authorizations from merchants in all other countries will be declined. Country codes should be ISO 3166 alpha-2 country codes (e.g. `US`). Cannot be set with `blocked_merchant_countries`. Provide an empty value to unset this control.
   173  	AllowedMerchantCountries []*string `form:"allowed_merchant_countries"`
   174  	// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. All other categories will be allowed. Cannot be set with `allowed_categories`.
   175  	BlockedCategories []*string `form:"blocked_categories"`
   176  	// Array of strings containing representing countries from which authorizations will be declined. Country codes should be ISO 3166 alpha-2 country codes (e.g. `US`). Cannot be set with `allowed_merchant_countries`. Provide an empty value to unset this control.
   177  	BlockedMerchantCountries []*string `form:"blocked_merchant_countries"`
   178  	// Limit spending with amount-based rules that apply across this cardholder's cards.
   179  	SpendingLimits []*IssuingCardholderSpendingControlsSpendingLimitParams `form:"spending_limits"`
   180  	// Currency of amounts within `spending_limits`. Defaults to your merchant country's currency.
   181  	SpendingLimitsCurrency *string `form:"spending_limits_currency"`
   182  }
   183  
   184  // Creates a new Issuing Cardholder object that can be issued cards.
   185  type IssuingCardholderParams struct {
   186  	Params `form:"*"`
   187  	// The cardholder's billing address.
   188  	Billing *IssuingCardholderBillingParams `form:"billing"`
   189  	// Additional information about a `company` cardholder.
   190  	Company *IssuingCardholderCompanyParams `form:"company"`
   191  	// The cardholder's email address.
   192  	Email *string `form:"email"`
   193  	// Specifies which fields in the response should be expanded.
   194  	Expand []*string `form:"expand"`
   195  	// Additional information about an `individual` cardholder.
   196  	Individual *IssuingCardholderIndividualParams `form:"individual"`
   197  	// 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`.
   198  	Metadata map[string]string `form:"metadata"`
   199  	// 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.
   200  	Name *string `form:"name"`
   201  	// 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.
   202  	PhoneNumber *string `form:"phone_number"`
   203  	// The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`.
   204  	//  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.
   205  	PreferredLocales []*string `form:"preferred_locales"`
   206  	// Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
   207  	SpendingControls *IssuingCardholderSpendingControlsParams `form:"spending_controls"`
   208  	// Specifies whether to permit authorizations on this cardholder's cards. Defaults to `active`.
   209  	Status *string `form:"status"`
   210  	// One of `individual` or `company`. See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details.
   211  	Type *string `form:"type"`
   212  }
   213  
   214  // AddExpand appends a new field to expand.
   215  func (p *IssuingCardholderParams) AddExpand(f string) {
   216  	p.Expand = append(p.Expand, &f)
   217  }
   218  
   219  // AddMetadata adds a new key-value pair to the Metadata.
   220  func (p *IssuingCardholderParams) AddMetadata(key string, value string) {
   221  	if p.Metadata == nil {
   222  		p.Metadata = make(map[string]string)
   223  	}
   224  
   225  	p.Metadata[key] = value
   226  }
   227  
   228  type IssuingCardholderBilling struct {
   229  	Address *Address `json:"address"`
   230  }
   231  
   232  // Additional information about a `company` cardholder.
   233  type IssuingCardholderCompany struct {
   234  	// Whether the company's business ID number was provided.
   235  	TaxIDProvided bool `json:"tax_id_provided"`
   236  }
   237  
   238  // Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). Required for cards backed by a Celtic program.
   239  type IssuingCardholderIndividualCardIssuingUserTermsAcceptance struct {
   240  	// The Unix timestamp marking when the cardholder accepted the Authorized User Terms.
   241  	Date int64 `json:"date"`
   242  	// The IP address from which the cardholder accepted the Authorized User Terms.
   243  	IP string `json:"ip"`
   244  	// The user agent of the browser from which the cardholder accepted the Authorized User Terms.
   245  	UserAgent string `json:"user_agent"`
   246  }
   247  
   248  // Information related to the card_issuing program for this cardholder.
   249  type IssuingCardholderIndividualCardIssuing struct {
   250  	// Information about cardholder acceptance of Celtic [Authorized User Terms](https://stripe.com/docs/issuing/cards#accept-authorized-user-terms). Required for cards backed by a Celtic program.
   251  	UserTermsAcceptance *IssuingCardholderIndividualCardIssuingUserTermsAcceptance `json:"user_terms_acceptance"`
   252  }
   253  
   254  // The date of birth of this cardholder.
   255  type IssuingCardholderIndividualDOB struct {
   256  	// The day of birth, between 1 and 31.
   257  	Day int64 `json:"day"`
   258  	// The month of birth, between 1 and 12.
   259  	Month int64 `json:"month"`
   260  	// The four-digit year of birth.
   261  	Year int64 `json:"year"`
   262  }
   263  
   264  // An identifying document, either a passport or local ID card.
   265  type IssuingCardholderIndividualVerificationDocument struct {
   266  	// The back of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
   267  	Back *File `json:"back"`
   268  	// The front of a document returned by a [file upload](https://stripe.com/docs/api#create_file) with a `purpose` value of `identity_document`.
   269  	Front *File `json:"front"`
   270  }
   271  
   272  // Government-issued ID document for this cardholder.
   273  type IssuingCardholderIndividualVerification struct {
   274  	// An identifying document, either a passport or local ID card.
   275  	Document *IssuingCardholderIndividualVerificationDocument `json:"document"`
   276  }
   277  
   278  // Additional information about an `individual` cardholder.
   279  type IssuingCardholderIndividual struct {
   280  	// Information related to the card_issuing program for this cardholder.
   281  	CardIssuing *IssuingCardholderIndividualCardIssuing `json:"card_issuing"`
   282  	// The date of birth of this cardholder.
   283  	DOB *IssuingCardholderIndividualDOB `json:"dob"`
   284  	// The first name of this cardholder. Required before activating Cards. This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters.
   285  	FirstName string `json:"first_name"`
   286  	// The last name of this cardholder. Required before activating Cards. This field cannot contain any numbers, special characters (except periods, commas, hyphens, spaces and apostrophes) or non-latin letters.
   287  	LastName string `json:"last_name"`
   288  	// Government-issued ID document for this cardholder.
   289  	Verification *IssuingCardholderIndividualVerification `json:"verification"`
   290  }
   291  type IssuingCardholderRequirements struct {
   292  	// If `disabled_reason` is present, all cards will decline authorizations with `cardholder_verification_required` reason.
   293  	DisabledReason IssuingCardholderRequirementsDisabledReason `json:"disabled_reason"`
   294  	// Array of fields that need to be collected in order to verify and re-enable the cardholder.
   295  	PastDue []string `json:"past_due"`
   296  }
   297  
   298  // Limit spending with amount-based rules that apply across this cardholder's cards.
   299  type IssuingCardholderSpendingControlsSpendingLimit struct {
   300  	// Maximum amount allowed to spend per interval. This amount is in the card's currency and in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
   301  	Amount int64 `json:"amount"`
   302  	// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) this limit applies to. Omitting this field will apply the limit to all categories.
   303  	Categories []string `json:"categories"`
   304  	// Interval (or event) to which the amount applies.
   305  	Interval IssuingCardholderSpendingControlsSpendingLimitInterval `json:"interval"`
   306  }
   307  
   308  // Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
   309  type IssuingCardholderSpendingControls struct {
   310  	// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to allow. All other categories will be blocked. Cannot be set with `blocked_categories`.
   311  	AllowedCategories []string `json:"allowed_categories"`
   312  	// Array of strings containing representing countries from which authorizations will be allowed. Authorizations from merchants in all other countries will be declined. Country codes should be ISO 3166 alpha-2 country codes (e.g. `US`). Cannot be set with `blocked_merchant_countries`. Provide an empty value to unset this control.
   313  	AllowedMerchantCountries []string `json:"allowed_merchant_countries"`
   314  	// Array of strings containing [categories](https://stripe.com/docs/api#issuing_authorization_object-merchant_data-category) of authorizations to decline. All other categories will be allowed. Cannot be set with `allowed_categories`.
   315  	BlockedCategories []string `json:"blocked_categories"`
   316  	// Array of strings containing representing countries from which authorizations will be declined. Country codes should be ISO 3166 alpha-2 country codes (e.g. `US`). Cannot be set with `allowed_merchant_countries`. Provide an empty value to unset this control.
   317  	BlockedMerchantCountries []string `json:"blocked_merchant_countries"`
   318  	// Limit spending with amount-based rules that apply across this cardholder's cards.
   319  	SpendingLimits []*IssuingCardholderSpendingControlsSpendingLimit `json:"spending_limits"`
   320  	// Currency of the amounts within `spending_limits`.
   321  	SpendingLimitsCurrency Currency `json:"spending_limits_currency"`
   322  }
   323  
   324  // An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards.
   325  //
   326  // Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder)
   327  type IssuingCardholder struct {
   328  	APIResource
   329  	Billing *IssuingCardholderBilling `json:"billing"`
   330  	// Additional information about a `company` cardholder.
   331  	Company *IssuingCardholderCompany `json:"company"`
   332  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   333  	Created int64 `json:"created"`
   334  	// The cardholder's email address.
   335  	Email string `json:"email"`
   336  	// Unique identifier for the object.
   337  	ID string `json:"id"`
   338  	// Additional information about an `individual` cardholder.
   339  	Individual *IssuingCardholderIndividual `json:"individual"`
   340  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   341  	Livemode bool `json:"livemode"`
   342  	// 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.
   343  	Metadata map[string]string `json:"metadata"`
   344  	// The cardholder's name. This will be printed on cards issued to them.
   345  	Name string `json:"name"`
   346  	// String representing the object's type. Objects of the same type share the same value.
   347  	Object string `json:"object"`
   348  	// 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#when-is-3d-secure-applied) for more details.
   349  	PhoneNumber string `json:"phone_number"`
   350  	// The cardholder's preferred locales (languages), ordered by preference. Locales can be `de`, `en`, `es`, `fr`, or `it`.
   351  	//  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.
   352  	PreferredLocales []IssuingCardholderPreferredLocale `json:"preferred_locales"`
   353  	Requirements     *IssuingCardholderRequirements     `json:"requirements"`
   354  	// Rules that control spending across this cardholder's cards. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details.
   355  	SpendingControls *IssuingCardholderSpendingControls `json:"spending_controls"`
   356  	// Specifies whether to permit authorizations on this cardholder's cards.
   357  	Status IssuingCardholderStatus `json:"status"`
   358  	// One of `individual` or `company`. See [Choose a cardholder type](https://stripe.com/docs/issuing/other/choose-cardholder) for more details.
   359  	Type IssuingCardholderType `json:"type"`
   360  }
   361  
   362  // IssuingCardholderList is a list of Cardholders as retrieved from a list endpoint.
   363  type IssuingCardholderList struct {
   364  	APIResource
   365  	ListMeta
   366  	Data []*IssuingCardholder `json:"data"`
   367  }
   368  
   369  // UnmarshalJSON handles deserialization of an IssuingCardholder.
   370  // This custom unmarshaling is needed because the resulting
   371  // property may be an id or the full struct if it was expanded.
   372  func (i *IssuingCardholder) UnmarshalJSON(data []byte) error {
   373  	if id, ok := ParseID(data); ok {
   374  		i.ID = id
   375  		return nil
   376  	}
   377  
   378  	type issuingCardholder IssuingCardholder
   379  	var v issuingCardholder
   380  	if err := json.Unmarshal(data, &v); err != nil {
   381  		return err
   382  	}
   383  
   384  	*i = IssuingCardholder(v)
   385  	return nil
   386  }