wxpay Go 的微信支付商户平台 SDK

程序名称:wxpay

授权协议: MIT

操作系统: 跨平台

开发语言: Google Go

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

相关编程语言

BBGestureBack Full screen return gesture(全屏手...
Framework7 或者叫 F7 是全功能的绑定 iOS 7 应用的...
iOS 调试库,支持 iOS8+,无需添加任何代码,方便 i...
DarkModeKit是在Apple官方的深色模式发布之前设计和...
SimpleNote iOS 版客户端。SimpleNote 是一款在多平...
Kivy iOS,此工具旨在为 iOS 编译必要的库以运行应用...