wxpay 介绍
wxpay 是一个使用Go语言编写的微信支付商户平台SDK。
举个栗子
以查询企业付款API为栗:
package main import ( "log" "github.com/go-with/wxpay" ) const ( appId = "" // 微信公众平台应用ID mchId = "" // 微信支付商户平台商户号 apiKey = "" // 微信支付商户平台API密钥 // 微信支付商户平台证书路径 certFile = "cert/apiclient_cert.pem" keyFile = "cert/apiclient_key.pem" rootcaFile = "cert/rootca.pem" ) func main() { c := wxpay.NewClient(appId, mchId, apiKey) // 附着商户证书 err := c.WithCert(certFile, keyFile, rootcaFile) if err != nil { log.Fatal(err) } params := make(wxpay.Params) // 查询企业付款接口请求参数 params.SetString("appid", c.AppId) params.SetString("mch_id", c.MchId) params.SetString("nonce_str", "5K8264ILTKCH16CQ2502SI8ZNMTM67VS") // 随机字符串 params.SetString("partner_Trade_no", "10000098201411111234567890") // 商户订单号 params.SetString("sign", c.Sign(params)) // 签名 // 查询企业付款接口请求URL url := "https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo" // 发送查询企业付款请求 ret, err := c.Post(url, params, true) if err != nil { log.Fatal(err) } log.Print(ret) }
wxpay 官网
https://github.com/go-with/wxpay
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。