github.com/stripe/stripe-go/v76@v76.25.0/billingportal/session/client.go (about) 1 // 2 // 3 // File generated from our OpenAPI spec 4 // 5 // 6 7 // Package session provides the /billing_portal/sessions APIs 8 package session 9 10 import ( 11 "net/http" 12 13 stripe "github.com/stripe/stripe-go/v76" 14 ) 15 16 // Client is used to invoke /billing_portal/sessions APIs. 17 type Client struct { 18 B stripe.Backend 19 Key string 20 } 21 22 // New creates a new billing portal session. 23 func New(params *stripe.BillingPortalSessionParams) (*stripe.BillingPortalSession, error) { 24 return getC().New(params) 25 } 26 27 // New creates a new billing portal session. 28 func (c Client) New(params *stripe.BillingPortalSessionParams) (*stripe.BillingPortalSession, error) { 29 session := &stripe.BillingPortalSession{} 30 err := c.B.Call( 31 http.MethodPost, 32 "/v1/billing_portal/sessions", 33 c.Key, 34 params, 35 session, 36 ) 37 return session, err 38 } 39 40 func getC() Client { 41 return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key} 42 }