merchantexclusivecoupon

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssociateTradeInfoRequest

type AssociateTradeInfoRequest struct {
	// 微信为每个商家券批次分配的唯一ID,对于商户自定义code的批次,关联请求必须填写批次号
	StockId *string `json:"stock_id"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 微信支付下单时的商户订单号,欲与该商家券关联的微信支付
	OutTradeNo *string `json:"out_trade_no"`
	// 商户创建批次凭据号(格式:商户ID+日期+流水号),商户侧需保持唯一性,可包含英文字母,数字,|,\\_,\\*,-等内容,不允许出现其他不合法符号。
	OutRequestNo *string `json:"out_request_no"`
}

AssociateTradeInfoRequest

func (AssociateTradeInfoRequest) Clone

func (AssociateTradeInfoRequest) MarshalJSON

func (o AssociateTradeInfoRequest) MarshalJSON() ([]byte, error)

func (AssociateTradeInfoRequest) String

func (o AssociateTradeInfoRequest) String() string

type AssociateTradeInfoResponse

type AssociateTradeInfoResponse struct {
	// 系统关联券成功的时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	WechatpayAssociateTime *time.Time `json:"wechatpay_associate_time"`
}

AssociateTradeInfoResponse

func (AssociateTradeInfoResponse) Clone

func (AssociateTradeInfoResponse) MarshalJSON

func (o AssociateTradeInfoResponse) MarshalJSON() ([]byte, error)

func (AssociateTradeInfoResponse) String

type AvailableCurrentDayTime

type AvailableCurrentDayTime struct {
	// 当天可用开始时间 单位秒  1代表当天0点0分1秒
	BeginTime *int64 `json:"begin_time,omitempty"`
	// 当天可用结束时间 单位秒  86399代表当天23点59分59秒
	EndTime *int64 `json:"end_time,omitempty"`
}

AvailableCurrentDayTime

func (AvailableCurrentDayTime) Clone

func (AvailableCurrentDayTime) MarshalJSON

func (o AvailableCurrentDayTime) MarshalJSON() ([]byte, error)

func (AvailableCurrentDayTime) String

func (o AvailableCurrentDayTime) String() string

type AvailableWeek

type AvailableWeek struct {
	// 0代表周日,1代表周一,以此类推 当填写available_day_time时,week_day必填
	WeekDay []int64 `json:"week_day,omitempty"`
	// 可以填写多个时间段,最多不超过2个
	AvailableDayTime []AvailableCurrentDayTime `json:"available_day_time,omitempty"`
}

AvailableWeek

func (AvailableWeek) Clone

func (o AvailableWeek) Clone() *AvailableWeek

func (AvailableWeek) MarshalJSON

func (o AvailableWeek) MarshalJSON() ([]byte, error)

func (AvailableWeek) String

func (o AvailableWeek) String() string

type BusiFavorApiService

type BusiFavorApiService services.Service

func (*BusiFavorApiService) CouponCodeInfo

func (a *BusiFavorApiService) CouponCodeInfo(ctx context.Context, req CouponCodeInfoRequest) (resp *CouponCodeInfoResponse, result *core.APIResult, err error)

CouponCodeInfo 查询预存code详情

查询预存code详情

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.CouponCodeInfo(ctx,
		merchantexclusivecoupon.CouponCodeInfoRequest{
			StockId:    core.String("98065001"),
			CouponCode: core.String("ABC1234567"),
			Appid:      core.String("wx1234567889999"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call CouponCodeInfo err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*BusiFavorApiService) CreateBusifavorStock

func (a *BusiFavorApiService) CreateBusifavorStock(ctx context.Context, req CreateBusifavorStockRequest) (resp *CreateBusiFavorStockResponse, result *core.APIResult, err error)

CreateBusifavorStock 创建商家券

商户可以通过该接口创建商家券。微信支付生成商家券批次后并返回商家券批次号给到商户,商户可调用发券接口[【小程序发券】](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_3_1.shtml)、[【H5发券】](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_4_1.shtml)发放该批次商家券。 频率限制:接口级限制1000/min

Example
package main

import (
	"context"
	"log"
	"time"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.CreateBusifavorStock(ctx,
		merchantexclusivecoupon.CreateBusifavorStockRequest{
			StockName:      core.String("8月1日活动券"),
			BelongMerchant: core.String("10000098"),
			Comment:        core.String("活动使用"),
			GoodsName:      core.String("填写商家券可适用的商品或服务"),
			StockType:      merchantexclusivecoupon.BUSIFAVORSTOCKTYPE_NORMAL.Ptr(),
			CouponUseRule: &merchantexclusivecoupon.CouponUseRule{
				CouponAvailableTime: &merchantexclusivecoupon.FavorAvailableTime{
					AvailableBeginTime:       core.Time(time.Now()),
					AvailableEndTime:         core.Time(time.Now()),
					AvailableDayAfterReceive: core.Int64(3),
					AvailableWeek: &merchantexclusivecoupon.AvailableWeek{
						WeekDay: []int64{int64(1)},
						AvailableDayTime: []merchantexclusivecoupon.AvailableCurrentDayTime{merchantexclusivecoupon.AvailableCurrentDayTime{
							BeginTime: core.Int64(3600),
							EndTime:   core.Int64(86399),
						}},
					},
					IrregularyAvaliableTime: []merchantexclusivecoupon.IrregularAvailableTime{merchantexclusivecoupon.IrregularAvailableTime{
						BeginTime: core.Time(time.Now()),
						EndTime:   core.Time(time.Now()),
					}},
					WaitDaysAfterReceive: core.Int64(7),
				},
				FixedNormalCoupon: &merchantexclusivecoupon.FixedValueStockMsg{
					DiscountAmount:     core.Int64(5),
					TransactionMinimum: core.Int64(100),
				},
				DiscountCoupon: &merchantexclusivecoupon.DiscountMsg{
					DiscountPercent:    core.Int64(88),
					TransactionMinimum: core.Int64(100),
				},
				ExchangeCoupon: &merchantexclusivecoupon.ExchangeMsg{
					ExchangePrice:      core.Int64(100),
					TransactionMinimum: core.Int64(100),
				},
				UseMethod:         merchantexclusivecoupon.COUPONUSEMETHOD_OFF_LINE.Ptr(),
				MiniProgramsAppid: core.String("wx23232232323"),
				MiniProgramsPath:  core.String("/path/index/index"),
			},
			StockSendRule: &merchantexclusivecoupon.StockSendRule{
				MaxAmount:          core.Int64(100000),
				MaxCoupons:         core.Int64(100),
				MaxCouponsPerUser:  core.Int64(5),
				MaxAmountByDay:     core.Int64(1000),
				MaxCouponsByDay:    core.Int64(100),
				NaturalPersonLimit: core.Bool(false),
				PreventApiAbuse:    core.Bool(false),
				Transferable:       core.Bool(false),
				Shareable:          core.Bool(false),
			},
			OutRequestNo: core.String("100002322019090134234sfdf"),
			CustomEntrance: &merchantexclusivecoupon.CustomEntrance{
				MiniProgramsInfo: &merchantexclusivecoupon.MiniAppInfo{
					MiniProgramsAppid: core.String("wx234545656765876"),
					MiniProgramsPath:  core.String("/path/index/index"),
					EntranceWords:     core.String("欢迎选购"),
					GuidingWords:      core.String("获取更多优惠"),
				},
				Appid:           core.String("wx324345hgfhfghfg"),
				HallId:          core.String("233455656"),
				StoreId:         core.String("233554655"),
				CodeDisplayMode: merchantexclusivecoupon.CODEDISPLAYMODE_NOT_SHOW.Ptr(),
			},
			DisplayPatternInfo: &merchantexclusivecoupon.DisplayPatternInfo{
				Description:     core.String("xxx门店可用"),
				MerchantLogoUrl: core.String("https://xxx"),
				MerchantName:    core.String("微信支付"),
				BackgroundColor: core.String("xxxxx"),
				CouponImageUrl:  core.String("图片cdn地址"),
				FinderInfo: &merchantexclusivecoupon.FinderInfo{
					FinderId:                 core.String("sph6Rngt2T4RlUf"),
					FinderVideoId:            core.String("export/UzFfAgtgekIEAQAAAAAAb4MgnPInmAAAAAstQy6ubaLX4KHWvLEZgBPEwIEgVnk9HIP-zNPgMJofG6tpdGPJNg_ojtEjoT94"),
					FinderVideoCoverImageUrl: core.String("https://wxpaylogo.qpic.cn/xxx"),
				},
			},
			CouponCodeMode: merchantexclusivecoupon.COUPONCODEMODE_WECHATPAY_MODE.Ptr(),
			NotifyConfig: &merchantexclusivecoupon.NotifyConfig{
				NotifyAppid: core.String("wx23232232323"),
			},
			Subsidy: core.Bool(false),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call CreateBusifavorStock err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*BusiFavorApiService) DeleteCouponCode

func (a *BusiFavorApiService) DeleteCouponCode(ctx context.Context, req DeleteCouponCodeRequest) (resp *DeleteCouponCodeResponse, result *core.APIResult, err error)

DeleteCouponCode 删除预存code

删除预存code

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.DeleteCouponCode(ctx,
		merchantexclusivecoupon.DeleteCouponCodeRequest{
			StockId:         core.String("98065001"),
			CouponCode:      core.String("ABC9588201"),
			DeleteRequestNo: core.String("100002322019090134234sfdf"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call DeleteCouponCode err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*BusiFavorApiService) ModifyBudget

func (a *BusiFavorApiService) ModifyBudget(ctx context.Context, req ModifyBudgetRequest) (resp *ModifyBudgetResponse, result *core.APIResult, err error)

ModifyBudget 修改批次预算

商户可以通过该接口修改批次单天发放上限数量或者批次最大发放数量

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.ModifyBudget(ctx,
		merchantexclusivecoupon.ModifyBudgetRequest{
			StockId:                core.String("98065001"),
			TargetMaxCoupons:       core.Int64(3000),
			CurrentMaxCoupons:      core.Int64(500),
			TargetMaxCouponsByDay:  core.Int64(500),
			CurrentMaxCouponsByDay: core.Int64(300),
			ModifyBudgetRequestNo:  core.String("1002600620019090123143254436"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ModifyBudget err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*BusiFavorApiService) ModifyStockInfo

func (a *BusiFavorApiService) ModifyStockInfo(ctx context.Context, req ModifyStockInfoRequest) (result *core.APIResult, err error)

ModifyStockInfo 修改商家券基本信息

商户可以通过该接口修改商家券基本信息 前置条件: 已创建商家券批次,且修改时间位于有效期结束时间前

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	result, err := svc.ModifyStockInfo(ctx,
		merchantexclusivecoupon.ModifyStockInfoRequest{
			StockId: core.String("101156451224"),
			CustomEntrance: &merchantexclusivecoupon.ModifyCustomEntrance{
				MiniProgramsInfo: &merchantexclusivecoupon.ModifyMiniAppInfo{
					MiniProgramsAppid: core.String("wx234545656765876"),
					MiniProgramsPath:  core.String("/path/index/index"),
					EntranceWords:     core.String("欢迎选购"),
					GuidingWords:      core.String("获取更多优惠"),
				},
				Appid:           core.String("wx324345hgfhfghfg"),
				HallId:          core.String("233455656"),
				CodeDisplayMode: merchantexclusivecoupon.CODEDISPLAYMODE_NOT_SHOW.Ptr(),
			},
			StockName:    core.String("8月1日活动券"),
			Comment:      core.String("活动使用"),
			GoodsName:    core.String("xxx商品使用"),
			OutRequestNo: core.String("6122352020010133287985742"),
			DisplayPatternInfo: &merchantexclusivecoupon.DisplayPatternInfo{
				Description:     core.String("xxx门店可用"),
				MerchantLogoUrl: core.String("https://xxx"),
				MerchantName:    core.String("微信支付"),
				BackgroundColor: core.String("xxxxx"),
				CouponImageUrl:  core.String("图片cdn地址"),
				FinderInfo: &merchantexclusivecoupon.FinderInfo{
					FinderId:                 core.String("sph6Rngt2T4RlUf"),
					FinderVideoId:            core.String("export/UzFfAgtgekIEAQAAAAAAb4MgnPInmAAAAAstQy6ubaLX4KHWvLEZgBPEwIEgVnk9HIP-zNPgMJofG6tpdGPJNg_ojtEjoT94"),
					FinderVideoCoverImageUrl: core.String("https://wxpaylogo.qpic.cn/xxx"),
				},
			},
			CouponUseRule: &merchantexclusivecoupon.ModifyCouponUseRule{
				UseMethod:         merchantexclusivecoupon.COUPONUSEMETHOD_OFF_LINE.Ptr(),
				MiniProgramsAppid: core.String("wx23232232323"),
				MiniProgramsPath:  core.String("/path/index/index"),
			},
			StockSendRule: &merchantexclusivecoupon.ModifyStockSendRule{
				NaturalPersonLimit: core.Bool(false),
				PreventApiAbuse:    core.Bool(false),
			},
			NotifyConfig: &merchantexclusivecoupon.NotifyConfig{
				NotifyAppid: core.String("wx23232232323"),
			},
			Subsidy: core.Bool(true),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ModifyStockInfo err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d", result.Response.StatusCode)
	}
}
Output:

func (*BusiFavorApiService) QueryCouponCodeList

func (a *BusiFavorApiService) QueryCouponCodeList(ctx context.Context, req QueryCouponCodeListRequest) (resp *CouponCodeListResponse, result *core.APIResult, err error)

QueryCouponCodeList 查询预存code列表

查询预存code列表

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.QueryCouponCodeList(ctx,
		merchantexclusivecoupon.QueryCouponCodeListRequest{
			StockId: core.String("98065001"),
			Limit:   core.Int64(100),
			Offset:  core.Int64(10),
			Appid:   core.String("wx1234567889999"),
			Status:  merchantexclusivecoupon.COUPONCODESTATUS_AVAILABLE.Ptr(),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call QueryCouponCodeList err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*BusiFavorApiService) QueryStock

func (a *BusiFavorApiService) QueryStock(ctx context.Context, req QueryStockRequest) (resp *StockGetResponse, result *core.APIResult, err error)

QueryStock 查询商家券批次详情

商户可通过该接口查询已创建的商家券批次详情信息。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.QueryStock(ctx,
		merchantexclusivecoupon.QueryStockRequest{
			StockId: core.String("100088"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call QueryStock err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*BusiFavorApiService) UploadCouponCode

func (a *BusiFavorApiService) UploadCouponCode(ctx context.Context, req UploadCouponCodeRequest) (resp *UploadCouponCodeResponse, result *core.APIResult, err error)

UploadCouponCode 上传预存code

商家券的code码可由微信后台随机分配,同时支持商户自定义。如商家已有自己的优惠券系统,可直接使用自定义模式。即商家预先向微信支付上传券code,当券在发放时,微信支付自动从已导入的code中随机取值(不能指定),派发给用户。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.BusiFavorApiService{Client: client}
	resp, result, err := svc.UploadCouponCode(ctx,
		merchantexclusivecoupon.UploadCouponCodeRequest{
			StockId:         core.String("98065001"),
			CouponCodeList:  []string{"ABC9588200"},
			UploadRequestNo: core.String("100002322019090134234sfdf"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call UploadCouponCode err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

type BusiFavorStockType

type BusiFavorStockType string

BusiFavorStockType

const (
	BUSIFAVORSTOCKTYPE_NORMAL   BusiFavorStockType = "NORMAL"
	BUSIFAVORSTOCKTYPE_DISCOUNT BusiFavorStockType = "DISCOUNT"
	BUSIFAVORSTOCKTYPE_EXCHANGE BusiFavorStockType = "EXCHANGE"
)

Enums of BusiFavorStockType

func (BusiFavorStockType) Ptr

type CallBackApiService

type CallBackApiService services.Service

func (*CallBackApiService) GetCouponNotify

func (a *CallBackApiService) GetCouponNotify(ctx context.Context, req GetCouponNotifyRequest) (resp *GetCouponNotifyResponse, result *core.APIResult, err error)

GetCouponNotify 获取商家券事件通知地址

使用场景:用于查询设置的通知URL 限制条件:仅可以查询由请求商户号设置的商家券通知URL

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CallBackApiService{Client: client}
	resp, result, err := svc.GetCouponNotify(ctx,
		merchantexclusivecoupon.GetCouponNotifyRequest{
			Mchid: core.String("98568888"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call GetCouponNotify err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CallBackApiService) SetCouponNotify

func (a *CallBackApiService) SetCouponNotify(ctx context.Context, req SetCouponNotifyRequest) (resp *SetCouponNotifyResponse, result *core.APIResult, err error)

SetCouponNotify 设置商家券事件通知地址

用于设置接收商家券相关事件通知的URL,可接收商家券相关的事件通知、包括发放通知等。需要设置接收通知的URL,并在商户平台开通[营销事件推送](https://pay.weixin.qq.com/index.php/xphp/cmkt_product/index#/pages/product/product?pid=3)的能力,即可接收到相关通知。 营销事件推送:[点击开通产品权限](https://pay.weixin.qq.com/index.php/core/home/login?return_url=%2Findex.php%2Fxphp%2Fcmkt_product%2Findex#/pages/product/product?pid=3)。由商家券批次创建方登录Pay平台,操作开通

#### 注意 • 仅可以收到由商户自己创建的批次相关的通知 • 需要设置apiv3密钥,否则无法收到回调。 • 如果需要领券回调中的参数OpenID。需要创券时候传入notify\_appid参数。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CallBackApiService{Client: client}
	resp, result, err := svc.SetCouponNotify(ctx,
		merchantexclusivecoupon.SetCouponNotifyRequest{
			Mchid:     core.String("98568888"),
			NotifyUrl: core.String("https://pay.weixin.qq.com"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call SetCouponNotify err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

type CodeDisplayMode

type CodeDisplayMode string

CodeDisplayMode

const (
	CODEDISPLAYMODE_NOT_SHOW CodeDisplayMode = "NOT_SHOW"
	CODEDISPLAYMODE_BARCODE  CodeDisplayMode = "BARCODE"
	CODEDISPLAYMODE_QRCODE   CodeDisplayMode = "QRCODE"
)

Enums of CodeDisplayMode

func (CodeDisplayMode) Ptr

type CouponApiService

type CouponApiService services.Service

func (*CouponApiService) AssociateTradeInfo

func (a *CouponApiService) AssociateTradeInfo(ctx context.Context, req AssociateTradeInfoRequest) (resp *AssociateTradeInfoResponse, result *core.APIResult, err error)

AssociateTradeInfo 关联订单信息

适用场景:将有效态(未核销)的商家券与订单信息关联,用于后续参与摇奖&返佣激励等操作的统计 适用对象:如普通服务商、普通直连商户 频率:500QPS 前置条件:已为用户发券,且调用查询接口查到用户的券code、批次ID等信息 注意事项:仅对有关联订单需求的券进行该操作 是否支持幂等:是

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.AssociateTradeInfo(ctx,
		merchantexclusivecoupon.AssociateTradeInfoRequest{
			StockId:      core.String("100088"),
			CouponCode:   core.String("sxxe34343434"),
			OutTradeNo:   core.String("MCH_102233445"),
			OutRequestNo: core.String("1002600620019090123143254435"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call AssociateTradeInfo err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) DeactivateCoupon

func (a *CouponApiService) DeactivateCoupon(ctx context.Context, req DeactivateCouponRequest) (resp *DeactivateCouponResponse, result *core.APIResult, err error)

DeactivateCoupon 使券失效

失效一张券,券被失效后无法再被核销

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.DeactivateCoupon(ctx,
		merchantexclusivecoupon.DeactivateCouponRequest{
			CouponCode:          core.String("sxxe34343434"),
			StockId:             core.String("1234567891"),
			DeactivateRequestNo: core.String("1002600620019090123143254436"),
			DeactivateReason:    core.String("此券使用时间设置错误"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call DeactivateCoupon err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) DisassociateTradeInfo

func (a *CouponApiService) DisassociateTradeInfo(ctx context.Context, req DisassociateTradeInfoRequest) (resp *DisassociateTradeInfoResponse, result *core.APIResult, err error)

DisassociateTradeInfo 取消关联订单信息

适用场景:取消商家券与订单信息的关联关系 适用对象:如普通服务商、普通直连商户 频率:500QPS 前置条件:已调用关联接口为券创建过关联关系 注意事项:建议取消前调用查询接口,查到当前关联的商户单号并确认后,再进行取消操作 是否支持幂等:是

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.DisassociateTradeInfo(ctx,
		merchantexclusivecoupon.DisassociateTradeInfoRequest{
			StockId:      core.String("100088"),
			CouponCode:   core.String("213dsadfsa"),
			OutTradeNo:   core.String("treads8a9f980"),
			OutRequestNo: core.String("fdsafdsafdsa231321"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call DisassociateTradeInfo err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) ListCouponsByFilter

func (a *CouponApiService) ListCouponsByFilter(ctx context.Context, req ListCouponsByFilterRequest) (resp *CouponListResponse, result *core.APIResult, err error)

ListCouponsByFilter 根据过滤条件查询用户的券

商户自定义筛选条件(如创建商户号、归属商户号、发放商户号等),查询指定微信用户卡包中满足对应条件的所有商家券信息。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.ListCouponsByFilter(ctx,
		merchantexclusivecoupon.ListCouponsByFilterRequest{
			Openid:          core.String("2323dfsdf342342"),
			Appid:           core.String("wx233544546545989"),
			StockId:         core.String("100088"),
			CreatorMerchant: core.String("1000000001"),
			BelongMerchant:  core.String("1000000002"),
			SenderMerchant:  core.String("1000000003"),
			Offset:          core.Int64(0),
			Limit:           core.Int64(20),
			CouponState:     merchantexclusivecoupon.COUPONSTATUS_SENDED.Ptr(),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ListCouponsByFilter err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) QueryCoupon

func (a *CouponApiService) QueryCoupon(ctx context.Context, req QueryCouponRequest) (resp *CouponEntity, result *core.APIResult, err error)

QueryCoupon 查询用户券详情

商户可通过该接口查询微信用户卡包中某一张商家券的详情信息。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.QueryCoupon(ctx,
		merchantexclusivecoupon.QueryCouponRequest{
			CouponCode: core.String("123446565767"),
			Appid:      core.String("wx233544546545989"),
			Openid:     core.String("2323dfsdf342342"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call QueryCoupon err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) ReturnCoupon

func (a *CouponApiService) ReturnCoupon(ctx context.Context, req ReturnCouponRequest) (resp *ReturnCouponResponse, result *core.APIResult, err error)

ReturnCoupon 申请退券

商户可以在退款之后调用退券API,调用了该接口后,券在用户卡包内正常展示,用户可在有效期内正常使用该优惠券。 若券过期状态下退款,可不用调用该退券API。 前置条件:券的状态为USED

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.ReturnCoupon(ctx,
		merchantexclusivecoupon.ReturnCouponRequest{
			CouponCode:      core.String("sxxe34343434"),
			StockId:         core.String("1234567891"),
			ReturnRequestNo: core.String("1002600620019090123143254436"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ReturnCoupon err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) SendCoupon

func (a *CouponApiService) SendCoupon(ctx context.Context, req SendCouponRequest) (resp *SendCouponResponse, result *core.APIResult, err error)

SendCoupon 向用户发券

用于向用户发送商家券

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.SendCoupon(ctx,
		merchantexclusivecoupon.SendCouponRequest{
			Openid:       core.String("xsd3434454567676"),
			Appid:        core.String("wx1234567889999"),
			StockId:      core.String("12312354"),
			OutRequestNo: core.String("2335465"),
			CouponCode:   core.String("202007019999"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call SendCoupon err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) SendGovCard

func (a *CouponApiService) SendGovCard(ctx context.Context, req SendGovCardRequest) (resp *CouponSendGovCardResponse, result *core.APIResult, err error)

SendGovCard 发放政府消费卡

发放政府消费卡

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.SendGovCard(ctx,
		merchantexclusivecoupon.SendGovCardRequest{
			CardId:       core.String("pIJMr5MMiIkO_93VtPyIiEk2DZ4w"),
			Appid:        core.String("wxc0b84a53ed8e8d29"),
			Openid:       core.String("obLatjhnqgy2syxrXVM3MJirbkdI"),
			OutRequestNo: core.String("oTYhjfdsahnssddj_0136"),
			SendTime:     core.String("2019-12-31T13:29:35+08:00"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call SendGovCard err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*CouponApiService) UseCoupon

func (a *CouponApiService) UseCoupon(ctx context.Context, req UseCouponRequest) (resp *UseCouponResponse, result *core.APIResult, err error)

UseCoupon 核销用户的券

在用户满足优惠门槛后,商户可通过该接口核销用户微信卡包中具体某一张商家券。 核销频率:500QPS

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.CouponApiService{Client: client}
	resp, result, err := svc.UseCoupon(ctx,
		merchantexclusivecoupon.UseCouponRequest{
			CouponCode:   core.String("sxxe34343434"),
			StockId:      core.String("100088"),
			Appid:        core.String("wx1234567889999"),
			UseTime:      core.String("2015-05-20T13:29:35+08:00"),
			UseRequestNo: core.String("1002600620019090123143254435"),
			Openid:       core.String("xsd3434454567676"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call UseCoupon err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

type CouponCodeCount

type CouponCodeCount struct {
	// 该批次总共已上传的code总数
	TotalCount *int64 `json:"total_count"`
	// 该批次当前可用的code数
	AvailableCount *int64 `json:"available_count"`
}

CouponCodeCount

func (CouponCodeCount) Clone

func (o CouponCodeCount) Clone() *CouponCodeCount

func (CouponCodeCount) MarshalJSON

func (o CouponCodeCount) MarshalJSON() ([]byte, error)

func (CouponCodeCount) String

func (o CouponCodeCount) String() string

type CouponCodeEntity

type CouponCodeEntity struct {
	// 商户上传code
	Code *string `json:"code"`
	// 商户上传code分配状态
	CodeStatus *CouponCodeStatus `json:"code_status"`
	// code上传成功的时间
	UploadTime *time.Time `json:"upload_time,omitempty"`
	// 当code状态为被分配时,code被分配的时间
	DispatchedTime *time.Time `json:"dispatched_time,omitempty"`
	// 领券用户的OpenID
	Openid *string `json:"openid,omitempty"`
	// 领券用户的UnionID,具体参见https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html
	Unionid *string `json:"unionid,omitempty"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code,omitempty"`
}

