本文整理汇总了Golang中github.com/stripe/stripe-go.CustomerSourceParams类的典型用法代码示例。如果您正苦于以下问题:Golang CustomerSourceParams类的具体用法?Golang CustomerSourceParams怎么用?Golang CustomerSourceParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomerSourceParams类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Update
func (s Client) Update(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {
body := &stripe.RequestValues{}
params.Source.AppendDetails(body, false)
params.AppendTo(body)
source := &stripe.PaymentSource{}
var err error
if len(params.Customer) > 0 {
err = s.B.Call("POST", fmt.Sprintf("/customers/%v/sources/%v", params.Customer, id), s.Key, body, ¶ms.Params, source)
} else {
err = errors.New("Invalid source params: customer needs to be set")
}
return source, err
}
示例2: Get
func (s Client) Get(id string, params *stripe.CustomerSourceParams) (*stripe.PaymentSource, error) {
var body *stripe.RequestValues
var commonParams *stripe.Params
if params != nil {
commonParams = ¶ms.Params
body = &stripe.RequestValues{}
params.AppendTo(body)
}
source := &stripe.PaymentSource{}
var err error
if len(params.Customer) > 0 {
err = s.B.Call("GET", fmt.Sprintf("/customers/%v/sources/%v", params.Customer, id), s.Key, body, commonParams, source)
} else {
err = errors.New("Invalid source params: customer needs to be set")
}
return source, err
}