Git Product home page Git Product logo

wx-go's Introduction

wx-go - 微信开发 Golang SDK(开发工具包)

travis-image License

本项目从 WxJava 转化而来。

支持包括微信支付、公众号、小程序等微信功能的后端开发。

使用方式

注意:最新版本(包括测试版)为 GitHub release

go get -u github.com/cliod/wx-go
  • 微信小程序:ma
  • 微信支付:pay
  • 公众号(包括订阅号和服务号):mp

使用Demo

公众号使用例子

conf := mp.NewWxMpConfig("<appId>", "<secret>")
service := mp.NewWxMpService(conf)

da, err := service.CreateJsapiSignature("https://www.xxx.com")
if err == nil {
    // todo ...
} else {
    fmt.Println(err.Error())
}

小程序使用例子

conf := mp.NewWxMaConfig("<appId>", "<secret>")
service := ma.NewWxMaService(conf)

uc := service.GetWxMaUserService()

res, err := uc.GetSessionInfo("<js_code>")
if err == nil {
    // todo ...
} else {
    fmt.Println(err.Error())
}

微信支付使用例子

conf := mp.NewWxPayV2Config("<appId>", "<secret>", "<mchId>", "mchKey", "<notifyUrl>", "keyPath")
service := ma.NewWxPayService(conf)

res, err := service.UnifyPay(&pay.WxPayUnifiedOrderRequest{
    TotalFee:   100,
    Openid:     c.Openid,
    OutTradeNo: s,
    Body:       "测试数据",
})
if err != nil {
    fmt.Println(err.Error())
} else {
    // todo...
}

wx-go's People

Contributors

huaqi666 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.