CouponCodeEntity

func (CouponCodeEntity) Clone

func (CouponCodeEntity) MarshalJSON

func (o CouponCodeEntity) MarshalJSON() ([]byte, error)

func (CouponCodeEntity) String

func (o CouponCodeEntity) String() string

type CouponCodeInfoRequest

type CouponCodeInfoRequest struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 商户上传code
	CouponCode *string `json:"coupon_code"`
	// 公众账号ID
	Appid *string `json:"appid,omitempty"`
}

CouponCodeInfoRequest

func (CouponCodeInfoRequest) Clone

func (CouponCodeInfoRequest) MarshalJSON

func (o CouponCodeInfoRequest) MarshalJSON() ([]byte, error)

func (CouponCodeInfoRequest) String

func (o CouponCodeInfoRequest) String() string

type CouponCodeInfoResponse

type CouponCodeInfoResponse struct {
	// 商户上传code信息,含状态,上传时间等
	CodeInformation *CouponCodeEntity `json:"code_information"`
	// 用户券信息,仅当商户上传code的状态为DISPATCHED时返回券详情
	CouponInformation *CouponEntity `json:"coupon_information,omitempty"`
}

CouponCodeInfoResponse

func (CouponCodeInfoResponse) Clone

func (CouponCodeInfoResponse) MarshalJSON

