1// 2// 3// File generated from our OpenAPI spec 4// 5// 6 7// Package token provides the /tokens APIs 8package token 9 10import ( 11 "net/http" 12 13 stripe "github.com/stripe/stripe-go/v72" 14) 15 16// Client is used to invoke /tokens APIs. 17type Client struct { 18 B stripe.Backend 19 Key string 20} 21 22// New creates a new token. 23func New(params *stripe.TokenParams) (*stripe.Token, error) { 24 return getC().New(params) 25} 26 27// New creates a new token. 28func (c Client) New(params *stripe.TokenParams) (*stripe.Token, error) { 29 token := &stripe.Token{} 30 err := c.B.Call(http.MethodPost, "/v1/tokens", c.Key, params, token) 31 return token, err 32} 33 34// Get returns the details of a token. 35func Get(id string, params *stripe.TokenParams) (*stripe.Token, error) { 36 return getC().Get(id, params) 37} 38 39// Get returns the details of a token. 40func (c Client) Get(id string, params *stripe.TokenParams) (*stripe.Token, error) { 41 path := stripe.FormatURLPath("/v1/tokens/%s", id) 42 token := &stripe.Token{} 43 err := c.B.Call(http.MethodGet, path, c.Key, params, token) 44 return token, err 45} 46 47func getC() Client { 48 return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} 49} 50