Go.stripe
a simple Credit Card processing library for Go using the Stripe API
Install / Use
/learn @drone/Go.stripeREADME
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(¶ms)
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(¶ms)
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.
Related Skills
node-connect
351.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.8kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。

