github.com/stripe/stripe-go/v76@v76.25.0/issuing_card.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 reason why the card was canceled. 12 type IssuingCardCancellationReason string 13 14 // List of values that IssuingCardCancellationReason can take 15 const ( 16 IssuingCardCancellationReasonDesignRejected IssuingCardCancellationReason = "design_rejected" 17 IssuingCardCancellationReasonLost IssuingCardCancellationReason = "lost" 18 IssuingCardCancellationReasonStolen IssuingCardCancellationReason = "stolen" 19 ) 20 21 // The reason why the previous card needed to be replaced. 22 type IssuingCardReplacementReason string 23 24 // List of values that IssuingCardReplacementReason can take 25 const ( 26 IssuingCardReplacementReasonDamaged IssuingCardReplacementReason = "damaged" 27 IssuingCardReplacementReasonExpired IssuingCardReplacementReason = "expired" 28 IssuingCardReplacementReasonLost IssuingCardReplacementReason = "lost" 29 IssuingCardReplacementReasonStolen IssuingCardReplacementReason = "stolen" 30 ) 31 32 // The delivery company that shipped a card. 33 type IssuingCardShippingCarrier string 34 35 // List of values that IssuingCardShippingCarrier can take 36 const ( 37 IssuingCardShippingCarrierDHL IssuingCardShippingCarrier = "dhl" 38 IssuingCardShippingCarrierFedEx IssuingCardShippingCarrier = "fedex" 39 IssuingCardShippingCarrierRoyalMail IssuingCardShippingCarrier = "royal_mail" 40 IssuingCardShippingCarrierUSPS IssuingCardShippingCarrier = "usps" 41 ) 42 43 // Shipment service, such as `standard` or `express`. 44 type IssuingCardShippingService string 45 46 // List of values that IssuingCardShippingService can take 47 const ( 48 IssuingCardShippingServiceExpress IssuingCardShippingService = "express" 49 IssuingCardShippingServicePriority IssuingCardShippingService = "priority" 50 IssuingCardShippingServiceStandard IssuingCardShippingService = "standard" 51 ) 52 53 // The delivery status of the card. 54 type IssuingCardShippingStatus string 55 56 // List of values that IssuingCardShippingStatus can take 57 const ( 58 IssuingCardShippingStatusCanceled IssuingCardShippingStatus = "canceled" 59 IssuingCardShippingStatusDelivered IssuingCardShippingStatus = "delivered" 60 IssuingCardShippingStatusFailure IssuingCardShippingStatus = "failure" 61 IssuingCardShippingStatusPending IssuingCardShippingStatus = "pending" 62 IssuingCardShippingStatusReturned IssuingCardShippingStatus = "returned" 63 IssuingCardShippingStatusShipped IssuingCardShippingStatus = "shipped" 64 ) 65 66 // Packaging options. 67 type IssuingCardShippingType string 68 69 // List of values that IssuingCardShippingType can take 70 const ( 71 IssuingCardShippingTypeBulk IssuingCardShippingType = "bulk" 72 IssuingCardShippingTypeIndividual IssuingCardShippingType = "individual" 73 ) 74 75 // Interval (or event) to which the amount applies. 76 type IssuingCardSpendingControlsSpendingLimitInterval string 77 78 // List of values that IssuingCardSpendingControlsSpendingLimitInterval can take 79 const ( 80 IssuingCardSpendingControlsSpendingLimitIntervalAllTime IssuingCardSpendingControlsSpendingLimitInterval = "all_time" 81 IssuingCardSpendingControlsSpendingLimitIntervalDaily IssuingCardSpendingControlsSpendingLimitInterval = "daily" 82 IssuingCardSpendingControlsSpendingLimitIntervalMonthly IssuingCardSpendingControlsSpendingLimitInterval = "monthly" 83 IssuingCardSpendingControlsSpendingLimitIntervalPerAuthorization IssuingCardSpendingControlsSpendingLimitInterval = "per_authorization" 84 IssuingCardSpendingControlsSpendingLimitIntervalWeekly IssuingCardSpendingControlsSpendingLimitInterval = "weekly" 85 IssuingCardSpendingControlsSpendingLimitIntervalYearly IssuingCardSpendingControlsSpendingLimitInterval = "yearly" 86 ) 87 88 // Whether authorizations can be approved on this card. May be blocked from activating cards depending on past-due Cardholder requirements. Defaults to `inactive`. 89 type IssuingCardStatus string 90 91 // List of values that IssuingCardStatus can take 92 const ( 93 IssuingCardStatusActive IssuingCardStatus = "active" 94 IssuingCardStatusCanceled IssuingCardStatus = "canceled" 95 IssuingCardStatusInactive IssuingCardStatus = "inactive" 96 ) 97 98 // The type of the card. 99 type IssuingCardType string 100 101 // List of values that IssuingCardType can take 102 const ( 103 IssuingCardTypePhysical IssuingCardType = "physical" 104 IssuingCardTypeVirtual IssuingCardType = "virtual" 105 ) 106 107 // Reason the card is ineligible for Apple Pay 108 type IssuingCardWalletsApplePayIneligibleReason string 109 110 // List of values that IssuingCardWalletsApplePayIneligibleReason can take 111 const ( 112 IssuingCardWalletsApplePayIneligibleReasonMissingAgreement IssuingCardWalletsApplePayIneligibleReason = "missing_agreement" 113 IssuingCardWalletsApplePayIneligibleReasonMissingCardholderContact IssuingCardWalletsApplePayIneligibleReason = "missing_cardholder_contact" 114 IssuingCardWalletsApplePayIneligibleReasonUnsupportedRegion IssuingCardWalletsApplePayIneligibleReason = "unsupported_region" 115 ) 116 117 // Reason the card is ineligible for Google Pay 118 type IssuingCardWalletsGooglePayIneligibleReason string 119 120 // List of values that IssuingCardWalletsGooglePayIneligibleReason can take 121 const ( 122 IssuingCardWalletsGooglePayIneligibleReasonMissingAgreement IssuingCardWalletsGooglePayIneligibleReason = "missing_agreement" 123 IssuingCardWalletsGooglePayIneligibleReasonMissingCardholderContact IssuingCardWalletsGooglePayIneligibleReason = "missing_cardholder_contact" 124 IssuingCardWalletsGooglePayIneligibleReasonUnsupportedRegion IssuingCardWalletsGooglePayIneligibleReason = "unsupported_region" 125 ) 126 127 // Returns a list of Issuing Card objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first. 128 type IssuingCardListParams struct { 129 ListParams `form:"*"` 130 // Only return cards belonging to the Cardholder with the provided ID. 131 Cardholder *string `form:"cardholder"` 132 // Only return cards that were issued during the given date interval. 133 Created *int64 `form:"created"` 134 // Only return cards that were issued during the given date interval. 135 CreatedRange *RangeQueryParams `form:"created"` 136 // Specifies which fields in the response should be expanded. 137 Expand []*string `form:"expand"` 138 // Only return cards that have the given expiration month. 139 ExpMonth *int64 `form:"exp_month"` 140 // Only return cards that have the given expiration year. 141 ExpYear *int64 `form:"exp_year"` 142 // Only return cards that have the given last four digits. 143 Last4 *string `form:"last4"` 144 PersonalizationDesign *string `form:"personalization_design"` 145 // Only return cards that have the given status. One of `active`, `inactive`, or `canceled`. 146 Status *string `form:"status"` 147 // Only return cards that have the given type. One of `virtual` or `physical`. 148 Type *string `form:"type"` 149 } 150 151 // AddExpand appends a new field to expand. 152 func (p *IssuingCardListParams) AddExpand(f string) { 153 p.Expand = append(p.Expand, &f) 154 } 155 156 // The desired PIN for this card. 157 type IssuingCardPINParams struct { 158 // The card's desired new PIN, encrypted under Stripe's public key. 159 EncryptedNumber *string `form:"encrypted_number"` 160 } 161 162 // Customs information for the shipment. 163 type IssuingCardShippingCustomsParams struct { 164 // The Economic Operators Registration and Identification (EORI) number to use for Customs. Required for bulk shipments to Europe. 165 EORINumber *string `form:"eori_number"` 166 } 167 168 // The address where the card will be shipped. 169 type IssuingCardShippingParams struct { 170 // The address that the card is shipped to. 171 Address *AddressParams `form:"address"` 172 // Customs information for the shipment. 173 Customs *IssuingCardShippingCustomsParams `form:"customs"` 174 // The name printed on the shipping label when shipping the card. 175 Name *string `form:"name"` 176 // Phone number of the recipient of the shipment. 177 PhoneNumber *string `form:"phone_number"` 178 // Whether a signature is required for card delivery. 179 RequireSignature *bool `form:"require_signature"` 180 // Shipment service. 181 Service *string `form:"service"` 182 // Packaging options. 183 Type *string `form:"type"` 184 } 185 186 // Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). 187 type IssuingCardSpendingControlsSpendingLimitParams struct { 188 // Maximum amount allowed to spend per interval. 189 Amount *int64 `form:"amount"` 190 // 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. 191 Categories []*string `form:"categories"` 192 // Interval (or event) to which the amount applies. 193 Interval *string `form:"interval"` 194 } 195 196 // Rules that control spending for this card. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. 197 type IssuingCardSpendingControlsParams struct { 198 // 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`. 199 AllowedCategories []*string `form:"allowed_categories"` 200 // 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. 201 AllowedMerchantCountries []*string `form:"allowed_merchant_countries"` 202 // 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`. 203 BlockedCategories []*string `form:"blocked_categories"` 204 // 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. 205 BlockedMerchantCountries []*string `form:"blocked_merchant_countries"` 206 // Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). 207 SpendingLimits []*IssuingCardSpendingControlsSpendingLimitParams `form:"spending_limits"` 208 } 209 210 // Creates an Issuing Card object. 211 type IssuingCardParams struct { 212 Params `form:"*"` 213 // The [Cardholder](https://stripe.com/docs/api#issuing_cardholder_object) object with which the card will be associated. 214 Cardholder *string `form:"cardholder"` 215 // The currency for the card. 216 Currency *string `form:"currency"` 217 // Specifies which fields in the response should be expanded. 218 Expand []*string `form:"expand"` 219 FinancialAccount *string `form:"financial_account"` 220 // 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`. 221 Metadata map[string]string `form:"metadata"` 222 // The personalization design object belonging to this card. 223 PersonalizationDesign *string `form:"personalization_design"` 224 // The desired new PIN for this card. 225 PIN *IssuingCardPINParams `form:"pin"` 226 // The card this is meant to be a replacement for (if any). 227 ReplacementFor *string `form:"replacement_for"` 228 // If `replacement_for` is specified, this should indicate why that card is being replaced. 229 ReplacementReason *string `form:"replacement_reason"` 230 // The second line to print on the card. 231 SecondLine *string `form:"second_line"` 232 // The address where the card will be shipped. 233 Shipping *IssuingCardShippingParams `form:"shipping"` 234 // Rules that control spending for this card. Refer to our [documentation](https://stripe.com/docs/issuing/controls/spending-controls) for more details. 235 SpendingControls *IssuingCardSpendingControlsParams `form:"spending_controls"` 236 // Dictates whether authorizations can be approved on this card. May be blocked from activating cards depending on past-due Cardholder requirements. Defaults to `inactive`. If this card is being canceled because it was lost or stolen, this information should be provided as `cancellation_reason`. 237 Status *string `form:"status"` 238 // The type of card to issue. Possible values are `physical` or `virtual`. 239 Type *string `form:"type"` 240 // The following parameter is only supported when updating a card 241 // Reason why the `status` of this card is `canceled`. 242 CancellationReason *string `form:"cancellation_reason"` 243 } 244 245 // AddExpand appends a new field to expand. 246 func (p *IssuingCardParams) AddExpand(f string) { 247 p.Expand = append(p.Expand, &f) 248 } 249 250 // AddMetadata adds a new key-value pair to the Metadata. 251 func (p *IssuingCardParams) AddMetadata(key string, value string) { 252 if p.Metadata == nil { 253 p.Metadata = make(map[string]string) 254 } 255 256 p.Metadata[key] = value 257 } 258 259 // Additional information that may be required for clearing customs. 260 type IssuingCardShippingCustoms struct { 261 // A registration number used for customs in Europe. See [https://www.gov.uk/eori](https://www.gov.uk/eori) for the UK and [https://ec.europa.eu/taxation_customs/business/customs-procedures-import-and-export/customs-procedures/economic-operators-registration-and-identification-number-eori_en](https://ec.europa.eu/taxation_customs/business/customs-procedures-import-and-export/customs-procedures/economic-operators-registration-and-identification-number-eori_en) for the EU. 262 EORINumber string `json:"eori_number"` 263 } 264 265 // Where and how the card will be shipped. 266 type IssuingCardShipping struct { 267 Address *Address `json:"address"` 268 // The delivery company that shipped a card. 269 Carrier IssuingCardShippingCarrier `json:"carrier"` 270 // Additional information that may be required for clearing customs. 271 Customs *IssuingCardShippingCustoms `json:"customs"` 272 // A unix timestamp representing a best estimate of when the card will be delivered. 273 ETA int64 `json:"eta"` 274 // Recipient name. 275 Name string `json:"name"` 276 // The phone number of the receiver of the shipment. Our courier partners will use this number to contact you in the event of card delivery issues. For individual shipments to the EU/UK, if this field is empty, we will provide them with the phone number provided when the cardholder was initially created. 277 PhoneNumber string `json:"phone_number"` 278 // Whether a signature is required for card delivery. This feature is only supported for US users. Standard shipping service does not support signature on delivery. The default value for standard shipping service is false and for express and priority services is true. 279 RequireSignature bool `json:"require_signature"` 280 // Shipment service, such as `standard` or `express`. 281 Service IssuingCardShippingService `json:"service"` 282 // The delivery status of the card. 283 Status IssuingCardShippingStatus `json:"status"` 284 // A tracking number for a card shipment. 285 TrackingNumber string `json:"tracking_number"` 286 // A link to the shipping carrier's site where you can view detailed information about a card shipment. 287 TrackingURL string `json:"tracking_url"` 288 // Packaging options. 289 Type IssuingCardShippingType `json:"type"` 290 } 291 292 // Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). 293 type IssuingCardSpendingControlsSpendingLimit struct { 294 // 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). 295 Amount int64 `json:"amount"` 296 // 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. 297 Categories []string `json:"categories"` 298 // Interval (or event) to which the amount applies. 299 Interval IssuingCardSpendingControlsSpendingLimitInterval `json:"interval"` 300 } 301 type IssuingCardSpendingControls struct { 302 // 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`. 303 AllowedCategories []string `json:"allowed_categories"` 304 // 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. 305 AllowedMerchantCountries []string `json:"allowed_merchant_countries"` 306 // 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`. 307 BlockedCategories []string `json:"blocked_categories"` 308 // 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. 309 BlockedMerchantCountries []string `json:"blocked_merchant_countries"` 310 // Limit spending with amount-based rules that apply across any cards this card replaced (i.e., its `replacement_for` card and _that_ card's `replacement_for` card, up the chain). 311 SpendingLimits []*IssuingCardSpendingControlsSpendingLimit `json:"spending_limits"` 312 // Currency of the amounts within `spending_limits`. Always the same as the currency of the card. 313 SpendingLimitsCurrency Currency `json:"spending_limits_currency"` 314 } 315 type IssuingCardWalletsApplePay struct { 316 // Apple Pay Eligibility 317 Eligible bool `json:"eligible"` 318 // Reason the card is ineligible for Apple Pay 319 IneligibleReason IssuingCardWalletsApplePayIneligibleReason `json:"ineligible_reason"` 320 } 321 type IssuingCardWalletsGooglePay struct { 322 // Google Pay Eligibility 323 Eligible bool `json:"eligible"` 324 // Reason the card is ineligible for Google Pay 325 IneligibleReason IssuingCardWalletsGooglePayIneligibleReason `json:"ineligible_reason"` 326 } 327 328 // Information relating to digital wallets (like Apple Pay and Google Pay). 329 type IssuingCardWallets struct { 330 ApplePay *IssuingCardWalletsApplePay `json:"apple_pay"` 331 GooglePay *IssuingCardWalletsGooglePay `json:"google_pay"` 332 // Unique identifier for a card used with digital wallets 333 PrimaryAccountIdentifier string `json:"primary_account_identifier"` 334 } 335 336 // You can [create physical or virtual cards](https://stripe.com/docs/issuing/cards) that are issued to cardholders. 337 type IssuingCard struct { 338 APIResource 339 // The brand of the card. 340 Brand string `json:"brand"` 341 // The reason why the card was canceled. 342 CancellationReason IssuingCardCancellationReason `json:"cancellation_reason"` 343 // An Issuing `Cardholder` object represents an individual or business entity who is [issued](https://stripe.com/docs/issuing) cards. 344 // 345 // Related guide: [How to create a cardholder](https://stripe.com/docs/issuing/cards#create-cardholder) 346 Cardholder *IssuingCardholder `json:"cardholder"` 347 // Time at which the object was created. Measured in seconds since the Unix epoch. 348 Created int64 `json:"created"` 349 // Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Supported currencies are `usd` in the US, `eur` in the EU, and `gbp` in the UK. 350 Currency Currency `json:"currency"` 351 // The card's CVC. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with [the `expand` parameter](https://stripe.com/docs/api/expanding_objects). Additionally, it's only available via the ["Retrieve a card" endpoint](https://stripe.com/docs/api/issuing/cards/retrieve), not via "List all cards" or any other endpoint. 352 CVC string `json:"cvc"` 353 // The expiration month of the card. 354 ExpMonth int64 `json:"exp_month"` 355 // The expiration year of the card. 356 ExpYear int64 `json:"exp_year"` 357 // The financial account this card is attached to. 358 FinancialAccount string `json:"financial_account"` 359 // Unique identifier for the object. 360 ID string `json:"id"` 361 // The last 4 digits of the card number. 362 Last4 string `json:"last4"` 363 // Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. 364 Livemode bool `json:"livemode"` 365 // 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. 366 Metadata map[string]string `json:"metadata"` 367 // The full unredacted card number. For security reasons, this is only available for virtual cards, and will be omitted unless you explicitly request it with [the `expand` parameter](https://stripe.com/docs/api/expanding_objects). Additionally, it's only available via the ["Retrieve a card" endpoint](https://stripe.com/docs/api/issuing/cards/retrieve), not via "List all cards" or any other endpoint. 368 Number string `json:"number"` 369 // String representing the object's type. Objects of the same type share the same value. 370 Object string `json:"object"` 371 // The personalization design object belonging to this card. 372 PersonalizationDesign *IssuingPersonalizationDesign `json:"personalization_design"` 373 // The latest card that replaces this card, if any. 374 ReplacedBy *IssuingCard `json:"replaced_by"` 375 // The card this card replaces, if any. 376 ReplacementFor *IssuingCard `json:"replacement_for"` 377 // The reason why the previous card needed to be replaced. 378 ReplacementReason IssuingCardReplacementReason `json:"replacement_reason"` 379 // Where and how the card will be shipped. 380 Shipping *IssuingCardShipping `json:"shipping"` 381 SpendingControls *IssuingCardSpendingControls `json:"spending_controls"` 382 // Whether authorizations can be approved on this card. May be blocked from activating cards depending on past-due Cardholder requirements. Defaults to `inactive`. 383 Status IssuingCardStatus `json:"status"` 384 // The type of the card. 385 Type IssuingCardType `json:"type"` 386 // Information relating to digital wallets (like Apple Pay and Google Pay). 387 Wallets *IssuingCardWallets `json:"wallets"` 388 } 389 390 // IssuingCardList is a list of Cards as retrieved from a list endpoint. 391 type IssuingCardList struct { 392 APIResource 393 ListMeta 394 Data []*IssuingCard `json:"data"` 395 } 396 397 // UnmarshalJSON handles deserialization of an IssuingCard. 398 // This custom unmarshaling is needed because the resulting 399 // property may be an id or the full struct if it was expanded. 400 func (i *IssuingCard) UnmarshalJSON(data []byte) error { 401 if id, ok := ParseID(data); ok { 402 i.ID = id 403 return nil 404 } 405 406 type issuingCard IssuingCard 407 var v issuingCard 408 if err := json.Unmarshal(data, &v); err != nil { 409 return err 410 } 411 412 *i = IssuingCard(v) 413 return nil 414 }