类 WechatMarketingFavorApi


  • public class WechatMarketingFavorApi
    extends AbstractApi
    微信支付营销代金券API
    作者:
    youta
    • 构造器详细资料

      • WechatMarketingFavorApi

        public WechatMarketingFavorApi​(WechatPayClient wechatPayClient,
                                       String tenantId)
        Instantiates a new Wechat marketing favor api.
        参数:
        wechatPayClient - the wechat pay client
        tenantId - the tenant id
    • 方法详细资料

      • createStock

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> createStock​(StocksCreateParams params)
        创建代金券批次API

        通过调用此接口可创建代金券批次,包括 预充值免充值 类型。

        参数:
        params - the params
        返回:
        the wechat response entity
      • createStocksFunction

        private org.springframework.http.RequestEntity<?> createStocksFunction​(WechatPayV3Type type,
                                                                               StocksCreateParams params)
        Create stocks function request entity.
        参数:
        type - the type
        params - the params
        返回:
        the request entity
      • startStock

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> startStock​(String stockId)
        激活代金券批次API

        制券成功后,通过调用此接口激活批次,如果是预充值代金券,激活时会从商户账户余额中锁定本批次的营销资金。

        参数:
        stockId - the stock id
        返回:
        the wechat response entity
      • sendStock

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> sendStock​(StocksSendParams params)
        发放代金券API

        商户侧开发时建议增加发放流水记录。

        微信支付文档所要求的微信公众号服务号不是必须的,只要你有一个绑定了微信支付商户平台和开放平台的appid即可。

        流程为: 1. appid 请求授权微信登录。 2. 登录成功后,开发者在商户侧保存用户 对应此appid的openid。 3. 通过 appid - openid 进行发券。

        商户平台/API完成制券后,可使用发放代金券接口发券。通过调用此接口可发放指定批次给指定用户,发券场景可以是小程序、H5、APP等。

        注意: • 商户可在H5活动页面、商户小程序、商户APP等自有场景内调用该接口完成发券,商户默认只允许发放本商户号(调用发券接口的商户号)创建的代金券,如需发放其他商户商户创建的代金券,请参考常见问题Q1。

        参数:
        params - the params
        返回:
        the wechat response entity
      • sendStocksFunction

        private org.springframework.http.RequestEntity<?> sendStocksFunction​(WechatPayV3Type type,
                                                                             StocksSendParams params)
        Send stocks function request entity.
        参数:
        type - the type
        params - the params
        返回:
        the request entity
      • pauseStock

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> pauseStock​(String stockId)
        暂停代金券批次API

        通过此接口可暂停指定代金券批次。暂停后,该代金券批次暂停发放,用户无法通过任何渠道再领取该批次的券。

        参数:
        stockId - the stock id
        返回:
        the wechat response entity
      • restartStock

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> restartStock​(String stockId)
        重启代金券批次API

        通过此接口可重启指定代金券批次。重启后,该代金券批次可以再次发放。

        参数:
        stockId - the stock id
        返回:
        the wechat response entity
      • startAndRestartAndPauseStockFunction

        private org.springframework.http.RequestEntity<?> startAndRestartAndPauseStockFunction​(WechatPayV3Type type,
                                                                                               String stockId)
        Start and restart and pause stock function request entity.
        参数:
        type - the type
        stockId - the stock id
        返回:
        the request entity
      • queryStocksByMch

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> queryStocksByMch​(StocksQueryParams params)
        条件查询批次列表API

        通过此接口可查询多个批次的信息,包括批次的配置信息以及批次概况数据。

        参数:
        params - the params
        返回:
        the wechat response entity
      • queryStocksByMchFunction

        private org.springframework.http.RequestEntity<?> queryStocksByMchFunction​(WechatPayV3Type type,
                                                                                   StocksQueryParams params)
        Query stocks function request entity.
        参数:
        type - the type
        params - the params
        返回:
        the request entity
      • queryStockDetail

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> queryStockDetail​(String stockId)
        查询批次详情API

        通过此接口可查询批次信息,包括批次的配置信息以及批次概况数据。

        参数:
        stockId - the stock id
        返回:
        the wechat response entity
      • stockDetailFunction

        private org.springframework.http.RequestEntity<?> stockDetailFunction​(WechatPayV3Type type,
                                                                              String stockId)
        Stock detail function request entity.
        参数:
        type - the type
        stockId - the stock id
        返回:
        the request entity
      • queryCouponDetails

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> queryCouponDetails​(CouponDetailsQueryParams params)
        查询代金券详情API

        通过此接口可查询代金券信息,包括代金券的基础信息、状态。如代金券已核销,会包括代金券核销的订单信息(订单号、单品信息等)。

        2021-1 微信侧不再返回consume_information字段

        参数:
        params - the params
        返回:
        the wechat response entity
      • couponDetailFunction

        private org.springframework.http.RequestEntity<?> couponDetailFunction​(WechatPayV3Type type,
                                                                               CouponDetailsQueryParams params)
        Coupon detail function request entity.
        参数:
        type - the type
        params - the params
        返回:
        the request entity
      • queryMerchantsByStockId

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> queryMerchantsByStockId​(MchQueryParams params)
        查询代金券可用商户API

        通过调用此接口可查询批次的可用商户号,判断券是否在某商户号可用,来决定是否展示。

        参数:
        params - the params
        返回:
        the wechat response entity
      • queryMerchantsByStockIdFunction

        private org.springframework.http.RequestEntity<?> queryMerchantsByStockIdFunction​(WechatPayV3Type type,
                                                                                          MchQueryParams params)
        Query stocks function request entity.
        参数:
        type - the type
        params - the params
        返回:
        the request entity
      • queryStockItems

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> queryStockItems​(MchQueryParams params)
        查询代金券可用单品API

        通过此接口可查询批次的可用商品编码,判断券是否可用于某些商品,来决定是否展示。

        参数:
        params - the params
        返回:
        the wechat response entity
      • queryUserCouponsByMchId

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> queryUserCouponsByMchId​(UserCouponsQueryParams params)
        根据商户号查用户的券API

        可通过该接口查询用户在某商户号可用的全部券,可用于商户的小程序/H5中,用户"我的代金券"或"提交订单页"展示优惠信息。无法查询到微信支付立减金。本接口查不到用户的微信支付立减金(又称“全平台通用券”),即在所有商户都可以使用的券,例如:摇摇乐红包;当按可用商户号查询时,无法查询用户已经核销的券

        参数:
        params - the params
        返回:
        the wechat response entity
      • queryUserCouponsFunction

        private org.springframework.http.RequestEntity<?> queryUserCouponsFunction​(WechatPayV3Type type,
                                                                                   UserCouponsQueryParams params)
        Query user coupons function request entity.
        参数:
        type - the type
        params - the params
        返回:
        the request entity
      • downloadStockUseFlow

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> downloadStockUseFlow​(String stockId)
        下载批次核销明细API

        数据结果包含在响应体的 csv 字段中

        可获取到某批次的核销明细数据,包括订单号、单品信息、银行流水号等,用于对账/数据分析。

        参数:
        stockId - the stock id
        返回:
        the wechat response entity
        另请参阅:
        AbstractApi#billDownload(String)对账单下载api
      • downloadStockRefundFlow

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> downloadStockRefundFlow​(String stockId)
        下载批次退款明细API

        数据结果包含在响应体的 csv 字段中

        可获取到某批次的退款明细数据,包括订单号、单品信息、银行流水号等,用于对账/数据分析。

        参数:
        stockId - the stock id
        返回:
        the wechat response entity
        另请参阅:
        AbstractApi#billDownload(String)对账单下载api
      • downloadFlowFunction

        private org.springframework.http.RequestEntity<?> downloadFlowFunction​(WechatPayV3Type type,
                                                                               String stockId)
        Download flow function request entity.
        参数:
        type - the type
        stockId - the stock id
        返回:
        the request entity
      • marketingImageUpload

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> marketingImageUpload​(org.springframework.web.multipart.MultipartFile file)
        营销图片上传API

        媒体图片只支持JPG、BMP、PNG格式,文件大小不能超过2M。

        通过本接口上传图片后可获得图片url地址。图片url可在微信支付营销相关的API使用,包括商家券、代金券、支付有礼等。

        参数:
        file - the file
        返回:
        the wechat response entity
      • marketingImageUploadFunction

        private org.springframework.http.RequestEntity<?> marketingImageUploadFunction​(WechatPayV3Type type,
                                                                                       org.springframework.web.multipart.MultipartFile file)
        Marketing image upload function request entity.
        参数:
        type - the type
        file - the file
        返回:
        the request entity
      • setMarketingFavorCallback

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> setMarketingFavorCallback​(String notifyUrl)
        代金券核销回调通知API。

        设置核销回调通知的notifyUrl,notifyUrl需要设置应用白名单。开发者应该对代金券的核销结果进行流水记录。

        参数:
        notifyUrl - the notify url
        返回:
        the wechat response entity
      • setMarketingFavorCallbackFunction

        private org.springframework.http.RequestEntity<?> setMarketingFavorCallbackFunction​(WechatPayV3Type type,
                                                                                            String notifyUrl)
        Sets marketing favor callback function.
        参数:
        type - the type
        notifyUrl - the notify url
        返回:
        the marketing favor callback function
      • sendCouponsCard

        public WechatResponseEntity<com.fasterxml.jackson.databind.node.ObjectNode> sendCouponsCard​(CouponsCardSendParams params)
        发放消费卡API

        商户通过调用本接口向用户发放消费卡,用户领到卡的同时会领取到一批代金券,消费卡会自动放入卡包中。

        注意:

        • 调用该接口前,需要在微信支付商户平台创建“消费卡”,获得card_id。
        • 此功能仅向指定邀约商户开放,如有需要请联系微信支付运营经理。
        参数:
        params - the params
        返回:
        wechat response entity