##安装
go get -u github.com/lucky-lee/goPay
func PayWxApp() {
//设置基本信息
wechat.SetAppId("appId123456")
wechat.SetMchId("mchId123456")
wechat.SetApiKey("apiKey123456")
//生成预支付订单
res := wechat.NewPay().
SetTypeApp().
SetBody("test").
SetClientIp("127.0.0.1").
SetNotifyUrl("http://www.xxxxx.com").
SetOutTradeNo("123456789").
SetTotalFree(0.01).CreatePayOrder()
fmt.Println(gJson.Encode(res))
}
func PayWxApplet() {
//设置基本信息
wechat.SetAppId("appId123456")
wechat.SetMchId("mchId123456")
wechat.SetApiKey("apiKey123456")
//生成预支付订单
res := wechat.NewPay().
SetTypeJsapi().
SetBody("test").
SetClientIp("127.0.0.1").
SetNotifyUrl("http://www.xxxxx.com").
SetOutTradeNo("123456789").
SetTotalFree(0.01).CreatePayOrder()
fmt.Println(gJson.Encode(res))
}