https://github.com/birjemin/wxgamevp
wxgame 虚拟支付 weixin 微信小游戏
https://github.com/birjemin/wxgamevp
virtual-payment weixin wxgame
Last synced: about 1 month ago
JSON representation
wxgame 虚拟支付 weixin 微信小游戏
- Host: GitHub
- URL: https://github.com/birjemin/wxgamevp
- Owner: Birjemin
- License: mit
- Created: 2020-08-14T03:44:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-07T08:12:34.000Z (almost 5 years ago)
- Last Synced: 2025-07-04T06:14:06.341Z (4 months ago)
- Topics: virtual-payment, weixin, wxgame
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## wxgamevp-微信小游戏虚拟支付
[](https://travis-ci.com/Birjemin/wxgamevp) [](https://goreportcard.com/report/github.com/birjemin/wxgamevp) [](https://codecov.io/gh/Birjemin/wxgamevp)
[开发者中心](https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment/midas.cancelPay.html)
### 引入方式
```
go get github.com/birjemin/wxgamevp
```
### 接口列表
- [cancelPay](https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment/midas.cancelPay.html) ✅
- [getBalance](https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment/midas.getBalance.html) ✅
- [pay](https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment/midas.pay.html) ✅
- [present](https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment/midas.present.html) ✅
- [getPayForOrder](https://developers.weixin.qq.com/minigame/dev/api-backend/midas-payment/business.getPayForOrder.html) ⚠️
### 使用方式
- 示例
```golang
httpClient := &utils.HTTPClient{
Client: &http.Client{
Timeout: 5 * time.Second,
},
}
pay := Pay{
OpenID: "odkx20ENSNa2w5y3g_qOkOvBNM1g",
AppID: "wx1234567",
OfferID: "12345678",
Ts: 1507530737,
ZoneID: "1",
Amt: 123,
BillNo: "BillNo_123",
Pf: "android",
AccessToken: "ACCESSTOKEN",
Secret: "zNLgAGgqsEWJOg1nFVaO5r7fAlIQxr1u",
SessionToken: "V7Q38/i2KXaqrQyl2Yx9Hg==",
HTTPRequest: httpClient,
}
if ret, err := pay.Pay(); err != nil {
t.Error(err)
} else {
if ret.ErrCode != 0 {
t.Error(errors.New("msg: " + ret.ErrMsg))
}
}
```
### 测试
- 测试
```
go test
```
- 格式化代码
```
golint
```
- 覆盖率
```
go test -cover
go test -coverprofile=coverage.out
go tool cover -html=coverage.out
```
### 备注
无