func (o CouponCodeInfoResponse) MarshalJSON() ([]byte, error)

func (CouponCodeInfoResponse) String

func (o CouponCodeInfoResponse) String() string

type CouponCodeListResponse

type CouponCodeListResponse struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 该批次已上传code总个数
	TotalCount *int64 `json:"total_count"`
	// 查询code的结果列表
	Data []CouponCodeEntity `json:"data,omitempty"`
	// 分页起始位置,与请求相同
	Offset *int64 `json:"offset"`
	// 返回数据的实际个数
	Limit *int64 `json:"limit"`
}

CouponCodeListResponse

func (CouponCodeListResponse) Clone

func (CouponCodeListResponse) MarshalJSON

func (o CouponCodeListResponse) MarshalJSON() ([]byte, error)

func (CouponCodeListResponse) String

func (o CouponCodeListResponse) String() string

type CouponCodeMode

type CouponCodeMode string

CouponCodeMode

const (
	COUPONCODEMODE_WECHATPAY_MODE  CouponCodeMode = "WECHATPAY_MODE"
	COUPONCODEMODE_MERCHANT_API    CouponCodeMode = "MERCHANT_API"
	COUPONCODEMODE_MERCHANT_UPLOAD CouponCodeMode = "MERCHANT_UPLOAD"
)

Enums of CouponCodeMode

func (CouponCodeMode) Ptr

func (e CouponCodeMode) Ptr() *CouponCodeMode

type CouponCodeStatus

type CouponCodeStatus string

CouponCodeStatus

const (
	COUPONCODESTATUS_AVAILABLE  CouponCodeStatus = "AVAILABLE"
	COUPONCODESTATUS_DISPATCHED CouponCodeStatus = "DISPATCHED"
)

Enums of CouponCodeStatus

func (CouponCodeStatus) Ptr

type CouponEntity

type CouponEntity struct {
	// 代金券的所属商户号
	BelongMerchant *string `json:"belong_merchant"`
	// 批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。
	StockName *string `json:"stock_name"`
	// 仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。
	Comment *string `json:"comment,omitempty"`
	// 适用商品范围,字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
	GoodsName *string `json:"goods_name"`
	// 批次类型
	StockType *BusiFavorStockType `json:"stock_type"`
	// 不填默认否,枚举值: true:是 false:否 该字段暂未开放
	Transferable *bool `json:"transferable,omitempty"`
	// 不填默认否,枚举值: true:是 false:否 该字段暂未开放
	Shareable *bool `json:"shareable,omitempty"`
	// 商家券状态
	CouponState *CouponStatus `json:"coupon_state,omitempty"`
	//
	DisplayPatternInfo *DisplayPatternInfo `json:"display_pattern_info,omitempty"`
	//
	CouponUseRule *CouponUseRule `json:"coupon_use_rule"`
	//
	CustomEntrance *CustomEntrance `json:"custom_entrance,omitempty"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code,omitempty"`
	// 批次号
	StockId *string `json:"stock_id,omitempty"`
	// 用户领取到的这张券实际可使用的开始时间:如批次设置的领取后可用,则开始时间即为券的领取时间; 如批次设置的领取后第X天可用,则为领取时间后第X天00:00:00
	AvailableStartTime *time.Time `json:"available_start_time,omitempty"`
	// 用户领取到这张券的过期时间
	ExpireTime *time.Time `json:"expire_time,omitempty"`
	// 用户领取到这张券的时间
	ReceiveTime *time.Time `json:"receive_time,omitempty"`
	// 发券时传入的唯一凭证
	SendRequestNo *string `json:"send_request_no,omitempty"`
	// 核销时传入的唯一凭证(如券已被核销,将返回此字段)
	UseRequestNo *string `json:"use_request_no,omitempty"`
	// 券被核销的时间(如券已被核销,将返回此字段)
	UseTime *time.Time `json:"use_time,omitempty"`
	// 若商家券操作过关联商户订单信息,则该字段返回商家券已关联的商户订单号。
	AssociateOutTradeNo *time.Time `json:"associate_out_trade_no,omitempty"`
	// 回退时传入的唯一凭证(如券发生了退回,将返回此字段)
	ReturnRequestNo *string `json:"return_request_no,omitempty"`
	// 券被回退的时间(如券发生了退回,将返回此字段)
	ReturnTime *time.Time `json:"return_time,omitempty"`
	// 失效时传入的唯一凭证(如果一张券已失效,将返回此字段)
	DeactivateRequestNo *string `json:"deactivate_request_no,omitempty"`
	// 券被失效的时间(如果一张券已失效,将返回此字段)
	DeactivateTime *time.Time `json:"deactivate_time,omitempty"`
	// 失效一张券的原因(如果一张券已失效,可能返回此字段)
	DeactivateReason *string `json:"deactivate_reason,omitempty"`
}

CouponEntity

func (CouponEntity) Clone

func (o CouponEntity) Clone() *CouponEntity

func (CouponEntity) MarshalJSON

func (o CouponEntity) MarshalJSON() ([]byte, error)

func (CouponEntity) String

func (o CouponEntity) String() string

type CouponListResponse

type CouponListResponse struct {
	Data []CouponEntity `json:"data,omitempty"`
	// 总数量
	TotalCount *int64 `json:"total_count"`
	// 分页大小
	Limit *int64 `json:"limit"`
	// 分页页码
	Offset *int64 `json:"offset"`
}

CouponListResponse

func (CouponListResponse) Clone

func (CouponListResponse) MarshalJSON

func (o CouponListResponse) MarshalJSON() ([]byte, error)

func (CouponListResponse) String

func (o CouponListResponse) String() string

type CouponSendGovCardRequest

type CouponSendGovCardRequest struct {
	// 消费卡cardi\\_d创建方的AppID,需与API调用方商户号有绑定关系,入参中的用户OpenID也需用此AppID生成
	Appid *string `json:"appid"`
	// 待发券用户的OpenID,需为消费卡创建方AppID生成的OpenID
	Openid *string `json:"openid"`
	// 商户此次发放凭据号。推荐使用大小写字母和数字,不同添加请求发放凭据号不同,商户侧需保证同一发券请求的out_request_no+send_time唯一性
	OutRequestNo *string `json:"out_request_no"`
	// 单次请求发卡时间,消费卡在商户系统的实际发放时间,为东八区标准时间(UTC+8)。商户需保证同一次请求的out_request_no+send_time唯一。由于系统限制,暂不支持传入早于当前时间24小时以上的时间进行发券请求。
	SendTime *string `json:"send_time"`
}

CouponSendGovCardRequest

func (CouponSendGovCardRequest) Clone

func (CouponSendGovCardRequest) MarshalJSON

func (o CouponSendGovCardRequest) MarshalJSON() ([]byte, error)

func (CouponSendGovCardRequest) String

func (o CouponSendGovCardRequest) String() string

type CouponSendGovCardResponse

type CouponSendGovCardResponse struct {
	// 消费卡card_id下的code
	CardCode *string `json:"card_code"`
}

CouponSendGovCardResponse

func (CouponSendGovCardResponse) Clone

func (CouponSendGovCardResponse) MarshalJSON

func (o CouponSendGovCardResponse) MarshalJSON() ([]byte, error)

func (CouponSendGovCardResponse) String

func (o CouponSendGovCardResponse) String() string

type CouponStatus

type CouponStatus string

CouponStatus

const (
	COUPONSTATUS_SENDED      CouponStatus = "SENDED"
	COUPONSTATUS_USED        CouponStatus = "USED"
	COUPONSTATUS_EXPIRED     CouponStatus = "EXPIRED"
	COUPONSTATUS_DELETED     CouponStatus = "DELETED"
	COUPONSTATUS_DEACTIVATED CouponStatus = "DEACTIVATED"
)

Enums of CouponStatus

func (CouponStatus) Ptr

func (e CouponStatus) Ptr() *CouponStatus

type CouponUseMethod

type CouponUseMethod string

CouponUseMethod

const (
	COUPONUSEMETHOD_OFF_LINE      CouponUseMethod = "OFF_LINE"
	COUPONUSEMETHOD_MINI_PROGRAMS CouponUseMethod = "MINI_PROGRAMS"
	COUPONUSEMETHOD_SELF_CONSUME  CouponUseMethod = "SELF_CONSUME"
	COUPONUSEMETHOD_PAYMENT_CODE  CouponUseMethod = "PAYMENT_CODE"
)

Enums of CouponUseMethod

func (CouponUseMethod) Ptr

type CouponUseRule

type CouponUseRule struct {
	// 日期区间内可以使用优惠
	CouponAvailableTime *FavorAvailableTime `json:"coupon_available_time"`
	// 固定面额满减,折扣券,换购券使用规则三选一,stock_type为NORMAL时必填。
	FixedNormalCoupon *FixedValueStockMsg `json:"fixed_normal_coupon,omitempty"`
	// 固定面额满减,折扣券,换购券使用规则三选一,stock_type为DISCOUNT时必填。
	DiscountCoupon *DiscountMsg `json:"discount_coupon,omitempty"`
	// 固定面额满减,折扣券,换购券使用规则三选一,stock_type为EXCHANGE时必填。
	ExchangeCoupon *ExchangeMsg `json:"exchange_coupon,omitempty"`
	// 核销方式
	UseMethod *CouponUseMethod `json:"use_method"`
	// 核销方式为线上小程序核销才有效
	MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"`
	// 核销方式为线上小程序核销才有效
	MiniProgramsPath *string `json:"mini_programs_path,omitempty"`
}

CouponUseRule

func (CouponUseRule) Clone

func (o CouponUseRule) Clone() *CouponUseRule

func (CouponUseRule) MarshalJSON

func (o CouponUseRule) MarshalJSON() ([]byte, error)

func (CouponUseRule) String

func (o CouponUseRule) String() string

type CreateBusiFavorStockRequest

type CreateBusiFavorStockRequest struct {
	// 批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。
	StockName *string `json:"stock_name"`
	// 批次归属于哪个商户。  注: 普通直连模式,该参数为直连商户号; 服务商模式,该参数为子商户号; 间连模式,该参数为子商户号。
	BelongMerchant *string `json:"belong_merchant"`
	// 仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。
	Comment *string `json:"comment,omitempty"`
	// 用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
	GoodsName *string `json:"goods_name"`
	// 批次类型
	StockType *BusiFavorStockType `json:"stock_type"`
	// 券核销相关规则
	CouponUseRule *CouponUseRule `json:"coupon_use_rule"`
	// 券发放相关规则
	StockSendRule *StockSendRule `json:"stock_send_rule"`
	// 商户创建批次凭据号(格式:商户ID+日期+流水号),商户侧需保持唯一性
	OutRequestNo *string `json:"out_request_no"`
	// 卡详情页面,可选择多种入口引导用户
	CustomEntrance *CustomEntrance `json:"custom_entrance,omitempty"`
	// 创建批次时的样式信息。
	DisplayPatternInfo *DisplayPatternInfo `json:"display_pattern_info,omitempty"`
	// 特殊规则: 1、券code模式为WECHATPAY\\_MODE时,是微信自动分配券code,商户不需要预存code;适用于多种场景 2、券code模式为MERCHANT\\_API时,无需调用上传预存code接口,调用发券接口时需指定券code;更多用在商家自有流量场景(例如:商家自有小程序、H5网页等) 3、券code模式为MERCHANT\\_UPLOAD,需要调用上传预存code接口上传code,调用发券接口时无需指定code;更多适用在微信支付平台流量场景(例如:支付有礼、支付有优惠等)
	CouponCodeMode *CouponCodeMode `json:"coupon_code_mode"`
	// 事件回调通知商户的配置
	NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
	// 该批次发放的券是否允许进行补差,默认为false 注:该字段暂未开放
	Subsidy *bool `json:"subsidy,omitempty"`
}

CreateBusiFavorStockRequest

func (CreateBusiFavorStockRequest) Clone

func (CreateBusiFavorStockRequest) MarshalJSON

func (o CreateBusiFavorStockRequest) MarshalJSON() ([]byte, error)

func (CreateBusiFavorStockRequest) String

type CreateBusiFavorStockResponse

type CreateBusiFavorStockResponse struct {
	// 批次号
	StockId *string `json:"stock_id"`
	// 创建时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	CreateTime *string `json:"create_time"`
}

CreateBusiFavorStockResponse

func (CreateBusiFavorStockResponse) Clone

