Geen omschrijving

Jerry 1ada928bcf update 7 jaren geleden
.gitignore 6aeba776d1 首次提交 7 jaren geleden
README.md 1ada928bcf update 7 jaren geleden
ali_pay.go 23f7e6eac6 修改包名 7 jaren geleden
ali_pay_test.go cd57c340e8 修改包名 7 jaren geleden
alipay_params.go 8f1dc72c7f newFile 7 jaren geleden
alipay_response.go 1ada928bcf update 7 jaren geleden
constant.go d098581f08 整理URL地址 7 jaren geleden
logo.png eec2aeca0e 添加logo 7 jaren geleden
message.go ac819549e5 change name 7 jaren geleden
util.go 1ada928bcf update 7 jaren geleden
wechat_params.go 1ada928bcf update 7 jaren geleden
wechat_pay.go c259dce644 添加沙箱支付测试 7 jaren geleden
wechat_pay_test.go 3f41780754 添加沙箱测试 7 jaren geleden
wechat_request_body.go 1ada928bcf update 7 jaren geleden
wechat_response.go 1ada928bcf update 7 jaren geleden

README.md

Logo was Loading Faild!

GoPay

微信

  • 统一下单
    • JSAPI - JSAPI支付(或小程序支付)
    • NATIVE - Native支付
    • APP - app支付
    • MWEB - H5支付
  • 查询订单(开发中)
  • 关闭订单(开发中)
  • 申请退款(开发中)
  • 查询退款(开发中)
  • 下载对账单(开发中)
  • 下载资金账单(开发中)
  • 拉取订单评价数据(开发中)

安装

$ go get github.com/iGoogle-ink/gopay

文档

GoPay使用手册

微信统一下单 example

  • 初始化客户端
    • 参数:AppId:应用ID
    • 参数:mchID:商户ID
    • 参数:secretKey:Key值
    • 参数:isProd:是否正式环境 ```go //正式环境 client := gopay.NewWeChatClient("wxd678efh567hg6787", "1230000109", "192006250b", true)

//沙箱环境 client := gopay.NewWeChatClient("wxd678efh567hg6787", "1230000109", "192006250b", false)


* 初始化统一下单参数
> 以下参数设置皆为必选参数,如需其他参数,请参考API文档。
>
> 参考文档:[微信支付文档](https://pay.weixin.qq.com/wiki/doc/api/index.html)
```go
params := new(gopay.WeChatPayParams)
params.NonceStr = "dyUNIkNS29hvDUC1CmoF0alSdfCQGg9I"
params.Body = "支付测试"
params.OutTradeNo = "GYsadfjk4dhg3fkh3ffgnlsdkf"
params.TotalFee = 10 //单位为分,如沙箱环境,则默认为101
params.SpbillCreateIp = "127.0.0.1"
params.NotifyUrl = "http://www.igoogle.ink"
params.TradeType = gopay.WX_PayType_JsApi
params.DeviceInfo = "WEB"
params.SignType = gopay.WX_SignType_HMAC_SHA256 //如不设置此参数,默认为MD5,如沙箱环境,则默认为MD5
params.Openid = "o0Df70H2Q0fY8JXh1aFPIRyOBgu8" //JSAPI 方式时,此参数必填
  • 发起统一下单请求

    • 参数:param:统一下单请求参数

      请求成功后,获取下单结果

      wxRsp, err := client.UnifiedOrder(params)
      if err != nil {
      	fmt.Println("Error:", err)
      } else {
      	fmt.Println("ReturnCode:", wxRsp.ReturnCode)
      	fmt.Println("ReturnMsg:", wxRsp.ReturnMsg)
      	fmt.Println("Appid:", wxRsp.Appid)
      	fmt.Println("MchId:", wxRsp.MchId)
      	fmt.Println("DeviceInfo:", wxRsp.DeviceInfo)
      	fmt.Println("NonceStr:", wxRsp.NonceStr)
      	fmt.Println("Sign:", wxRsp.Sign)
      	fmt.Println("ResultCode:", wxRsp.ResultCode)
      	fmt.Println("ErrCode:", wxRsp.ErrCode)
      	fmt.Println("ErrCodeDes:", wxRsp.ErrCodeDes)
      	fmt.Println("PrepayId:", wxRsp.PrepayId)
      	fmt.Println("TradeType:", wxRsp.TradeType)
      }
      

      支付宝支付 example

      • Coming soon.

      License

      ```

Copyright 2019 Jerry

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ```