-
Notifications
You must be signed in to change notification settings - Fork 448
/
client.go
42 lines (35 loc) · 1.27 KB
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
//
// File generated from our OpenAPI spec
//
//
// Package connectiontoken provides the /terminal/connection_tokens APIs
package connectiontoken
import (
"net/http"
stripe "github.com/stripe/stripe-go/v78"
)
// Client is used to invoke /terminal/connection_tokens APIs.
type Client struct {
B stripe.Backend
Key string
}
// To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. On your backend, add an endpoint that creates and returns a connection token.
func New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {
return getC().New(params)
}
// To connect to a reader the Stripe Terminal SDK needs to retrieve a short-lived connection token from Stripe, proxied through your server. On your backend, add an endpoint that creates and returns a connection token.
func (c Client) New(params *stripe.TerminalConnectionTokenParams) (*stripe.TerminalConnectionToken, error) {
connectiontoken := &stripe.TerminalConnectionToken{}
err := c.B.Call(
http.MethodPost,
"/v1/terminal/connection_tokens",
c.Key,
params,
connectiontoken,
)
return connectiontoken, err
}
func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}