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

     1  package stripe
     2  
     3  // OAuthScopeType is the type of OAuth scope.
     4  type OAuthScopeType string
     5  
     6  // List of possible values for OAuth scopes.
     7  const (
     8  	OAuthScopeTypeReadOnly  OAuthScopeType = "read_only"
     9  	OAuthScopeTypeReadWrite OAuthScopeType = "read_write"
    10  )
    11  
    12  // OAuthTokenType is the type of token. This will always be "bearer."
    13  type OAuthTokenType string
    14  
    15  // List of possible OAuthTokenType values.
    16  const (
    17  	OAuthTokenTypeBearer OAuthTokenType = "bearer"
    18  )
    19  
    20  // OAuthStripeUserBusinessType is the business type for the Stripe oauth user.
    21  type OAuthStripeUserBusinessType string
    22  
    23  // List of supported values for business type.
    24  const (
    25  	OAuthStripeUserBusinessTypeCorporation OAuthStripeUserBusinessType = "corporation"
    26  	OAuthStripeUserBusinessTypeLLC         OAuthStripeUserBusinessType = "llc"
    27  	OAuthStripeUserBusinessTypeNonProfit   OAuthStripeUserBusinessType = "non_profit"
    28  	OAuthStripeUserBusinessTypePartnership OAuthStripeUserBusinessType = "partnership"
    29  	OAuthStripeUserBusinessTypeSoleProp    OAuthStripeUserBusinessType = "sole_prop"
    30  )
    31  
    32  // OAuthStripeUserGender of the person who will be filling out a Stripe
    33  // application. (International regulations require either male or female.)
    34  type OAuthStripeUserGender string
    35  
    36  // The gender of the person who  will be filling out a Stripe application.
    37  // (International regulations require either male or female.)
    38  const (
    39  	OAuthStripeUserGenderFemale OAuthStripeUserGender = "female"
    40  	OAuthStripeUserGenderMale   OAuthStripeUserGender = "male"
    41  )
    42  
    43  // OAuthStripeUserParams for the stripe_user OAuth Authorize params.
    44  type OAuthStripeUserParams struct {
    45  	BlockKana          *string `form:"block_kana"`
    46  	BlockKanji         *string `form:"block_kanji"`
    47  	BuildingKana       *string `form:"building_kana"`
    48  	BuildingKanji      *string `form:"building_kanji"`
    49  	BusinessName       *string `form:"business_name"`
    50  	BusinessType       *string `form:"business_type"`
    51  	City               *string `form:"city"`
    52  	Country            *string `form:"country"`
    53  	Currency           *string `form:"currency"`
    54  	DOBDay             *int64  `form:"dob_day"`
    55  	DOBMonth           *int64  `form:"dob_month"`
    56  	DOBYear            *int64  `form:"dob_year"`
    57  	Email              *string `form:"email"`
    58  	FirstName          *string `form:"first_name"`
    59  	FirstNameKana      *string `form:"first_name_kana"`
    60  	FirstNameKanji     *string `form:"first_name_kanji"`
    61  	Gender             *string `form:"gender"`
    62  	LastName           *string `form:"last_name"`
    63  	LastNameKana       *string `form:"last_name_kana"`
    64  	LastNameKanji      *string `form:"last_name_kanji"`
    65  	PhoneNumber        *string `form:"phone_number"`
    66  	PhysicalProduct    *bool   `form:"physical_product"`
    67  	ProductDescription *string `form:"product_description"`
    68  	State              *string `form:"state"`
    69  	StreetAddress      *string `form:"street_address"`
    70  	URL                *string `form:"url"`
    71  	Zip                *string `form:"zip"`
    72  }
    73  
    74  // AuthorizeURLParams for creating OAuth AuthorizeURLs.
    75  type AuthorizeURLParams struct {
    76  	Params                `form:"*"`
    77  	AlwaysPrompt          *bool                  `form:"always_prompt"`
    78  	ClientID              *string                `form:"client_id"`
    79  	RedirectURI           *string                `form:"redirect_uri"`
    80  	ResponseType          *string                `form:"response_type"`
    81  	Scope                 *string                `form:"scope"`
    82  	State                 *string                `form:"state"`
    83  	StripeLanding         *string                `form:"stripe_landing"`
    84  	StripeUser            *OAuthStripeUserParams `form:"stripe_user"`
    85  	SuggestedCapabilities []*string              `form:"suggested_capabilities"`
    86  
    87  	// Express is not sent as a parameter, but is used to modify the authorize URL
    88  	// path to use the express OAuth path.
    89  	Express *bool `form:"-"`
    90  }
    91  
    92  // DeauthorizeParams for deauthorizing an account.
    93  type DeauthorizeParams struct {
    94  	Params       `form:"*"`
    95  	ClientID     *string `form:"client_id"`
    96  	StripeUserID *string `form:"stripe_user_id"`
    97  }
    98  
    99  // OAuthTokenParams is the set of paramaters that can be used to request
   100  // OAuthTokens.
   101  type OAuthTokenParams struct {
   102  	Params             `form:"*"`
   103  	AssertCapabilities []*string `form:"assert_capabilities"`
   104  	ClientSecret       *string   `form:"client_secret"`
   105  	Code               *string   `form:"code"`
   106  	GrantType          *string   `form:"grant_type"`
   107  	RefreshToken       *string   `form:"refresh_token"`
   108  	Scope              *string   `form:"scope"`
   109  }
   110  
   111  // OAuthToken is the value of the OAuthToken from OAuth flow.
   112  // https://stripe.com/docs/connect/oauth-reference#post-token
   113  type OAuthToken struct {
   114  	APIResource
   115  
   116  	Livemode     bool           `json:"livemode"`
   117  	Scope        OAuthScopeType `json:"scope"`
   118  	StripeUserID string         `json:"stripe_user_id"`
   119  	TokenType    OAuthTokenType `json:"token_type"`
   120  
   121  	// Deprecated, please use StripeUserID
   122  	AccessToken          string `json:"access_token"`
   123  	RefreshToken         string `json:"refresh_token"`
   124  	StripePublishableKey string `json:"stripe_publishable_key"`
   125  }
   126  
   127  // Deauthorize is the value of the return from deauthorizing.
   128  // https://stripe.com/docs/connect/oauth-reference#post-deauthorize
   129  type Deauthorize struct {
   130  	APIResource
   131  	StripeUserID string `json:"stripe_user_id"`
   132  }