开发指南 官网
API 3.0 > 7.4 优惠券相关操作 > 7.4.5 根据商品和优惠券计算优惠金额

7.4.5 根据商品和优惠券计算优惠金额

开启令牌和权限后可调用。签名方式请查看开发指南
场景描述:根据商品和优惠券计算优惠金额

请求地址

请求方式 版本信息 请求地址
POST V3 http://openapi.zvcms.com/v3/cy/customer/computeCoupon

公共参数

参数 参数类型 是否必填 默认值 描述
openId string 密钥Id
grantCode string 授权code
token string 签名,参考《数字签名sign》
timestamp string 当前时间戳
nonce string 随机正整数
params array 业务参数

请求参数

参数 参数类型 是否必填 默认值 描述
user_coupon_id bigint 兼容 用戶优惠券ID 【对应会员详情中的cardId】 ,和核销码
user_id bigint 用户id,当user_coupon_id 是扫码核销码时user_id 非必传,其他情况下user_id必传
items array
 ├0 array
  ├num int 商品数量
  ├trade_mark string 商品实体标识
  ├price money(元) 商品实体金额
multi_mark string 门店编码
coupon_id bigint 优惠券模板id
type_cate int 就餐方式,1堂食,3外卖
discount_price money(元) 订单折扣金额
type int type=1时user_coupon_id 填核销码
coupon_code string 券码(用户优惠券user_coupon_id和券码coupon_code必须存在一个)
usage_scenarios int 0 接口使用场景 : 0线上(默认)/1线下

响应参数

参数 参数类型 描述
type_cate int 就餐方式,1堂食,2自取,3外卖
multi_mark string 门店编码
coupon_discount string 优惠券优惠掉的金额
user_coupon_name string 优惠券名称 当type=1时user_coupon_id 填核销码 此参数才会返回
user_coupon_id string 用户优惠券id 对应会员三合一接口中的cardId 当type=1时user_coupon_id 填核销码 此参数才会返回
finance_payment string 财务支付金额 当type=1时user_coupon_id 填核销码 此参数才会返回
userInfo array
 ├avatar string 会员头像
 ├birthday string 会员生日
 ├gender string 性别0-未知、1-男性、2-女性
 ├nickname string 昵称
 ├groupId int 集团id
 ├phone string 手机号
 ├username string 会员名
 ├province int 省:公司统一管理的代号
 ├district int 区:公司统一管理的代号
 ├city int 市:公司统一管理的代号
amount string 优惠券面额/折扣
coupon_type int 优惠券的优惠形式 0-指定金额 1-折扣券
goods_item array
 ├0 array
  ├trade_mark string 商品实体标识
  ├coupon_minus string 商品优惠金额

请求示例

{
    "openId": "6dc05b4ac175cf316d226252b05cf685",
    "grantCode": "782c281f62",
    "timestamp": "1547186244",
    "nonce": "658965",
    "token": "0%2B%2B3c6hthjwAml4ABAXOYF4Q6UY%3D",
    "params": {
        "user_coupon_id": "390913439370321921",
        "user_id": "383933091455959041",
        "items": [
            {
                "num": "1",
                "trade_mark": "201909280011111",
                "price": "1"
            }
        ],
        "multi_mark": "aEtGbNNVQ3m1YStlySDB0Q",
        "coupon_id": "953",
        "type_cate": "1",
        "discount_price": "1",
        "type": "",
        "coupon_code": "",
        "usage_scenarios": ""
    }
} 

响应示例

{
    "status": "true",
    "code": "0",
    "message": "说明",
    "data": {
        "type_cate": "1",
        "multi_mark": "aEtGbNNVQ3m1YStlySDB0Q",
        "coupon_discount": "1",
        "user_coupon_name": "测试优惠券",
        "user_coupon_id": "496996143645872129",
        "finance_payment": "1",
        "userInfo": {
            "avatar": "",
            "birthday": "",
            "gender": "",
            "nickname": "",
            "groupId": "",
            "phone": "",
            "username": "",
            "province": "",
            "district": "",
            "city": ""
        },
        "amount": "",
        "coupon_type": "",
        "goods_item": [
            {
                "trade_mark": "",
                "coupon_minus": ""
            }
        ]
    }
}

异常示例

{
    "status": true,
    "code": "异常编码,根据不同的业务返回编码",
    "message": "异常说明:查询的信息不存在"
}

错误码

{
    "status": false,
    "code": "系统错误编码:详见全局返回编码",
    "message": "系统错误说明"
}

免费升级

营销功能、插件持续每月更新开发升级

免费专业培训

每月建站、微信营销、电商等互联网增值培训

7×24小时服务支持

400电话、QQ、微信、在线等多渠道售后支持

 

安徽智迈科技股份有限公司 版权所有 Copyright 2009-2018 皖公网安备 34019202000074号 增值电信业务经营许可证:皖B2-20170075