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

     1  //
     2  //
     3  // File generated from our OpenAPI spec
     4  //
     5  //
     6  
     7  package stripe
     8  
     9  // Type of the token: `account`, `bank_account`, `card`, or `pii`.
    10  type TokenType string
    11  
    12  // List of values that TokenType can take
    13  const (
    14  	TokenTypeAccount     TokenType = "account"
    15  	TokenTypeBankAccount TokenType = "bank_account"
    16  	TokenTypeCard        TokenType = "card"
    17  	TokenTypeCVCUpdate   TokenType = "cvc_update"
    18  	TokenTypePII         TokenType = "pii"
    19  )
    20  
    21  // Retrieves the token with the given ID.
    22  type TokenParams struct {
    23  	Params `form:"*"`
    24  	// Information for the account this token represents.
    25  	Account *TokenAccountParams `form:"account"`
    26  	// The bank account this token will represent.
    27  	BankAccount *BankAccountParams `form:"bank_account"`
    28  	// The card this token will represent. If you also pass in a customer, the card must be the ID of a card belonging to the customer. Otherwise, if you do not pass in a customer, this is a dictionary containing a user's credit card details, with the options described below.
    29  	Card *CardParams `form:"card"`
    30  	// Create a token for the customer, which is owned by the application's account. You can only use this with an [OAuth access token](https://stripe.com/docs/connect/standard-accounts) or [Stripe-Account header](https://stripe.com/docs/connect/authentication). Learn more about [cloning saved payment methods](https://stripe.com/docs/connect/cloning-saved-payment-methods).
    31  	Customer *string `form:"customer"`
    32  	// The updated CVC value this token represents.
    33  	CVCUpdate *TokenCVCUpdateParams `form:"cvc_update"`
    34  	// Specifies which fields in the response should be expanded.
    35  	Expand []*string `form:"expand"`
    36  	// Information for the person this token represents.
    37  	Person *PersonParams `form:"person"`
    38  	// The PII this token represents.
    39  	PII *TokenPIIParams `form:"pii"`
    40  }
    41  
    42  // AddExpand appends a new field to expand.
    43  func (p *TokenParams) AddExpand(f string) {
    44  	p.Expand = append(p.Expand, &f)
    45  }
    46  
    47  // Information for the account this token represents.
    48  type TokenAccountParams struct {
    49  	// The business type.
    50  	BusinessType *string `form:"business_type"`
    51  	// Information about the company or business.
    52  	Company *AccountCompanyParams `form:"company"`
    53  	// Information about the person represented by the account.
    54  	Individual *PersonParams `form:"individual"`
    55  	// Whether the user described by the data in the token has been shown [the Stripe Connected Account Agreement](https://docs.stripe.com/connect/account-tokens#stripe-connected-account-agreement). When creating an account token to create a new Connect account, this value must be `true`.
    56  	TOSShownAndAccepted *bool `form:"tos_shown_and_accepted"`
    57  }
    58  
    59  // The updated CVC value this token represents.
    60  type TokenCVCUpdateParams struct {
    61  	// The CVC value, in string form.
    62  	CVC *string `form:"cvc"`
    63  }
    64  
    65  // The PII this token represents.
    66  type TokenPIIParams struct {
    67  	// The `id_number` for the PII, in string form.
    68  	IDNumber *string `form:"id_number"`
    69  }
    70  
    71  // Tokenization is the process Stripe uses to collect sensitive card or bank
    72  // account details, or personally identifiable information (PII), directly from
    73  // your customers in a secure manner. A token representing this information is
    74  // returned to your server to use. Use our
    75  // [recommended payments integrations](https://stripe.com/docs/payments) to perform this process
    76  // on the client-side. This guarantees that no sensitive card data touches your server,
    77  // and allows your integration to operate in a PCI-compliant way.
    78  //
    79  // If you can't use client-side tokenization, you can also create tokens using
    80  // the API with either your publishable or secret API key. If
    81  // your integration uses this method, you're responsible for any PCI compliance
    82  // that it might require, and you must keep your secret API key safe. Unlike with
    83  // client-side tokenization, your customer's information isn't sent directly to
    84  // Stripe, so we can't determine how it's handled or stored.
    85  //
    86  // You can't store or use tokens more than once. To store card or bank account
    87  // information for later use, create [Customer](https://stripe.com/docs/api#customers)
    88  // objects or [Custom accounts](https://stripe.com/docs/api#external_accounts).
    89  // [Radar](https://stripe.com/docs/radar), our integrated solution for automatic fraud protection,
    90  // performs best with integrations that use client-side tokenization.
    91  type Token struct {
    92  	APIResource
    93  	// These bank accounts are payment methods on `Customer` objects.
    94  	//
    95  	// On the other hand [External Accounts](https://stripe.com/docs/api#external_accounts) are transfer
    96  	// destinations on `Account` objects for [Custom accounts](https://stripe.com/docs/connect/custom-accounts).
    97  	// They can be bank accounts or debit cards as well, and are documented in the links above.
    98  	//
    99  	// Related guide: [Bank debits and transfers](https://stripe.com/docs/payments/bank-debits-transfers)
   100  	BankAccount *BankAccount `json:"bank_account"`
   101  	// You can store multiple cards on a customer in order to charge the customer
   102  	// later. You can also store multiple debit cards on a recipient in order to
   103  	// transfer to those cards later.
   104  	//
   105  	// Related guide: [Card payments with Sources](https://stripe.com/docs/sources/cards)
   106  	Card *Card `json:"card"`
   107  	// IP address of the client that generates the token.
   108  	ClientIP string `json:"client_ip"`
   109  	// Time at which the object was created. Measured in seconds since the Unix epoch.
   110  	Created int64 `json:"created"`
   111  	// Unique identifier for the object.
   112  	ID string `json:"id"`
   113  	// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
   114  	Livemode bool `json:"livemode"`
   115  	// String representing the object's type. Objects of the same type share the same value.
   116  	Object string `json:"object"`
   117  	// Type of the token: `account`, `bank_account`, `card`, or `pii`.
   118  	Type TokenType `json:"type"`
   119  	// Determines if you have already used this token (you can only use tokens once).
   120  	Used bool `json:"used"`
   121  }