coupon

package
v1.0.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package coupon 代金券

Package coupon 代金券

Package coupon 代金券

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryCouponStock

func QueryCouponStock(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

查询代金券批次

See: https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_4&index=5

POST https://api.mch.weixin.qq.com/mmpaymkttransfers/query_coupon_stock

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/coupon"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := coupon.QueryCouponStock(ctx, params)

	fmt.Println(resp, err)
}
Output:

func QueryCouponsInfo

func QueryCouponsInfo(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

查询代金券信息

See: https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_5&index=6

POST https://api.mch.weixin.qq.com/mmpaymkttransfers/querycouponsinfo

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/coupon"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := coupon.QueryCouponsInfo(ctx, params)

	fmt.Println(resp, err)
}
Output:

func SendCoupon

func SendCoupon(ctx *wxpay.WXPay, params map[string]string) (result map[string]string, err error)

发放代金券

用于商户主动调用接口给用户发放代金券的场景,已做防小号处理,给小号发放代金券将返回错误码。

注意:通过接口发放的代金券不会进入微信卡包

See: https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_3&index=4

POST https://api.mch.weixin.qq.com/mmpaymkttransfers/send_coupon

Example
package main

import (
	"fmt"

	"github.com/fastwego/wxpay"
	"github.com/fastwego/wxpay/apis/coupon"
)

func main() {
	var ctx *wxpay.WXPay

	params := map[string]string{
		"appid": "APPID",
		// ...
	}
	resp, err := coupon.SendCoupon(ctx, params)

	fmt.Println(resp, err)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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