go.stripe

a simple Credit Card processing library for Go using the Stripe API

  • 所有者: drone/go.stripe
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

go.stripe

a simple Credit Card processing library for Go using the Stripe API

go get github.com/drone/go.stripe

Examples

In order to use the go.stripe API you will need to create an account with
stripe.com, and obtain an Secret Key. You must set this key by invoking the
following function:

stripe.SetKey("vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE")

Or you can specify your Secret Key in environment variable STRIPE_API_KEY, and
then invoke the following function:

stripe.SetKeyEnv()

Create Customer

params := stripe.CustomerParams{
	Email:  "george.costanza@mail.com",
	Desc:   "short, bald",
	Card:   &stripe.CardParams {
		Name     : "George Costanza",
		Number   : "4242424242424242",
		ExpYear  : 2012,
		ExpMonth : 5,
		CVC      : "26726",
	},
}

customer, err := stripe.Customers.Create(&params)

Charge Card

params := stripe.ChargeParams{
	Desc:     "Calzone",
	Amount:   400,
	Currency: "usd",
	Card:     &stripe.CardParams {
		Name     : "George Costanza",
		Number   : "4242424242424242",
		ExpYear  : 2012,
		ExpMonth : 5,
		CVC      : "26726",
	},
}

charge, err := stripe.Charges.Create(&params)

Note: the amount charged is $4.00, but is specified in cents (400 cents == $4)

Documentation

You can also have a look at the Godocs.

Unit Tests

In order to run the unit tests, you must have a Stripe account and a Test Secret
Key. The Test Secret Key must be set in environment variable STRIPE_API_KEY:

export STRIPE_API_KEY="vtUQeOtUnYr7PGCLQ96Ul4zqpDUO4sOE"
go test -v

The unit tests attempt to cleanup after themselves whenever possible. You can
manually clear all test data from the Stripe console by navigating to: Your
Account » Account Settings » Test Data. Then click the "Remove All Test Data" button.

主要指标

概览
名称与所有者drone/go.stripe
主编程语言Go
编程语言Go (语言数: 1)
平台
许可证MIT License
所有者活动
创建于2012-05-30 05:47:29
推送于2016-12-14 01:59:35
最后一次提交2014-10-10 08:36:26
发布数0
用户参与
星数260
关注者数16
派生数61
提交数85
已启用问题?
问题数15
打开的问题数9
拉请求数14
打开的拉请求数11
关闭的拉请求数1
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?