wechat

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(appId, secret, code string) (*string, *string, error)

Types

type WeChatPay

type WeChatPay struct {
	// contains filtered or unexported fields
}

func NewWeChatPay

func NewWeChatPay(ctx context.Context, mchID, mchCertificateSerialNumber, mchAPIv3Key, apiClientKeyPath string) (*WeChatPay, error)

NewWeChatPay mchCertificateSerialNumber 商户证书序列号 mchAPIv3Key 商户APIv3密钥 apiClientKeyPath 商户私钥路径

func (WeChatPay) H5PrePay

func (p WeChatPay) H5PrePay(ctx context.Context, appId, mchId, title, tradeNo, notifyUrl string, amount int64, payerClientIP *string) (*string, error)

H5PrePay h5支付

func (WeChatPay) JsApiPay

func (p WeChatPay) JsApiPay(ctx context.Context, appId, mchId, title, tradeNo, notifyUrl, openId string, amount int64) (*string, error)

func (WeChatPay) NativePrePay

func (p WeChatPay) NativePrePay(ctx context.Context, appId, mchId, title, tradeNo, notifyUrl string, amount int64) (*string, error)

NativePrePay Native支付

func (WeChatPay) QueryRefund

func (p WeChatPay) QueryRefund(ctx context.Context, refundNo string) (*time.Time, error)

func (WeChatPay) Refund

func (p WeChatPay) Refund(ctx context.Context, title, tradeNo, refundNo, reason string, refundAmount, total, refundQuantity int64) error

type WechatUser

type WechatUser struct {
	OpenId     string   `json:"openid"`
	Nickname   string   `json:"nickname"`
	Sex        uint32   `json:"sex"`
	Province   string   `json:"province"`
	City       string   `json:"city"`
	Country    string   `json:"country"`
	HeadImgUrl string   `json:"headimgurl"`
	Privilege  []string `json:"privilege"`
	UnionId    string   `json:"unionid"`
}

func GetUserInfo

func GetUserInfo(accessToken, openid string) (*WechatUser, error)

Jump to

Keyboard shortcuts

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