func (CreateBusiFavorStockResponse) MarshalJSON

func (o CreateBusiFavorStockResponse) MarshalJSON() ([]byte, error)

func (CreateBusiFavorStockResponse) String

type CreateBusifavorStockRequest

type CreateBusifavorStockRequest CreateBusiFavorStockRequest

func (CreateBusifavorStockRequest) Clone

func (CreateBusifavorStockRequest) MarshalJSON

func (o CreateBusifavorStockRequest) MarshalJSON() ([]byte, error)

func (CreateBusifavorStockRequest) String

type CustomEntrance

type CustomEntrance struct {
	// 需要小程序APPID、path、入口文案、引导文案。如果需要跳转小程序,APPID、path、入口文案为必填,引导文案非必填。 AppID要与归属商户号有M-A or M-m-suba关系。 注:请查看[绑定关系说明文档](https://pay.weixin.qq.com/wiki/doc/apiv3/open/pay/chapter5_2_2.shtml#part-7)
	MiniProgramsInfo *MiniAppInfo `json:"mini_programs_info,omitempty"`
	// 可配置商户公众号,从券详情可跳转至公众号,用户自定义字段。 校验规则:传入的AppID得是与调用方商户号(即请求头里面的商户号)有绑定关系的AppID 或 传入的AppID得是归属商户号有绑定关系的AppID
	Appid *string `json:"appid,omitempty"`
	// 填写微信支付营销馆的馆ID,用户自定义字段。[营销馆](https://pay.weixin.qq.com/index.php/xphp/cfav_market/hall#/pages/list/list)需在商户平台创建。
	HallId *string `json:"hall_id,omitempty"`
	// 填写代金券可用门店ID
	StoreId *string `json:"store_id,omitempty"`
	// code展示模式
	CodeDisplayMode *CodeDisplayMode `json:"code_display_mode,omitempty"`
}

CustomEntrance

func (CustomEntrance) Clone

func (o CustomEntrance) Clone() *CustomEntrance

func (CustomEntrance) MarshalJSON

func (o CustomEntrance) MarshalJSON() ([]byte, error)

func (CustomEntrance) String

func (o CustomEntrance) String() string

type DeactivateCouponRequest

type DeactivateCouponRequest struct {
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 券的所属批次号
	StockId *string `json:"stock_id"`
	// 每次失效请求的唯一标识,商户需保证唯一
	DeactivateRequestNo *string `json:"deactivate_request_no"`
	// 商户失效券的原因
	DeactivateReason *string `json:"deactivate_reason,omitempty"`
}

DeactivateCouponRequest

func (DeactivateCouponRequest) Clone

func (DeactivateCouponRequest) MarshalJSON

func (o DeactivateCouponRequest) MarshalJSON() ([]byte, error)

func (DeactivateCouponRequest) String

func (o DeactivateCouponRequest) String() string

type DeactivateCouponResponse

type DeactivateCouponResponse struct {
	// 系统券成功失效的时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	WechatpayDeactivateTime *time.Time `json:"wechatpay_deactivate_time"`
}

DeactivateCouponResponse

func (DeactivateCouponResponse) Clone

func (DeactivateCouponResponse) MarshalJSON

func (o DeactivateCouponResponse) MarshalJSON() ([]byte, error)

func (DeactivateCouponResponse) String

func (o DeactivateCouponResponse) String() string

type DeleteCouponCodeRequest

type DeleteCouponCodeRequest struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 上传的自定义code
	CouponCode *string `json:"coupon_code"`
	// 商户删除code的凭据号,商户侧需保持唯一性
	DeleteRequestNo *string `json:"delete_request_no"`
}

DeleteCouponCodeRequest

func (DeleteCouponCodeRequest) Clone

func (DeleteCouponCodeRequest) MarshalJSON

func (o DeleteCouponCodeRequest) MarshalJSON() ([]byte, error)

func (DeleteCouponCodeRequest) String

func (o DeleteCouponCodeRequest) String() string

type DeleteCouponCodeResponse

type DeleteCouponCodeResponse struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 商家券code实际被删除的时间
	DeleteTime *string `json:"delete_time"`
}

DeleteCouponCodeResponse

func (DeleteCouponCodeResponse) Clone

func (DeleteCouponCodeResponse) MarshalJSON

func (o DeleteCouponCodeResponse) MarshalJSON() ([]byte, error)

func (DeleteCouponCodeResponse) String

func (o DeleteCouponCodeResponse) String() string

type DisassociateTradeInfoRequest

type DisassociateTradeInfoRequest struct {
	// 微信为每个商家券批次分配的唯一ID, 对于商户自定义code的批次,关联请求必须填写批次号
	StockId *string `json:"stock_id"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 欲取消与商家券关联的微信支付下单的商户订单号,该单号需要已操作过与券关联,否则无法取消关联
	OutTradeNo *string `json:"out_trade_no"`
	// 商户创建批次凭据号(格式:商户ID+日期+流水号),商户侧需保持唯一性,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号。
	OutRequestNo *string `json:"out_request_no"`
}

DisassociateTradeInfoRequest

func (DisassociateTradeInfoRequest) Clone

func (DisassociateTradeInfoRequest) MarshalJSON

func (o DisassociateTradeInfoRequest) MarshalJSON() ([]byte, error)

func (DisassociateTradeInfoRequest) String

type DisassociateTradeInfoResponse

type DisassociateTradeInfoResponse struct {
	// 系统成功取消商家券与订单信息关联关系的时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	WechatpayDisassociateTime *time.Time `json:"wechatpay_disassociate_time"`
}

DisassociateTradeInfoResponse

func (DisassociateTradeInfoResponse) Clone

func (DisassociateTradeInfoResponse) MarshalJSON

func (o DisassociateTradeInfoResponse) MarshalJSON() ([]byte, error)

func (DisassociateTradeInfoResponse) String

type DiscountMsg

type DiscountMsg struct {
	// 折扣百分比,88为88折
	DiscountPercent *int64 `json:"discount_percent,omitempty"`
	// 消费门槛,单位:分。 特殊规则:取值范围 1 ≤ value ≤ 10000000
	TransactionMinimum *int64 `json:"transaction_minimum,omitempty"`
}

DiscountMsg

func (DiscountMsg) Clone

func (o DiscountMsg) Clone() *DiscountMsg

func (DiscountMsg) MarshalJSON

func (o DiscountMsg) MarshalJSON() ([]byte, error)

func (DiscountMsg) String

func (o DiscountMsg) String() string

type DisplayPatternInfo

type DisplayPatternInfo struct {
	// 用于说明详细的活动规则,会展示在代金券详情页。
	Description *string `json:"description,omitempty"`
	// 若券归属商户号有认证品牌,则系统将自动拉取对应品牌logo;若券归属商户号不在认证品牌下,需自定义上传logo,未上传时将展示兜底灰色logo样式,影响券详情页用户体验,请及时上传。 商户logo的URL地址,仅支持通过《[图片上传API](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_0_1.shtml)》接口获取的图片URL地址。 1、商户logo大小需为120像素\\*120像素。 2、支持JPG/JPEG/PNG格式,且图片小于1M。 注:该字段暂不支持修改
	MerchantLogoUrl *string `json:"merchant_logo_url,omitempty"`
	// 不支持商户自定义。若券归属商户号有认证品牌,系统将自动拉取认证品牌号下的品牌名称;若券归属商户号不在认证品牌下,则拉取本商户号的商户简称。展示上限12个字符。 注:该字段暂不支持修改
	MerchantName *string `json:"merchant_name,omitempty"`
	// 券的背景颜色,可设置10种颜色,色值请参考[卡券背景颜色图](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_2_1.shtml#part-01)。颜色取值为颜色图中的颜色名称。
	BackgroundColor *string `json:"background_color,omitempty"`
	// 券详情图片,1074像素(宽)\\*603像素(高),图片大小不超过2M,支持JPG/PNG格式。仅支持通过《[图片上传API](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_0_1.shtml)》接口获取的图片URL地址。
	CouponImageUrl *string `json:"coupon_image_url,omitempty"`
	// 视频号相关信息
	FinderInfo *FinderInfo `json:"finder_info,omitempty"`
}

DisplayPatternInfo

func (DisplayPatternInfo) Clone

func (DisplayPatternInfo) MarshalJSON

func (o DisplayPatternInfo) MarshalJSON() ([]byte, error)

func (DisplayPatternInfo) String

func (o DisplayPatternInfo) String() string

type ExchangeMsg

type ExchangeMsg struct {
	// 单品换购价,单位:分。 特殊规则:取值范围 0 ≤ value ≤ 10000000
	ExchangePrice *int64 `json:"exchange_price,omitempty"`
	// 消费门槛,单位:分。 特殊规则:取值范围 1 ≤ value ≤ 10000000
	TransactionMinimum *int64 `json:"transaction_minimum,omitempty"`
}

ExchangeMsg

func (ExchangeMsg) Clone

func (o ExchangeMsg) Clone() *ExchangeMsg

func (ExchangeMsg) MarshalJSON

func (o ExchangeMsg) MarshalJSON() ([]byte, error)

func (ExchangeMsg) String

func (o ExchangeMsg) String() string

type FavorAvailableTime

type FavorAvailableTime struct {
	// 批次开始时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 注意:商家券有效期最长为1年。
	AvailableBeginTime *time.Time `json:"available_begin_time"`
	// 批次结束时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 注意:商家券有效期最长为1年。
	AvailableEndTime *time.Time `json:"available_end_time"`
	// 日期区间内,券生效后x天内有效。例如生效当天内有效填1,生效后2天内有效填2,以此类推……注意,用户在有效期开始前领取商家券,则从有效期第1天开始计算天数,用户在有效期内领取商家券,则从领取当天开始计算天数,无论用户何时领取商家券,商家券在活动有效期结束后均不可用。可配合wait_days_after_receive一同填写,也可单独填写。单独填写时,有效期内领券后立即生效,生效后x天内有效。
	AvailableDayAfterReceive *int64 `json:"available_day_after_receive,omitempty"`
	// 可以设置多个星期下的多个可用时间段,比如每周二10点到18点
	AvailableWeek *AvailableWeek `json:"available_week,omitempty"`
	// 无规律的有效时间,多个无规律时间段
	IrregularyAvaliableTime []IrregularAvailableTime `json:"irregulary_avaliable_time,omitempty"`
	// 日期区间内,用户领券后需等待x天开始生效。例如领券后当天开始生效则无需填写,领券后第2天开始生效填1,以此类推……用户在有效期开始前领取商家券,则从有效期第1天开始计算天数,用户在有效期内领取商家券,则从领取当天开始计算天数。无论用户何时领取商家券,商家券在活动有效期结束后均不可用。需配合available_day_after_receive一同填写,不可单独填写。注:最大不能超过30天
	WaitDaysAfterReceive *int64 `json:"wait_days_after_receive,omitempty"`
}

FavorAvailableTime

func (FavorAvailableTime) Clone

func (FavorAvailableTime) MarshalJSON

func (o FavorAvailableTime) MarshalJSON() ([]byte, error)

func (FavorAvailableTime) String

func (o FavorAvailableTime) String() string

type FinderInfo

type FinderInfo struct {
	// 关联视频号将展示在优惠券详情的顶部右侧,作为跳转去视频号的入口,入参参数请配置视频号id,请前往[视频号助手](https://channels.weixin.qq.com)管理查看视频号ID
	FinderId *string `json:"finder_id,omitempty"`
	// 券详情视频内容,支持配置关联视频号下的具体视频内容,入参参数请配置视频id,请前往[视频号助手](https://channels.weixin.qq.com)管理后台复制具体视频ID
	FinderVideoId *string `json:"finder_video_id,omitempty"`
	// 截取的视频号图片将在券到期提醒消息、券详情中展示。 1.图片尺寸:716像素(宽)\\*402像素(高);图片大小不超过2M,支持JPG/PNG格式。 2.仅支持通过《[图片上传API](https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter9_0_1.shtml)》接口获取的图片URL地址。
	FinderVideoCoverImageUrl *string `json:"finder_video_cover_image_url,omitempty"`
}

FinderInfo

func (FinderInfo) Clone

func (o FinderInfo) Clone() *FinderInfo

func (FinderInfo) MarshalJSON

func (o FinderInfo) MarshalJSON() ([]byte, error)

func (FinderInfo) String

func (o FinderInfo) String() string

type FixedValueStockMsg

type FixedValueStockMsg struct {
	// 优惠金额 单位分。 特殊规则:取值范围 1 ≤ value ≤ 10000000
	DiscountAmount *int64 `json:"discount_amount,omitempty"`
	// 消费门槛,单位:分。 特殊规则:取值范围 1 ≤ value ≤ 10000000
	TransactionMinimum *int64 `json:"transaction_minimum,omitempty"`
}

FixedValueStockMsg

func (FixedValueStockMsg) Clone

func (FixedValueStockMsg) MarshalJSON

func (o FixedValueStockMsg) MarshalJSON() ([]byte, error)

func (FixedValueStockMsg) String

func (o FixedValueStockMsg) String() string

type GetCouponNotifyRequest

type GetCouponNotifyRequest struct {
	// 商户号,不填默认查询调用方商户号
	Mchid *string `json:"mchid,omitempty"`
}

GetCouponNotifyRequest

func (GetCouponNotifyRequest) Clone

func (GetCouponNotifyRequest) MarshalJSON

func (o GetCouponNotifyRequest) MarshalJSON() ([]byte, error)

func (GetCouponNotifyRequest) String

func (o GetCouponNotifyRequest) String() string

type GetCouponNotifyResponse

type GetCouponNotifyResponse struct {
	// 商户号
	Mchid *string `json:"mchid"`
	// 商户提供的用于接收商家券事件通知的URL地址,必须支持HTTPS。
	NotifyUrl *string `json:"notify_url"`
}

GetCouponNotifyResponse

func (GetCouponNotifyResponse) Clone

func (GetCouponNotifyResponse) MarshalJSON

func (o GetCouponNotifyResponse) MarshalJSON() ([]byte, error)

func (GetCouponNotifyResponse) String

func (o GetCouponNotifyResponse) String() string

type IrregularAvailableTime

type IrregularAvailableTime struct {
	// 开始时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	BeginTime *time.Time `json:"begin_time,omitempty"`
	// 结束时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	EndTime *time.Time `json:"end_time,omitempty"`
}

IrregularAvailableTime

func (IrregularAvailableTime) Clone

func (IrregularAvailableTime) MarshalJSON

func (o IrregularAvailableTime) MarshalJSON() ([]byte, error)

func (IrregularAvailableTime) String

func (o IrregularAvailableTime) String() string

type ListCouponsByFilterRequest

type ListCouponsByFilterRequest struct {
	// Openid信息,用户在AppID下的唯一标识。 校验规则:传入的OpenID得是调用方商户号(即请求头里面的商户号)有绑定关系的AppID获取的OpenID或传入的OpenID得是归属商户号有绑定关系的AppID获取的OpenID。[获取OpenID文档](https://pay.weixin.qq.com/wiki/doc/apiv3/terms_definition/chapter1_1_3.shtml#part-3)
	Openid *string `json:"openid"`
	// 支持传入与当前调用接口商户号有绑定关系的AppID。支持小程序AppID与公众号AppID。 校验规则:传入的AppID得是与调用方商户号(即请求头里面的商户号)有绑定关系的AppID 或 传入的AppID得是归属商户号有绑定关系的AppID
	Appid *string `json:"appid"`
	// 批次号,是否指定批次号查询
	StockId *string `json:"stock_id,omitempty"`
	// 批次创建方商户号 校验规则:当调用方商户号(即请求头中的商户号)为创建批次方商户号时,该参数必传
	CreatorMerchant *string `json:"creator_merchant,omitempty"`
	// 批次归属商户号 校验规则:当调用方商户号(即请求头中的商户号)为批次归属商户号时,该参数必传
	BelongMerchant *string `json:"belong_merchant,omitempty"`
	// 批次发放商户号 校验规则:当调用方商户号(即请求头中的商户号)为批次发放商户号时,该参数必传;委托营销关系下,请填写委托发券的商户号
	SenderMerchant *string `json:"sender_merchant,omitempty"`
	// 分页页码
	Offset *int64 `json:"offset,omitempty"`
	// 分页大小
	Limit *int64 `json:"limit,omitempty"`
	// 商家券状态
	CouponState *CouponStatus `json:"coupon_state,omitempty"`
}

ListCouponsByFilterRequest

func (ListCouponsByFilterRequest) Clone

func (ListCouponsByFilterRequest) MarshalJSON

func (o ListCouponsByFilterRequest) MarshalJSON() ([]byte, error)

func (ListCouponsByFilterRequest) String

type MiniAppInfo

type MiniAppInfo struct {
	// 商家小程序AppID要与归属商户号有M-A or M-m-suba关系。 校验规则:传入的AppID得是与调用方商户号(即请求头里面的商户号)有绑定关系的AppID 或 传入的AppID得是归属商户号有绑定关系的AppID
	MiniProgramsAppid *string `json:"mini_programs_appid"`
	// 商家小程序path
	MiniProgramsPath *string `json:"mini_programs_path"`
	// 入口文案,字数上限为5个,一个中文汉字/英文字母/数字均占用一个字数。
	EntranceWords *string `json:"entrance_words"`
	// 小程序入口引导文案,用户自定义字段。字数上限为6个,一个中文汉字/英文字母/数字均占用一个字数。
	GuidingWords *string `json:"guiding_words,omitempty"`
}

MiniAppInfo

func (MiniAppInfo) Clone

func (o MiniAppInfo) Clone() *MiniAppInfo

func (MiniAppInfo) MarshalJSON

func (o MiniAppInfo) MarshalJSON() ([]byte, error)

func (MiniAppInfo) String

func (o MiniAppInfo) String() string

type ModifyBudgetBody

type ModifyBudgetBody struct {
	// 批次最大发放个数,target\\_max\\_coupons与target\\_max\\_coupons\\_by\\_day只能修改一个 注:目标批次即修改后的批次
	TargetMaxCoupons *int64 `json:"target_max_coupons,omitempty"`
	// 当前批次最大发放个数,当传入target\\_max\\_coupons大于0时,current\\_max\\_coupons必传 注:当前批次即未修改的批次
	CurrentMaxCoupons *int64 `json:"current_max_coupons,omitempty"`
	// 单天发放上限个数,target\\_max\\_coupons与target\\_max\\_coupons\\_by\\_day只能修改一个 注:目标批次即修改后的批次
	TargetMaxCouponsByDay *int64 `json:"target_max_coupons_by_day,omitempty"`
	// 当前单天发放上限个数 ,当传入target\\_max\\_coupons\\_by\\_day大于0时,current\\_max\\_coupons\\_by\\_day必填 注:当前批次即未修改的批次
	CurrentMaxCouponsByDay *int64 `json:"current_max_coupons_by_day,omitempty"`
	// 修改预算请求单据号
	ModifyBudgetRequestNo *string `json:"modify_budget_request_no"`
}

ModifyBudgetBody

func (ModifyBudgetBody) Clone

func (ModifyBudgetBody) MarshalJSON

func (o ModifyBudgetBody) MarshalJSON() ([]byte, error)

func (ModifyBudgetBody) String

func (o ModifyBudgetBody) String() string

type ModifyBudgetRequest

type ModifyBudgetRequest struct {
	// 批次号
	StockId *string `json:"stock_id"`
	// 批次最大发放个数,target\\_max\\_coupons与target\\_max\\_coupons\\_by\\_day只能修改一个 注:目标批次即修改后的批次
	TargetMaxCoupons *int64 `json:"target_max_coupons,omitempty"`
	// 当前批次最大发放个数,当传入target\\_max\\_coupons大于0时,current\\_max\\_coupons必传 注:当前批次即未修改的批次
	CurrentMaxCoupons *int64 `json:"current_max_coupons,omitempty"`
	// 单天发放上限个数,target\\_max\\_coupons与target\\_max\\_coupons\\_by\\_day只能修改一个 注:目标批次即修改后的批次
	TargetMaxCouponsByDay *int64 `json:"target_max_coupons_by_day,omitempty"`
	// 当前单天发放上限个数 ,当传入target\\_max\\_coupons\\_by\\_day大于0时,current\\_max\\_coupons\\_by\\_day必填 注:当前批次即未修改的批次
	CurrentMaxCouponsByDay *int64 `json:"current_max_coupons_by_day,omitempty"`
	// 修改预算请求单据号
	ModifyBudgetRequestNo *string `json:"modify_budget_request_no"`
}

ModifyBudgetRequest

func (ModifyBudgetRequest) Clone

func (ModifyBudgetRequest) MarshalJSON

func (o ModifyBudgetRequest) MarshalJSON() ([]byte, error)

func (ModifyBudgetRequest) String

func (o ModifyBudgetRequest) String() string

type ModifyBudgetResponse

type ModifyBudgetResponse struct {
	// 批次最大发放个数
	MaxCoupons *int64 `json:"max_coupons"`
	// 当前单天发放上限个数
	MaxCouponsByDay *int64 `json:"max_coupons_by_day,omitempty"`
}

ModifyBudgetResponse

func (ModifyBudgetResponse) Clone

func (ModifyBudgetResponse) MarshalJSON

func (o ModifyBudgetResponse) MarshalJSON() ([]byte, error)

func (ModifyBudgetResponse) String

func (o ModifyBudgetResponse) String() string

type ModifyCouponUseRule

type ModifyCouponUseRule struct {
	// 核销方式
	UseMethod *CouponUseMethod `json:"use_method,omitempty"`
	// 核销方式为线上小程序核销才有效
	MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"`
	// 核销方式为线上小程序核销才有效
	MiniProgramsPath *string `json:"mini_programs_path,omitempty"`
}

ModifyCouponUseRule

func (ModifyCouponUseRule) Clone

func (ModifyCouponUseRule) MarshalJSON

func (o ModifyCouponUseRule) MarshalJSON() ([]byte, error)

func (ModifyCouponUseRule) String

func (o ModifyCouponUseRule) String() string

type ModifyCustomEntrance

type ModifyCustomEntrance struct {
	// 需要小程序APPID、path、入口文案、引导文案。如果需要跳转小程序,APPID、path、入口文案为必填,引导文案非必填。AppID要与归属商户号有绑定关系
	MiniProgramsInfo *ModifyMiniAppInfo `json:"mini_programs_info,omitempty"`
	// 可配置商户公众号,从券详情可跳转至公众号
	Appid *string `json:"appid,omitempty"`
	// 填写微信支付营销馆的馆id,用户自定义字段。[营销馆](https://pay.weixin.qq.com/index.php/xphp/cfav_market/hall#/pages/list/list)需在商户平台创建。
	HallId *string `json:"hall_id,omitempty"`
	// code展示模式
	CodeDisplayMode *CodeDisplayMode `json:"code_display_mode,omitempty"`
}

ModifyCustomEntrance

func (ModifyCustomEntrance) Clone

func (ModifyCustomEntrance) MarshalJSON

func (o ModifyCustomEntrance) MarshalJSON() ([]byte, error)

func (ModifyCustomEntrance) String

func (o ModifyCustomEntrance) String() string

type ModifyMiniAppInfo

type ModifyMiniAppInfo struct {
	// 需要小程序AppID与归属商户号有绑定关系
	MiniProgramsAppid *string `json:"mini_programs_appid,omitempty"`
	// 商家小程序path
	MiniProgramsPath *string `json:"mini_programs_path,omitempty"`
	// 入口文案,字数上限为5个,一个中文汉字/英文字母/数字均占用一个字数。
	EntranceWords *string `json:"entrance_words,omitempty"`
	// 小程序入口引导文案,字数上限为6个,一个中文汉字/英文字母/数字均占用一个字数。
	GuidingWords *string `json:"guiding_words,omitempty"`
}

ModifyMiniAppInfo

func (ModifyMiniAppInfo) Clone

func (ModifyMiniAppInfo) MarshalJSON

func (o ModifyMiniAppInfo) MarshalJSON() ([]byte, error)

func (ModifyMiniAppInfo) String

func (o ModifyMiniAppInfo) String() string

type ModifyStockInfoBody

type ModifyStockInfoBody struct {
	// 卡详情页面,可选择多种入口引导用户
	CustomEntrance *ModifyCustomEntrance `json:"custom_entrance,omitempty"`
	// 批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。 注:该字段暂不支持修改
	StockName *string `json:"stock_name,omitempty"`
	// 仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。
	Comment *string `json:"comment,omitempty"`
	// 用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
	GoodsName *string `json:"goods_name,omitempty"`
	// 商户修改批次凭据号(格式:商户ID+日期+流水号),商户侧需保持唯一性。
	OutRequestNo *string `json:"out_request_no"`
	//
	DisplayPatternInfo *DisplayPatternInfo `json:"display_pattern_info,omitempty"`
	// 券核销相关规则
	CouponUseRule *ModifyCouponUseRule `json:"coupon_use_rule,omitempty"`
	// 券发放相关规则
	StockSendRule *ModifyStockSendRule `json:"stock_send_rule,omitempty"`
	// 事件回调通知商户的配置
	NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
	// 该批次发放的券是否允许进行补差。只允许从false改为true,不支持从true改为false 注:该字段暂未开放
	Subsidy *bool `json:"subsidy,omitempty"`
}

ModifyStockInfoBody

func (ModifyStockInfoBody) Clone

func (ModifyStockInfoBody) MarshalJSON

func (o ModifyStockInfoBody) MarshalJSON() ([]byte, error)

func (ModifyStockInfoBody) String

func (o ModifyStockInfoBody) String() string

type ModifyStockInfoRequest

type ModifyStockInfoRequest struct {
	// 批次号
	StockId *string `json:"stock_id"`
	// 卡详情页面,可选择多种入口引导用户
	CustomEntrance *ModifyCustomEntrance `json:"custom_entrance,omitempty"`
	// 批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。 注:该字段暂不支持修改
	StockName *string `json:"stock_name,omitempty"`
	// 仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。
	Comment *string `json:"comment,omitempty"`
	// 用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
	GoodsName *string `json:"goods_name,omitempty"`
	// 商户修改批次凭据号(格式:商户ID+日期+流水号),商户侧需保持唯一性。
	OutRequestNo *string `json:"out_request_no"`
	//
	DisplayPatternInfo *DisplayPatternInfo `json:"display_pattern_info,omitempty"`
	// 券核销相关规则
	CouponUseRule *ModifyCouponUseRule `json:"coupon_use_rule,omitempty"`
	// 券发放相关规则
	StockSendRule *ModifyStockSendRule `json:"stock_send_rule,omitempty"`
	// 事件回调通知商户的配置
	NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
	// 该批次发放的券是否允许进行补差。只允许从false改为true,不支持从true改为false 注:该字段暂未开放
	Subsidy *bool `json:"subsidy,omitempty"`
}

ModifyStockInfoRequest

func (ModifyStockInfoRequest) Clone

func (ModifyStockInfoRequest) MarshalJSON

func (o ModifyStockInfoRequest) MarshalJSON() ([]byte, error)

func (ModifyStockInfoRequest) String

func (o ModifyStockInfoRequest) String() string

type ModifyStockSendRule

type ModifyStockSendRule struct {
	// true-是;false-否,不填默认否 注:该字段暂不支持修改
	NaturalPersonLimit *bool `json:"natural_person_limit,omitempty"`
	// true-是;false-否,不填默认否
	PreventApiAbuse *bool `json:"prevent_api_abuse,omitempty"`
}

ModifyStockSendRule

func (ModifyStockSendRule) Clone

func (ModifyStockSendRule) MarshalJSON

func (o ModifyStockSendRule) MarshalJSON() ([]byte, error)

func (ModifyStockSendRule) String

func (o ModifyStockSendRule) String() string

type NotifyConfig

type NotifyConfig struct {
	// 用于回调通知时,计算返回操作用户的OpenID(诸如领券用户),支持小程序or公众号的AppID;如该字段不填写,则回调通知中涉及到用户身份信息的OpenID与UnionID都将为空。
	NotifyAppid *string `json:"notify_appid,omitempty"`
}

NotifyConfig

func (NotifyConfig) Clone

func (o NotifyConfig) Clone() *NotifyConfig

func (NotifyConfig) MarshalJSON

func (o NotifyConfig) MarshalJSON() ([]byte, error)

func (NotifyConfig) String

func (o NotifyConfig) String() string

type PayReceiptInfoRequest

type PayReceiptInfoRequest struct {
	// 补差付款唯一单号,由微信支付生成,仅在补差付款成功后有返回
	SubsidyReceiptId *string `json:"subsidy_receipt_id"`
}

PayReceiptInfoRequest

func (PayReceiptInfoRequest) Clone

func (PayReceiptInfoRequest) MarshalJSON

func (o PayReceiptInfoRequest) MarshalJSON() ([]byte, error)

func (PayReceiptInfoRequest) String

func (o PayReceiptInfoRequest) String() string

type PayReceiptListRequest

type PayReceiptListRequest struct {
	// 由微信支付生成,调用创建商家券API成功时返回的唯一批次ID
	StockId *string `json:"stock_id"`
	// 券的唯一标识。 在WECHATPAY\\_MODE的券code模式下,商家券code是由微信支付生成的唯一ID; 在MERCHANT\\_UPLOAD、MERCHANT\\_API的券code模式下,商家券code是由商户上传或指定,在批次下保证唯一;
	CouponCode *string `json:"coupon_code"`
	// 商户调用补差付款API时填写的“业务请求唯一单号”
	OutSubsidyNo *string `json:"out_subsidy_no,omitempty"`
}

PayReceiptListRequest

func (PayReceiptListRequest) Clone

func (PayReceiptListRequest) MarshalJSON

func (o PayReceiptListRequest) MarshalJSON() ([]byte, error)

func (PayReceiptListRequest) String

func (o PayReceiptListRequest) String() string

type QueryCouponCodeListRequest

type QueryCouponCodeListRequest struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 分页查询的最大size
	Limit *int64 `json:"limit,omitempty"`
	// 分页查询的起始位置
	Offset *int64 `json:"offset,omitempty"`
	// 公众账号ID
	Appid *string `json:"appid,omitempty"`
	// 券code状态,当不填写时为查询所有状态的code列表
	Status *CouponCodeStatus `json:"status,omitempty"`
}

QueryCouponCodeListRequest

func (QueryCouponCodeListRequest) Clone

func (QueryCouponCodeListRequest) MarshalJSON

func (o QueryCouponCodeListRequest) MarshalJSON() ([]byte, error)

func (QueryCouponCodeListRequest) String

type QueryCouponRequest

type QueryCouponRequest struct {
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 支持传入与当前调用接口商户号有绑定关系的AppID。支持小程序AppID与公众号AppID。 校验规则:传入的AppID得是与调用方商户号(即请求头里面的商户号)有绑定关系的AppID或传入的AppID得是归属商户号有绑定关系的AppID
	Appid *string `json:"appid"`
	// OpenID信息,用户在AppID下的唯一标识。 校验规则:传入的OpenID得是调用方商户号(即请求头里面的商户号)有绑定关系的AppID获取的OpenID或传入的OpenID得是归属商户号有绑定关系的AppID获取的OpenID。[获取OpenID文档](https://pay.weixin.qq.com/wiki/doc/apiv3/terms_definition/chapter1_1_3.shtml#part-3)
	Openid *string `json:"openid"`
}

QueryCouponRequest

func (QueryCouponRequest) Clone

func (QueryCouponRequest) MarshalJSON

func (o QueryCouponRequest) MarshalJSON() ([]byte, error)

func (QueryCouponRequest) String

func (o QueryCouponRequest) String() string

type QueryStockRequest

type QueryStockRequest struct {
	// 微信为每个商家券批次分配的唯一ID
	StockId *string `json:"stock_id"`
}

QueryStockRequest

func (QueryStockRequest) Clone

func (QueryStockRequest) MarshalJSON

func (o QueryStockRequest) MarshalJSON() ([]byte, error)

func (QueryStockRequest) String

func (o QueryStockRequest) String() string

type ReturnCouponRequest

type ReturnCouponRequest struct {
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 券的所属批次号
	StockId *string `json:"stock_id"`
	// 每次退券请求的唯一标识,商户需保证唯一
	ReturnRequestNo *string `json:"return_request_no"`
}

ReturnCouponRequest

func (ReturnCouponRequest) Clone

func (ReturnCouponRequest) MarshalJSON

func (o ReturnCouponRequest) MarshalJSON() ([]byte, error)

func (ReturnCouponRequest) String

func (o ReturnCouponRequest) String() string

type ReturnCouponResponse

type ReturnCouponResponse struct {
	// 微信退券成功的时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	WechatpayReturnTime *time.Time `json:"wechatpay_return_time"`
}

ReturnCouponResponse

func (ReturnCouponResponse) Clone

func (ReturnCouponResponse) MarshalJSON

func (o ReturnCouponResponse) MarshalJSON() ([]byte, error)

func (ReturnCouponResponse) String

func (o ReturnCouponResponse) String() string

type ReturnReceiptInfoRequest

type ReturnReceiptInfoRequest struct {
	// 补差回退唯一单号,由微信支付生成,仅在补差回退成功后有返回
	SubsidyReturnReceiptId *string `json:"subsidy_return_receipt_id"`
}

ReturnReceiptInfoRequest

func (ReturnReceiptInfoRequest) Clone

func (ReturnReceiptInfoRequest) MarshalJSON

func (o ReturnReceiptInfoRequest) MarshalJSON() ([]byte, error)

func (ReturnReceiptInfoRequest) String

func (o ReturnReceiptInfoRequest) String() string

type SendCount

type SendCount struct {
	// 批次已发放的券数量,满减、折扣、换购类型会返回该字段
	TotalSendNum *int64 `json:"total_send_num,omitempty"`
	// 批次已发放的预算金额,满减券类型会返回该字段
	TotalSendAmount *int64 `json:"total_send_amount,omitempty"`
	// 批次当天已发放的券数量,设置了单天发放上限的满减、折扣、换购类型返回该字段
	TodaySendNum *int64 `json:"today_send_num,omitempty"`
	// 批次当天已发放的预算金额,设置了当天发放上限的满减券类型返回该字段
	TodaySendAmount *int64 `json:"today_send_amount,omitempty"`
}

SendCount

func (SendCount) Clone

func (o SendCount) Clone() *SendCount

func (SendCount) MarshalJSON

func (o SendCount) MarshalJSON() ([]byte, error)

func (SendCount) String

func (o SendCount) String() string

type SendCouponRequest

type SendCouponRequest struct {
	// 用户的唯一标识,必填
	Openid *string `json:"openid"`
	// 发券方AppID
	Appid *string `json:"appid"`
	// 批次号
	StockId *string `json:"stock_id"`
	// 发券凭证,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号,需在单个批次单个用户下确保唯一性
	OutRequestNo *string `json:"out_request_no"`
	// 要求接口指定code发券的批次必传
	CouponCode *string `json:"coupon_code,omitempty"`
}

SendCouponRequest

func (SendCouponRequest) Clone

func (SendCouponRequest) MarshalJSON

func (o SendCouponRequest) MarshalJSON() ([]byte, error)

func (SendCouponRequest) String

func (o SendCouponRequest) String() string

type SendCouponResponse

type SendCouponResponse struct {
	// 发券结果
	SendCouponResult *SendCouponResult `json:"send_coupon_result,omitempty"`
}

SendCouponResponse

func (SendCouponResponse) Clone

func (SendCouponResponse) MarshalJSON

func (o SendCouponResponse) MarshalJSON() ([]byte, error)

func (SendCouponResponse) String

func (o SendCouponResponse) String() string

type SendCouponResult

type SendCouponResult struct {
	// 微信支付券批次ID
	StockId *string `json:"stock_id,omitempty"`
	// 发券凭证,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号,需在单个批次单个用户下确保唯一性
	OutRequestNo *string `json:"out_request_no,omitempty"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code,omitempty"`
}

SendCouponResult

func (SendCouponResult) Clone

func (SendCouponResult) MarshalJSON

func (o SendCouponResult) MarshalJSON() ([]byte, error)

func (SendCouponResult) String

func (o SendCouponResult) String() string

type SendGovCardRequest

type SendGovCardRequest struct {
	// 消费券通用卡卡包card_id
	CardId *string `json:"card_id"`
	// 消费卡cardi\\_d创建方的AppID,需与API调用方商户号有绑定关系,入参中的用户OpenID也需用此AppID生成
	Appid *string `json:"appid"`
	// 待发券用户的OpenID,需为消费卡创建方AppID生成的OpenID
	Openid *string `json:"openid"`
	// 商户此次发放凭据号。推荐使用大小写字母和数字,不同添加请求发放凭据号不同,商户侧需保证同一发券请求的out_request_no+send_time唯一性
	OutRequestNo *string `json:"out_request_no"`
	// 单次请求发卡时间,消费卡在商户系统的实际发放时间,为东八区标准时间(UTC+8)。商户需保证同一次请求的out_request_no+send_time唯一。由于系统限制,暂不支持传入早于当前时间24小时以上的时间进行发券请求。
	SendTime *string `json:"send_time"`
}

SendGovCardRequest

func (SendGovCardRequest) Clone

func (SendGovCardRequest) MarshalJSON

func (o SendGovCardRequest) MarshalJSON() ([]byte, error)

func (SendGovCardRequest) String

func (o SendGovCardRequest) String() string

type SetCouponNotifyRequest

type SetCouponNotifyRequest struct {
	// 商户号,不填默认查询调用方商户号
	Mchid *string `json:"mchid,omitempty"`
	// 商户提供的用于接收商家券事件通知的URL地址,必须支持HTTPS。
	NotifyUrl *string `json:"notify_url"`
}

SetCouponNotifyRequest

func (SetCouponNotifyRequest) Clone

func (SetCouponNotifyRequest) MarshalJSON

func (o SetCouponNotifyRequest) MarshalJSON() ([]byte, error)

func (SetCouponNotifyRequest) String

func (o SetCouponNotifyRequest) String() string

type SetCouponNotifyResponse

type SetCouponNotifyResponse struct {
	// 修改时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	UpdateTime *string `json:"update_time"`
	// 商户提供的用于接收商家券事件通知的URL地址,必须支持HTTPS。
	NotifyUrl *string `json:"notify_url"`
	// 商户号
	Mchid *string `json:"mchid"`
}

SetCouponNotifyResponse

func (SetCouponNotifyResponse) Clone

func (SetCouponNotifyResponse) MarshalJSON

func (o SetCouponNotifyResponse) MarshalJSON() ([]byte, error)

func (SetCouponNotifyResponse) String

func (o SetCouponNotifyResponse) String() string

type StockGetResponse

type StockGetResponse struct {
	// 批次名称,字数上限为21个,一个中文汉字/英文字母/数字均占用一个字数。
	StockName *string `json:"stock_name"`
	// 批次是归属于哪个商户 注: 普通直连模式,该参数为直连商户号; 服务商模式,该参数为子商户号; 间连模式,该参数为子商户号。
	BelongMerchant *string `json:"belong_merchant"`
	// 仅配置商户可见,用于自定义信息。字数上限为20个,一个中文汉字/英文字母/数字均占用一个字数。
	Comment *string `json:"comment,omitempty"`
	// 用来描述批次在哪些商品可用,会显示在微信卡包中。字数上限为15个,一个中文汉字/英文字母/数字均占用一个字数。
	GoodsName *string `json:"goods_name"`
	// 批次类型
	StockType *BusiFavorStockType `json:"stock_type"`
	// 核销规则
	CouponUseRule *CouponUseRule `json:"coupon_use_rule"`
	// 发放规则
	StockSendRule *StockSendRule `json:"stock_send_rule"`
	// 卡详情页面,可选择多种入口引导用户
	CustomEntrance *CustomEntrance `json:"custom_entrance,omitempty"`
	// 创建批次时的样式信息
	DisplayPatternInfo *DisplayPatternInfo `json:"display_pattern_info,omitempty"`
	// 批次状态
	StockState *StockStatus `json:"stock_state"`
	// 券code模式
	CouponCodeMode *CouponCodeMode `json:"coupon_code_mode"`
	// 批次唯一标识
	StockId *string `json:"stock_id"`
	// 当且仅当coupon_code_mode(券code模式)为MERCHANT_UPLOAD(商户上传自定义code)模式时,返回该字段;返回内容为商户上传code的数量信息
	CouponCodeCount *CouponCodeCount `json:"coupon_code_count,omitempty"`
	// 事件回调通知商户的配置
	NotifyConfig *NotifyConfig `json:"notify_config,omitempty"`
	// 批次发放情况
	SendCountInformation *SendCount `json:"send_count_information,omitempty"`
	// 该批次发放的券是否允许进行补差 注:该字段暂未开放
	Subsidy *bool `json:"subsidy,omitempty"`
}

StockGetResponse

func (StockGetResponse) Clone

func (StockGetResponse) MarshalJSON

func (o StockGetResponse) MarshalJSON() ([]byte, error)

func (StockGetResponse) String

func (o StockGetResponse) String() string

type StockSendRule

type StockSendRule struct {
	// 总预算金额,单位分 注:该字段暂未开放
	MaxAmount *int64 `json:"max_amount,omitempty"`
	// 批次最大可发放个数限制 特殊规则:取值范围 1 ≤ value ≤ 1000000000
	MaxCoupons *int64 `json:"max_coupons,omitempty"`
	// 用户可领个数,每个用户最多100张券。
	MaxCouponsPerUser *int64 `json:"max_coupons_per_user"`
	// 单天发放上限金额 注:该字段暂未开放
	MaxAmountByDay *int64 `json:"max_amount_by_day,omitempty"`
	// 单天发放上限个数(stock\\_type为DISCOUNT或EXCHANGE时可传入此字段控制单天发放上限)。 特殊规则:取值范围 1 ≤ value ≤ 1000000000
	MaxCouponsByDay *int64 `json:"max_coupons_by_day,omitempty"`
	// 不填默认否,枚举值: true:是 false:否 注:自然人防刷即同证件号下的所有账户合并计算的限领次数(限领次数指的是参数字段“用户最大领取个数”填写的值)
	NaturalPersonLimit *bool `json:"natural_person_limit,omitempty"`
	// true-是;false-否,不填默认否
	PreventApiAbuse *bool `json:"prevent_api_abuse,omitempty"`
	// 不填默认否,枚举值: true:是 false:否 该字段暂未开放
	Transferable *bool `json:"transferable,omitempty"`
	// 不填默认否,枚举值: true:是 false:否 该字段暂未开放
	Shareable *bool `json:"shareable,omitempty"`
}

StockSendRule

func (StockSendRule) Clone

func (o StockSendRule) Clone() *StockSendRule

func (StockSendRule) MarshalJSON

func (o StockSendRule) MarshalJSON() ([]byte, error)

func (StockSendRule) String

func (o StockSendRule) String() string

type StockStatus

type StockStatus string

StockStatus

const (
	STOCKSTATUS_UNAUDIT StockStatus = "UNAUDIT"
	STOCKSTATUS_RUNNING StockStatus = "RUNNING"
	STOCKSTATUS_STOPED  StockStatus = "STOPED"
	STOCKSTATUS_PAUSED  StockStatus = "PAUSED"
)

Enums of StockStatus

func (StockStatus) Ptr

func (e StockStatus) Ptr() *StockStatus

type SubsidyApiService

type SubsidyApiService services.Service

func (*SubsidyApiService) PayReceiptInfo

func (a *SubsidyApiService) PayReceiptInfo(ctx context.Context, req PayReceiptInfoRequest) (resp *SubsidyPayReceipt, result *core.APIResult, err error)

PayReceiptInfo 查询商家券营销补差付款单详情

查询商家券营销补差付款单详情

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.SubsidyApiService{Client: client}
	resp, result, err := svc.PayReceiptInfo(ctx,
		merchantexclusivecoupon.PayReceiptInfoRequest{
			SubsidyReceiptId: core.String("1120200119165100000000000001"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call PayReceiptInfo err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*SubsidyApiService) PayReceiptList

func (a *SubsidyApiService) PayReceiptList(ctx context.Context, req PayReceiptListRequest) (resp *SubsidyPayReceiptListResponse, result *core.APIResult, err error)

PayReceiptList 查询商家券营销补差付款单列表

查询商家券营销补差付款单列表

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.SubsidyApiService{Client: client}
	resp, result, err := svc.PayReceiptList(ctx,
		merchantexclusivecoupon.PayReceiptListRequest{
			StockId:      core.String("128888000000001"),
			CouponCode:   core.String("ABCD12345678"),
			OutSubsidyNo: core.String("subsidy-abcd-12345678"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call PayReceiptList err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*SubsidyApiService) ReturnReceiptInfo

func (a *SubsidyApiService) ReturnReceiptInfo(ctx context.Context, req ReturnReceiptInfoRequest) (resp *SubsidyReturnReceipt, result *core.APIResult, err error)

ReturnReceiptInfo 查询商家券营销补差回退单详情

查询商家券营销补差回退单详情

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.SubsidyApiService{Client: client}
	resp, result, err := svc.ReturnReceiptInfo(ctx,
		merchantexclusivecoupon.ReturnReceiptInfoRequest{
			SubsidyReturnReceiptId: core.String("2120200119165100000000000001"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ReturnReceiptInfo err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*SubsidyApiService) SubsidyPay

func (a *SubsidyApiService) SubsidyPay(ctx context.Context, req SubsidyPayRequest) (resp *SubsidyPayReceipt, result *core.APIResult, err error)

SubsidyPay 商家券营销补差付款

适用接口场景:服务商/商圈给核销了商家券的商户做营销资金补差; 接口适用对象:普通服务商、普通直连商户、渠道商; 前置条件:商家必须核销了商家券且发起了微信支付收款; 是否支持幂等:是;

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.SubsidyApiService{Client: client}
	resp, result, err := svc.SubsidyPay(ctx,
		merchantexclusivecoupon.SubsidyPayRequest{
			StockId:       core.String("128888000000001"),
			CouponCode:    core.String("ABCD12345678"),
			TransactionId: core.String("4200000913202101152566792388"),
			PayerMerchant: core.String("1900000001"),
			PayeeMerchant: core.String("1900000002"),
			Amount:        core.Int64(100),
			Description:   core.String("20210115DESCRIPTION"),
			OutSubsidyNo:  core.String("subsidy-abcd-12345678"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call SubsidyPay err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*SubsidyApiService) SubsidyReturn

func (a *SubsidyApiService) SubsidyReturn(ctx context.Context, req SubsidyReturnRequest) (resp *SubsidyReturnReceipt, result *core.APIResult, err error)

SubsidyReturn 商家券营销补差回退

适用接口场景:服务商通过该接口可回退补差款; 接口适用对象:普通服务商、普通直连商户、渠道商; 前置条件:进行补差的微信支付订单发起了退款,且回退金额不得超过补差金额; 是否支持幂等:是;

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/merchantexclusivecoupon"
	"github.com/rjm521/wechatpay-go/utils"
)

func main() {
	var (
		mchID                      string = "190000****"                               // 商户号
		mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号
		mchAPIv3Key                string = "2ab9****************************"         // 商户APIv3密钥
	)

	// 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名
	mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem")
	if err != nil {
		log.Printf("load merchant private key error:%s", err)
		return
	}

	ctx := context.Background()
	// 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力
	opts := []core.ClientOption{
		option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key),
	}
	client, err := core.NewClient(ctx, opts...)
	if err != nil {
		log.Printf("new wechat pay client err:%s", err)
		return
	}

	svc := merchantexclusivecoupon.SubsidyApiService{Client: client}
	resp, result, err := svc.SubsidyReturn(ctx,
		merchantexclusivecoupon.SubsidyReturnRequest{
			StockId:            core.String("128888000000001"),
			CouponCode:         core.String("ABCD12345678"),
			TransactionId:      core.String("4200000913202101152566792388"),
			RefundId:           core.String("50100506732021010105138718375"),
			PayerMerchant:      core.String("1900000001"),
			PayeeMerchant:      core.String("1900000002"),
			Amount:             core.Int64(100),
			Description:        core.String("20210115DESCRIPTION"),
			OutSubsidyReturnNo: core.String("subsidy-abcd-12345678"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call SubsidyReturn err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

type SubsidyPayReceipt

type SubsidyPayReceipt struct {
	// 补差付款唯一单号,由微信支付生成,仅在补差付款成功后有返回
	SubsidyReceiptId *string `json:"subsidy_receipt_id"`
	// 由微信支付生成,调用创建商家券API成功时返回的唯一批次ID
	StockId *string `json:"stock_id"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 微信支付下单支付成功返回的订单号
	TransactionId *string `json:"transaction_id"`
	// 营销补差扣款商户号
	PayerMerchant *string `json:"payer_merchant"`
	// 营销补差入账商户号
	PayeeMerchant *string `json:"payee_merchant"`
	// 单位为分,单笔订单补差金额不得超过券的优惠金额,最高补差金额为5000元 > 券的优惠金额定义:   满减券:满减金额即为优惠金额   折扣券:优惠金额 = 微信支付订单金额 ÷ 折扣比例 × (1 - 折扣比例)    换购券:不支持
	Amount *int64 `json:"amount"`
	// 付款备注描述,查询的时候原样带回
	Description *string `json:"description"`
	// 补差付款单据状态
	Status *SubsidyPayReceiptStatus `json:"status"`
	// 仅在补差付款失败时,返回告知对应失败的原因
	FailReason *SubsidyPayReceiptFailReason `json:"fail_reason,omitempty"`
	// 仅在补差付款成功时,返回完成时间。遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	SuccessTime *time.Time `json:"success_time,omitempty"`
	// 商户侧需保证唯一性。可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号
	OutSubsidyNo *string `json:"out_subsidy_no"`
	// 补差付款单据创建时间。遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	CreateTime *time.Time `json:"create_time,omitempty"`
}

SubsidyPayReceipt

func (SubsidyPayReceipt) Clone

func (SubsidyPayReceipt) MarshalJSON

func (o SubsidyPayReceipt) MarshalJSON() ([]byte, error)

func (SubsidyPayReceipt) String

func (o SubsidyPayReceipt) String() string

type SubsidyPayReceiptFailReason

type SubsidyPayReceiptFailReason string

SubsidyPayReceiptFailReason

const (
	SUBSIDYPAYRECEIPTFAILREASON_PAY_RECEIPT_INSUFFICIENT_BALANCE        SubsidyPayReceiptFailReason = "PAY_RECEIPT_INSUFFICIENT_BALANCE"
	SUBSIDYPAYRECEIPTFAILREASON_PAY_RECEIPT_NOT_INCOMESPLIT_ORDER       SubsidyPayReceiptFailReason = "PAY_RECEIPT_NOT_INCOMESPLIT_ORDER"
	SUBSIDYPAYRECEIPTFAILREASON_PAY_RECEIPT_EXCEED_SUBSIDY_AMOUNT_QUOTA SubsidyPayReceiptFailReason = "PAY_RECEIPT_EXCEED_SUBSIDY_AMOUNT_QUOTA"
	SUBSIDYPAYRECEIPTFAILREASON_PAY_RECEIPT_EXCEED_SUBSIDY_COUNT_QUOTA  SubsidyPayReceiptFailReason = "PAY_RECEIPT_EXCEED_SUBSIDY_COUNT_QUOTA"
	SUBSIDYPAYRECEIPTFAILREASON_PAY_RECEIPT_OTHER                       SubsidyPayReceiptFailReason = "PAY_RECEIPT_OTHER"
)

Enums of SubsidyPayReceiptFailReason

func (SubsidyPayReceiptFailReason) Ptr

type SubsidyPayReceiptListResponse

type SubsidyPayReceiptListResponse struct {
	// 如果这张券发生过补差付款,会有补差单据信息返回
	PayReceiptList []SubsidyPayReceipt `json:"pay_receipt_list,omitempty"`
}

SubsidyPayReceiptListResponse

func (SubsidyPayReceiptListResponse) Clone

func (SubsidyPayReceiptListResponse) MarshalJSON

func (o SubsidyPayReceiptListResponse) MarshalJSON() ([]byte, error)

func (SubsidyPayReceiptListResponse) String

type SubsidyPayReceiptStatus

type SubsidyPayReceiptStatus string

SubsidyPayReceiptStatus

const (
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_UNKNOWN        SubsidyPayReceiptStatus = "PAY_RECEIPT_UNKNOWN"
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_ACCEPTED       SubsidyPayReceiptStatus = "PAY_RECEIPT_ACCEPTED"
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_SUCCESS        SubsidyPayReceiptStatus = "PAY_RECEIPT_SUCCESS"
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_FAIL           SubsidyPayReceiptStatus = "PAY_RECEIPT_FAIL"
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_RETURNING      SubsidyPayReceiptStatus = "PAY_RECEIPT_RETURNING"
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_PARTIAL_RETURN SubsidyPayReceiptStatus = "PAY_RECEIPT_PARTIAL_RETURN"
	SUBSIDYPAYRECEIPTSTATUS_PAY_RECEIPT_FULL_RETURN    SubsidyPayReceiptStatus = "PAY_RECEIPT_FULL_RETURN"
)

Enums of SubsidyPayReceiptStatus

func (SubsidyPayReceiptStatus) Ptr

type SubsidyPayRequest

type SubsidyPayRequest struct {
	// 由微信支付生成,调用创建商家券API成功时返回的唯一批次ID 仅支持“满减券”和“折扣券”的批次,“换购券”批次不支持
	StockId *string `json:"stock_id"`
	// 券的唯一标识。 在WECHATPAY\\_MODE的券code模式下,商家券code是由微信支付生成的唯一ID; 在MERCHANT\\_UPLOAD、MERCHANT\\_API的券code模式下,商家券code是由商户上传或指定,在批次下保证唯一;
	CouponCode *string `json:"coupon_code"`
	// 微信支付下单支付成功返回的订单号
	TransactionId *string `json:"transaction_id"`
	// 营销补差扣款商户号 注:补差扣款商户号 = 制券商户号 或 补差扣款商户号 = 归属商户号
	PayerMerchant *string `json:"payer_merchant"`
	// 营销补差入账商户号 注:补差入账商户号 = 券归属商户号 或者和 券归属商户号有连锁品牌关系
	PayeeMerchant *string `json:"payee_merchant"`
	// 单位为分,单笔订单补差金额不得超过券的优惠金额,最高补差金额为5000元 > 券的优惠金额定义:   满减券:满减金额即为优惠金额   折扣券:优惠金额 = 微信支付订单金额 ÷ 折扣比例 × (1 - 折扣比例)   换购券:不支持
	Amount *int64 `json:"amount"`
	// 付款备注描述,查询的时候原样带回
	Description *string `json:"description"`
	// 商户侧需保证唯一性,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号
	OutSubsidyNo *string `json:"out_subsidy_no"`
}

SubsidyPayRequest

func (SubsidyPayRequest) Clone

func (SubsidyPayRequest) MarshalJSON

func (o SubsidyPayRequest) MarshalJSON() ([]byte, error)

func (SubsidyPayRequest) String

func (o SubsidyPayRequest) String() string

type SubsidyReturnReceipt

type SubsidyReturnReceipt struct {
	// 补差回退唯一单号,由微信支付生成,仅在补差回退成功后有返回
	SubsidyReturnReceiptId *string `json:"subsidy_return_receipt_id,omitempty"`
	// 由微信支付生成,调用创建商家券API成功时返回的唯一批次ID
	StockId *string `json:"stock_id"`
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 微信支付下单支付成功返回的订单号
	TransactionId *string `json:"transaction_id"`
	// 微信支付退款单号
	RefundId *string `json:"refund_id"`
	// 原营销补差扣款商户号,即回退资金收款商户号
	PayerMerchant *string `json:"payer_merchant"`
	// 原营销补差入账商户号,即回退资金扣款商户号
	PayeeMerchant *string `json:"payee_merchant"`
	// 本次补差回退金额,单位为分。单个券code回退总金额不能超过补差金额
	Amount *int64 `json:"amount"`
	// 回退备注描述,查询的时候原样带回
	Description *string `json:"description"`
	// 补差付款单据状态
	Status *SubsidyReturnReceiptStatus `json:"status"`
	// 仅在补差回退失败时,返回告知对应失败的原因
	FailReason *SubsidyReturnReceiptFailReason `json:"fail_reason,omitempty"`
	// 仅在补差回退成功时,返回完成时间
	ReturnDoneTime *time.Time `json:"return_done_time,omitempty"`
	// 此次补差回退操作对应的补差付款单号
	SubsidyReceiptId *string `json:"subsidy_receipt_id"`
	// 商户侧需保证唯一性。可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号
	OutSubsidyReturnNo *string `json:"out_subsidy_return_no"`
	// 补差回退单据创建时间
	ReturnCreateTime *time.Time `json:"return_create_time,omitempty"`
}

SubsidyReturnReceipt

func (SubsidyReturnReceipt) Clone

func (SubsidyReturnReceipt) MarshalJSON

func (o SubsidyReturnReceipt) MarshalJSON() ([]byte, error)

func (SubsidyReturnReceipt) String

func (o SubsidyReturnReceipt) String() string

type SubsidyReturnReceiptFailReason

type SubsidyReturnReceiptFailReason string

SubsidyReturnReceiptFailReason

const (
	SUBSIDYRETURNRECEIPTFAILREASON_RETURN_RECEIPT_INSUFFICIENT_BALANCE SubsidyReturnReceiptFailReason = "RETURN_RECEIPT_INSUFFICIENT_BALANCE"
	SUBSIDYRETURNRECEIPTFAILREASON_RETURN_RECEIPT_OTHER                SubsidyReturnReceiptFailReason = "RETURN_RECEIPT_OTHER"
)

Enums of SubsidyReturnReceiptFailReason

func (SubsidyReturnReceiptFailReason) Ptr

type SubsidyReturnReceiptStatus

type SubsidyReturnReceiptStatus string

SubsidyReturnReceiptStatus

const (
	SUBSIDYRETURNRECEIPTSTATUS_RETURN_RECEIPT_UNKNOWN  SubsidyReturnReceiptStatus = "RETURN_RECEIPT_UNKNOWN"
	SUBSIDYRETURNRECEIPTSTATUS_RETURN_RECEIPT_ACCEPTED SubsidyReturnReceiptStatus = "RETURN_RECEIPT_ACCEPTED"
	SUBSIDYRETURNRECEIPTSTATUS_RETURN_RECEIPT_SUCCESS  SubsidyReturnReceiptStatus = "RETURN_RECEIPT_SUCCESS"
	SUBSIDYRETURNRECEIPTSTATUS_RETURN_RECEIPT_FAIL     SubsidyReturnReceiptStatus = "RETURN_RECEIPT_FAIL"
)

Enums of SubsidyReturnReceiptStatus

func (SubsidyReturnReceiptStatus) Ptr

type SubsidyReturnRequest

type SubsidyReturnRequest struct {
	// 由微信支付生成,调用创建商家券API成功时返回的唯一批次ID 仅支持“满减券”和“折扣券”的批次,“换购券”批次不支持
	StockId *string `json:"stock_id"`
	// 券的唯一标识。 在WECHATPAY\\_MODE的券code模式下,商家券code是由微信支付生成的唯一ID; 在MERCHANT\\_UPLOAD、MERCHANT\\_API的券code模式下,商家券code是由商户上传或指定,在批次下保证唯一;
	CouponCode *string `json:"coupon_code"`
	// 微信支付下单支付成功返回的订单号
	TransactionId *string `json:"transaction_id"`
	// 微信支付退款单号
	RefundId *string `json:"refund_id"`
	// 原营销补差扣款商户号,即回退资金收款商户号
	PayerMerchant *string `json:"payer_merchant"`
	// 原营销补差入账商户号,即回退资金扣款商户号
	PayeeMerchant *string `json:"payee_merchant"`
	// 本次补差回退金额,单位为分。单个券Code回退总金额不能超过补差金额
	Amount *int64 `json:"amount"`
	// 回退备注描述,查询的时候原样带回
	Description *string `json:"description"`
	// 商户侧需保证唯一性,可包含英文字母,数字,|,_,*,-等内容,不允许出现其他不合法符号
	OutSubsidyReturnNo *string `json:"out_subsidy_return_no"`
}

SubsidyReturnRequest

func (SubsidyReturnRequest) Clone

func (SubsidyReturnRequest) MarshalJSON

func (o SubsidyReturnRequest) MarshalJSON() ([]byte, error)

func (SubsidyReturnRequest) String

func (o SubsidyReturnRequest) String() string

type UploadCouponCodeBody

type UploadCouponCodeBody struct {
	// 商户上传的券code列表;code允许包含的字符有 0-9 a-z A-Z 空格(仅含空格,不含制表符、换行符、换页符等) 中划线- 下划线_  反斜线\\ 斜线/ 等号= 竖线|
	CouponCodeList []string `json:"coupon_code_list"`
	// 商户上传code的凭据号,商户侧需保持唯一性
	UploadRequestNo *string `json:"upload_request_no"`
}

UploadCouponCodeBody

func (UploadCouponCodeBody) Clone

func (UploadCouponCodeBody) MarshalJSON

func (o UploadCouponCodeBody) MarshalJSON() ([]byte, error)

func (UploadCouponCodeBody) String

func (o UploadCouponCodeBody) String() string

type UploadCouponCodeFailReason

type UploadCouponCodeFailReason struct {
	// 商户通过API上传的券code
	CouponCode *string `json:"coupon_code"`
	// 对应券code上传失败的错误码
	Code *string `json:"code"`
	// 上传失败的错误信息描述
	Message *string `json:"message"`
}

UploadCouponCodeFailReason

func (UploadCouponCodeFailReason) Clone

func (UploadCouponCodeFailReason) MarshalJSON

func (o UploadCouponCodeFailReason) MarshalJSON() ([]byte, error)

func (UploadCouponCodeFailReason) String

type UploadCouponCodeRequest

type UploadCouponCodeRequest struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 商户上传的券code列表;code允许包含的字符有 0-9 a-z A-Z 空格(仅含空格,不含制表符、换行符、换页符等) 中划线- 下划线_  反斜线\\ 斜线/ 等号= 竖线|
	CouponCodeList []string `json:"coupon_code_list"`
	// 商户上传code的凭据号,商户侧需保持唯一性
	UploadRequestNo *string `json:"upload_request_no"`
}

UploadCouponCodeRequest

func (UploadCouponCodeRequest) Clone

func (UploadCouponCodeRequest) MarshalJSON

func (o UploadCouponCodeRequest) MarshalJSON() ([]byte, error)

func (UploadCouponCodeRequest) String

func (o UploadCouponCodeRequest) String() string

type UploadCouponCodeResponse

type UploadCouponCodeResponse struct {
	// 商家券批次号
	StockId *string `json:"stock_id"`
	// 本次上传操作,去重后实际上传的code数目
	TotalCount *int64 `json:"total_count"`
	// 本次上传操作上传成功个数
	SuccessCount *int64 `json:"success_count"`
	// 本次新增上传成功的code信息。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。
	SuccessCodes []string `json:"success_codes,omitempty"`
	// 上传操作完成时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	SuccessTime *string `json:"success_time"`
	// 本次上传操作上传失败的code数
	FailCount *int64 `json:"fail_count,omitempty"`
	// 本次导入失败的code信息,请参照错误信息,修改后重试
	FailCodes []UploadCouponCodeFailReason `json:"fail_codes,omitempty"`
	// 历史已存在的code列表,本次不会重复导入。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。
	ExistCodes []string `json:"exist_codes,omitempty"`
	// 本次重复导入的code会被自动过滤,仅保留一个做导入,如满足要求则成功;如不满足要求,则失败;请参照报错提示修改重试。 特殊规则:单个券code长度为【1,32】,条目个数限制为【1,200】。
	DuplicateCodes []string `json:"duplicate_codes,omitempty"`
}

UploadCouponCodeResponse

func (UploadCouponCodeResponse) Clone

func (UploadCouponCodeResponse) MarshalJSON

func (o UploadCouponCodeResponse) MarshalJSON() ([]byte, error)

func (UploadCouponCodeResponse) String

func (o UploadCouponCodeResponse) String() string

type UseCouponRequest

type UseCouponRequest struct {
	// 券的唯一标识
	CouponCode *string `json:"coupon_code"`
	// 微信为每个商家券批次分配的唯一ID,当你在创建商家券接口中的coupon\\_code\\_mode参数传值为MERCHANT\\_API或者MERCHANT\\_UPLOAD时,则核销接口中该字段必传,否则该字段可不传
	StockId *string `json:"stock_id,omitempty"`
	// 支持传入与当前调用接口商户号有绑定关系的AppID。支持小程序AppID与公众号AppID。核销接口返回的OpenID会在该传入AppID下进行计算获得。 校验规则:传入的AppID得是与调用方商户号(即请求头里面的商户号)有绑定关系的AppID或传入的AppID得是归属商户号有绑定关系的AppID
	Appid *string `json:"appid"`
	// 商户请求核销用户券的时间。 遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	UseTime *string `json:"use_time"`
	// 每次核销请求的唯一标识,商户需保证唯一
	UseRequestNo *string `json:"use_request_no"`
	// 用户的唯一标识,做安全校验使用,非必填。 校验规则:传入的OpenID得是调用方商户号(即请求头里面的商户号)有绑定关系的AppID获取的OpenID或传入的OpenID得是归属商户号有绑定关系的AppID获取的OpenID。[获取OpenID文档](https://pay.weixin.qq.com/wiki/doc/apiv3/terms_definition/chapter1_1_3.shtml#part-3)
	Openid *string `json:"openid,omitempty"`
}

UseCouponRequest

func (UseCouponRequest) Clone

func (UseCouponRequest) MarshalJSON

func (o UseCouponRequest) MarshalJSON() ([]byte, error)

func (UseCouponRequest) String

func (o UseCouponRequest) String() string

type UseCouponResponse

type UseCouponResponse struct {
	// 批次ID
	StockId *string `json:"stock_id"`
	// 用户在该公众号内的唯一身份标识。
	Openid *string `json:"openid"`
	// 系统成功核销券的时间,遵循[rfc3339](https://datatracker.ietf.org/doc/html/rfc3339)标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。
	WechatpayUseTime *string `json:"wechatpay_use_time"`
}

UseCouponResponse

func (UseCouponResponse) Clone

func (UseCouponResponse) MarshalJSON

func (o UseCouponResponse) MarshalJSON() ([]byte, error)

func (UseCouponResponse) String

func (o UseCouponResponse) String() string

Jump to

Keyboard shortcuts

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