1 Star 1 Fork 0

湖底观景 / GolangTraining

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
stripe.go 676 Bytes
一键复制 编辑 原始数据 按行查看 历史
GoesToEleven 提交于 2016-04-20 17:45 . changes dir structure
package payment
import (
"github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/charge"
"golang.org/x/net/context"
"google.golang.org/appengine/urlfetch"
)
const secretKey = "sk_test_C4cVqiMxarOi7drYWgUsXmLr"
func chargeAccount(ctx context.Context, stripeToken string) error {
b := stripe.BackendConfiguration{stripe.APIBackend, "https://api.stripe.com/v1", urlfetch.Client(ctx)}
c := &charge.Client{Key: secretKey, B: b}
chargeParams := &stripe.ChargeParams{
Amount: 20000000,
Currency: "usd",
Desc: "Charge for test@example.com",
}
chargeParams.SetSource(stripeToken)
_, err := c.New(chargeParams)
if err != nil {
return err
}
return nil
}
1
https://gitee.com/zhangjianGood/GolangTraining.git
git@gitee.com:zhangjianGood/GolangTraining.git
zhangjianGood
GolangTraining
GolangTraining
afa19f5c43f3

搜索帮助