wopay

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2017 License: MIT Imports: 9 Imported by: 0

README

wopay

GoDoc license  Build Status Go Report Card

a golang payment interface

  1. 获取包: go get github.com/godcong/wopay

  2. 配置config.toml

  3. 微信授权:
    取得OpenId:

    oauth:=oauth2.NewOauth(request,responseWriter) token := oauth.GetOpenid() if token == nil { //log error return } 取得UserInfo userInfo,err := oauth.GetUserInfo(token)

  4. 支付请求:

    数据初始化:

    data := make(PayData)
    data.Set("body", "腾讯充值中心-QQ会员充值")
    data.Set("out_trade_no", out_trade_no)
    data.Set("device_info", "")
    data.Set("fee_type", "CNY")
    data.Set("total_fee", "1")
    data.Set("spbill_create_ip", "123.12.12.123")
    data.Set("notify_url", "http://test.letiantian.me/wxpay/notify")
    data.Set("trade_type", "NATIVE")
    data.Set("product_id", "12")
    //或者直接初始化

    data := PayData{
    "body":"腾讯充值中心-QQ会员充值",
    ...,
    }

    a. 统一下单: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1

    调用接口: wx.UnifiedOrder(data)

    b. 查询订单: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2

    调用接口: wx.QueryOrder(data)

    c. 关闭订单: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_3

    调用接口: wx.CloseOrder(data)

    d. 申请退款: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4

    调用接口: wx.Refund(data)

    e. 查询退款: https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_5

    调用接口: wx.QueryRefund(data)

    f. 下载对账单 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_6

    g. 支付结果通知 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7

    h. 交易保障 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_8

    i. 退款结果通知 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=9

    j. 拉取订单评价数据 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_17&index=10

Documentation

Index

Constants

View Source
const APP = "APP"
View Source
const JSAPI = "JSAPI"
View Source
const LOG_PATH = "log"
View Source
const MICROPAY = "MICROPAY"
View Source
const NATIVE = "NATIVE"
View Source
const SYSTEM_SEPARATOR_LINUX = "/"
View Source
const SYSTEM_SEPARATOR_WINDOWS = "\\"

Variables

This section is empty.

Functions

func GetLogPath

func GetLogPath() string

func InterfaceToString

func InterfaceToString(v interface{}) string

func Request

func Request()

Types

type Config

type Config struct {
	Wechat Wechat
}

func ConfigInstance

func ConfigInstance() *Config

type Order

type Order struct {
	Body           string
	Detail         string
	Attach         string
	OutTradeNo     string
	FeeType        string
	TotalFee       string
	SpBillCreateIp string
	TimeStart      string
	TimeExpire     string
	Goods_tag      string
	NotifyUrl      string
	TradeType      string
	ProductId      string
	LimitPay       string
	Openid         string
	SubOpenid      string
	AuthCode       string
}

type PayRequest

type PayRequest interface {
}

type Wechat

type Wechat struct {
	AppId       string
	MchId       string
	AppSecret   string
	RedirectUri string
}

func GetWechat

func GetWechat() Wechat

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL