Skip to content

创建代金券批次

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

请求参数类型描述
jsonobject声明请求的JSON数据结构
stock_namestring批次名称
available_begin_timestring开始时间
available_end_timestring结束时间
stock_use_ruleobject发放规则
max_couponsinteger发放总上限
max_amountinteger总预算
max_amount_by_dayinteger单天发放上限金额
max_coupons_per_userinteger单个用户可领个数
natural_person_limitboolean是否开启自然人限制
prevent_api_abusebooleanapi发券防刷
no_cashboolean是否无资金流
stock_typestring批次类型
NORMAL | DISCOUNT | EXCHAHGE | RANDOM | DISCOUNT_CUT 枚举值之一
commentstring批次备注
belong_merchantstring归属商户号
pattern_infoobject样式信息
descriptionstring使用说明
merchant_logostring商户logo
merchant_namestring商户名称
background_colorstring背景颜色
Color010 | Color020 | Color030 | Color040 | Color050 | Color060 | Color070 | Color080 | Color090 | Color100 枚举值之一
coupon_imagestring券详情图片
coupon_use_ruleobject核销规则
coupon_available_timeobject券可核销时间
available_begin_timestring开始时间
available_end_timestring结束时间
fix_available_timeobject固定时间段可用
available_week_dayinteger[]可用星期数(0代表周日,1代表周一,以此类推)
0 | 1 | 2 | 3 | 4 | 5 | 6 枚举值之一
begin_timeinteger当天开始时间
end_timeinteger当天结束时间
second_day_availableboolean领取第二天生效
available_time_after_receiveinteger领取后有效时间
fixed_normal_couponobject固定面额满减券使用规则
coupon_amountinteger面额
transaction_minimuminteger门槛
discount_couponobject折扣券使用规则
discount_amount_maxinteger最高折扣金额
discount_percentinteger折扣百分比
transaction_minimuminteger门槛
exchange_couponobject换购券使用规则
exchange_priceinteger单品换购价
transaction_minimuminteger消费门槛
goods_tagstring[]订单优惠标记
limit_paystring[]指定支付方式
limit_cardobject指定银行卡BIN
namestring银行卡名称
binstring[]指定卡BIN
trade_typestring[]支付方式
MICROAPP | APPPAY | PPAY | CARD | FACE | OTHER 枚举值之一
available_itemsstring[]可核销商品编码
unavailable_itemsstring[]不参与优惠商品编码
available_merchantsstring[]可核销商户号
out_request_nostring商户单据号
ext_infostring扩展属性
php
$instance->v3->marketing->favor->couponStocks->postAsync([
  'json' => [
    'stock_name'           => '微信支付代金券批次',
    'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
    'available_end_time'   => '2015-05-20T13:29:35.120+08:00',
    'stock_use_rule'       => [
      'max_coupons'          => 0,
      'max_amount'           => 0,
      'max_amount_by_day'    => 0,
      'max_coupons_per_user' => 0,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'description'      => '',
      'merchant_logo'    => '',
      'merchant_name'    => '',
      'background_color' => 'Color010',
      'coupon_image'     => '',
    ],
    'coupon_use_rule'      => [
      'coupon_available_time' => [
        'available_begin_time'         => '',
        'available_end_time'           => '',
        'fix_available_time'           => [
          'available_week_day' => ['integer'],
          'begin_time'         => 3600,
          'end_time'           => 86399,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 0,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 0,
        'transaction_minimum' => 0,
      ],
      'discount_coupon'       => [
        'discount_amount_max' => 0,
        'discount_percent'    => 0,
        'transaction_minimum' => 0,
      ],
      'exchange_coupon'       => [
        'exchange_price'      => 0,
        'transaction_minimum' => 0,
      ],
      'goods_tag'             => ['string'],
      'limit_pay'             => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
      'trade_type'            => ['string'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
    ],
    'out_request_no'       => '',
    'ext_info'             => '{"exinfo1":"1234","exinfo2":"3456"}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/marketing/favor/coupon-stocks')->postAsync([
  'json' => [
    'stock_name'           => '微信支付代金券批次',
    'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
    'available_end_time'   => '2015-05-20T13:29:35.120+08:00',
    'stock_use_rule'       => [
      'max_coupons'          => 0,
      'max_amount'           => 0,
      'max_amount_by_day'    => 0,
      'max_coupons_per_user' => 0,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'description'      => '',
      'merchant_logo'    => '',
      'merchant_name'    => '',
      'background_color' => 'Color010',
      'coupon_image'     => '',
    ],
    'coupon_use_rule'      => [
      'coupon_available_time' => [
        'available_begin_time'         => '',
        'available_end_time'           => '',
        'fix_available_time'           => [
          'available_week_day' => ['integer'],
          'begin_time'         => 3600,
          'end_time'           => 86399,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 0,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 0,
        'transaction_minimum' => 0,
      ],
      'discount_coupon'       => [
        'discount_amount_max' => 0,
        'discount_percent'    => 0,
        'transaction_minimum' => 0,
      ],
      'exchange_coupon'       => [
        'exchange_price'      => 0,
        'transaction_minimum' => 0,
      ],
      'goods_tag'             => ['string'],
      'limit_pay'             => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
      'trade_type'            => ['string'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
    ],
    'out_request_no'       => '',
    'ext_info'             => '{"exinfo1":"1234","exinfo2":"3456"}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/marketing/favor/coupon-stocks']->postAsync([
  'json' => [
    'stock_name'           => '微信支付代金券批次',
    'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
    'available_end_time'   => '2015-05-20T13:29:35.120+08:00',
    'stock_use_rule'       => [
      'max_coupons'          => 0,
      'max_amount'           => 0,
      'max_amount_by_day'    => 0,
      'max_coupons_per_user' => 0,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'description'      => '',
      'merchant_logo'    => '',
      'merchant_name'    => '',
      'background_color' => 'Color010',
      'coupon_image'     => '',
    ],
    'coupon_use_rule'      => [
      'coupon_available_time' => [
        'available_begin_time'         => '',
        'available_end_time'           => '',
        'fix_available_time'           => [
          'available_week_day' => ['integer'],
          'begin_time'         => 3600,
          'end_time'           => 86399,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 0,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 0,
        'transaction_minimum' => 0,
      ],
      'discount_coupon'       => [
        'discount_amount_max' => 0,
        'discount_percent'    => 0,
        'transaction_minimum' => 0,
      ],
      'exchange_coupon'       => [
        'exchange_price'      => 0,
        'transaction_minimum' => 0,
      ],
      'goods_tag'             => ['string'],
      'limit_pay'             => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
      'trade_type'            => ['string'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
    ],
    'out_request_no'       => '',
    'ext_info'             => '{"exinfo1":"1234","exinfo2":"3456"}',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->marketing->favor->couponStocks->post([
  'json' => [
    'stock_name'           => '微信支付代金券批次',
    'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
    'available_end_time'   => '2015-05-20T13:29:35.120+08:00',
    'stock_use_rule'       => [
      'max_coupons'          => 0,
      'max_amount'           => 0,
      'max_amount_by_day'    => 0,
      'max_coupons_per_user' => 0,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'description'      => '',
      'merchant_logo'    => '',
      'merchant_name'    => '',
      'background_color' => 'Color010',
      'coupon_image'     => '',
    ],
    'coupon_use_rule'      => [
      'coupon_available_time' => [
        'available_begin_time'         => '',
        'available_end_time'           => '',
        'fix_available_time'           => [
          'available_week_day' => ['integer'],
          'begin_time'         => 3600,
          'end_time'           => 86399,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 0,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 0,
        'transaction_minimum' => 0,
      ],
      'discount_coupon'       => [
        'discount_amount_max' => 0,
        'discount_percent'    => 0,
        'transaction_minimum' => 0,
      ],
      'exchange_coupon'       => [
        'exchange_price'      => 0,
        'transaction_minimum' => 0,
      ],
      'goods_tag'             => ['string'],
      'limit_pay'             => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
      'trade_type'            => ['string'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
    ],
    'out_request_no'       => '',
    'ext_info'             => '{"exinfo1":"1234","exinfo2":"3456"}',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/favor/coupon-stocks')->post([
  'json' => [
    'stock_name'           => '微信支付代金券批次',
    'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
    'available_end_time'   => '2015-05-20T13:29:35.120+08:00',
    'stock_use_rule'       => [
      'max_coupons'          => 0,
      'max_amount'           => 0,
      'max_amount_by_day'    => 0,
      'max_coupons_per_user' => 0,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'description'      => '',
      'merchant_logo'    => '',
      'merchant_name'    => '',
      'background_color' => 'Color010',
      'coupon_image'     => '',
    ],
    'coupon_use_rule'      => [
      'coupon_available_time' => [
        'available_begin_time'         => '',
        'available_end_time'           => '',
        'fix_available_time'           => [
          'available_week_day' => ['integer'],
          'begin_time'         => 3600,
          'end_time'           => 86399,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 0,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 0,
        'transaction_minimum' => 0,
      ],
      'discount_coupon'       => [
        'discount_amount_max' => 0,
        'discount_percent'    => 0,
        'transaction_minimum' => 0,
      ],
      'exchange_coupon'       => [
        'exchange_price'      => 0,
        'transaction_minimum' => 0,
      ],
      'goods_tag'             => ['string'],
      'limit_pay'             => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
      'trade_type'            => ['string'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
    ],
    'out_request_no'       => '',
    'ext_info'             => '{"exinfo1":"1234","exinfo2":"3456"}',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/favor/coupon-stocks']->post([
  'json' => [
    'stock_name'           => '微信支付代金券批次',
    'available_begin_time' => '2015-05-20T13:29:35.120+08:00',
    'available_end_time'   => '2015-05-20T13:29:35.120+08:00',
    'stock_use_rule'       => [
      'max_coupons'          => 0,
      'max_amount'           => 0,
      'max_amount_by_day'    => 0,
      'max_coupons_per_user' => 0,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'description'      => '',
      'merchant_logo'    => '',
      'merchant_name'    => '',
      'background_color' => 'Color010',
      'coupon_image'     => '',
    ],
    'coupon_use_rule'      => [
      'coupon_available_time' => [
        'available_begin_time'         => '',
        'available_end_time'           => '',
        'fix_available_time'           => [
          'available_week_day' => ['integer'],
          'begin_time'         => 3600,
          'end_time'           => 86399,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 0,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 0,
        'transaction_minimum' => 0,
      ],
      'discount_coupon'       => [
        'discount_amount_max' => 0,
        'discount_percent'    => 0,
        'transaction_minimum' => 0,
      ],
      'exchange_coupon'       => [
        'exchange_price'      => 0,
        'transaction_minimum' => 0,
      ],
      'goods_tag'             => ['string'],
      'limit_pay'             => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
      'trade_type'            => ['string'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
    ],
    'out_request_no'       => '',
    'ext_info'             => '{"exinfo1":"1234","exinfo2":"3456"}',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
stock_idstring批次号
create_timestring创建时间

参阅 官方文档

Published on the GitHub by TheNorthMemory