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
jump_targetstring卡包跳转目标
PAYMENT_CODE | MINI_PROGRAM | DEFAULT_PAGE 枚举值之一
mini_program_appidstring小程序appid
mini_program_pathstring小程序path
descriptionstring使用说明
merchant_logostring商户logo
merchant_namestring品牌名称
background_colorstring背景颜色
COLOR010 | COLOR020 | COLOR030 | COLOR040 | COLOR050 | COLOR060 | COLOR070 | COLOR080 | COLOR081 | COLOR082 | COLOR090 | COLOR100 | COLOR101 | COLOR102 枚举值之一
coupon_imagestring券详情图片
coupon_use_ruleobject
combine_useboolean是否可叠加其他优惠
coupon_available_timeobject券生效时间
fix_available_timeobject固定时间段可用
available_week_dayinteger[]可用星期数
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门槛
goods_tagstring[]订单优惠标记
trade_typestring[]指定支付模式
MICROAPP | APPPAY | PPAY | CARD | FACE | OTHER 枚举值之一
available_itemsstring[]可核销商品编码
unavailable_itemsstring[]不参与优惠商品编码
available_merchantsstring[]可核销商户号
limit_cardobject指定银行卡BIN
namestring银行卡名字
binstring[]银行卡BIN
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'          => 100,
      'max_amount'           => 5000,
      'max_amount_by_day'    => 400,
      'max_coupons_per_user' => 3,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'jump_target'        => 'PAYMENT_CODE',
      'mini_program_appid' => 'wx23232232323',
      'mini_program_path'  => '/path/index/index',
      'description'        => '微信支付营销代金券',
      'merchant_logo'      => 'CDN地址',
      'merchant_name'      => '微信支付',
      'background_color'   => 'COLOR010',
      'coupon_image'       => 'https://qpic.cn/xxx',
    ],
    'coupon_use_rule'      => [
      'combine_use'           => true,
      'coupon_available_time' => [
        'fix_available_time'           => [
          'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
          'begin_time'         => 0,
          'end_time'           => 3600,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 7,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 100,
        'transaction_minimum' => 100,
      ],
      'goods_tag'             => ['string'],
      'trade_type'            => ['MICROAPP'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
    ],
    'out_request_no'       => 'example_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'          => 100,
      'max_amount'           => 5000,
      'max_amount_by_day'    => 400,
      'max_coupons_per_user' => 3,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'jump_target'        => 'PAYMENT_CODE',
      'mini_program_appid' => 'wx23232232323',
      'mini_program_path'  => '/path/index/index',
      'description'        => '微信支付营销代金券',
      'merchant_logo'      => 'CDN地址',
      'merchant_name'      => '微信支付',
      'background_color'   => 'COLOR010',
      'coupon_image'       => 'https://qpic.cn/xxx',
    ],
    'coupon_use_rule'      => [
      'combine_use'           => true,
      'coupon_available_time' => [
        'fix_available_time'           => [
          'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
          'begin_time'         => 0,
          'end_time'           => 3600,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 7,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 100,
        'transaction_minimum' => 100,
      ],
      'goods_tag'             => ['string'],
      'trade_type'            => ['MICROAPP'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
    ],
    'out_request_no'       => 'example_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'          => 100,
      'max_amount'           => 5000,
      'max_amount_by_day'    => 400,
      'max_coupons_per_user' => 3,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'jump_target'        => 'PAYMENT_CODE',
      'mini_program_appid' => 'wx23232232323',
      'mini_program_path'  => '/path/index/index',
      'description'        => '微信支付营销代金券',
      'merchant_logo'      => 'CDN地址',
      'merchant_name'      => '微信支付',
      'background_color'   => 'COLOR010',
      'coupon_image'       => 'https://qpic.cn/xxx',
    ],
    'coupon_use_rule'      => [
      'combine_use'           => true,
      'coupon_available_time' => [
        'fix_available_time'           => [
          'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
          'begin_time'         => 0,
          'end_time'           => 3600,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 7,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 100,
        'transaction_minimum' => 100,
      ],
      'goods_tag'             => ['string'],
      'trade_type'            => ['MICROAPP'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
    ],
    'out_request_no'       => 'example_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'          => 100,
      'max_amount'           => 5000,
      'max_amount_by_day'    => 400,
      'max_coupons_per_user' => 3,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'jump_target'        => 'PAYMENT_CODE',
      'mini_program_appid' => 'wx23232232323',
      'mini_program_path'  => '/path/index/index',
      'description'        => '微信支付营销代金券',
      'merchant_logo'      => 'CDN地址',
      'merchant_name'      => '微信支付',
      'background_color'   => 'COLOR010',
      'coupon_image'       => 'https://qpic.cn/xxx',
    ],
    'coupon_use_rule'      => [
      'combine_use'           => true,
      'coupon_available_time' => [
        'fix_available_time'           => [
          'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
          'begin_time'         => 0,
          'end_time'           => 3600,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 7,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 100,
        'transaction_minimum' => 100,
      ],
      'goods_tag'             => ['string'],
      'trade_type'            => ['MICROAPP'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
    ],
    'out_request_no'       => 'example_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'          => 100,
      'max_amount'           => 5000,
      'max_amount_by_day'    => 400,
      'max_coupons_per_user' => 3,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'jump_target'        => 'PAYMENT_CODE',
      'mini_program_appid' => 'wx23232232323',
      'mini_program_path'  => '/path/index/index',
      'description'        => '微信支付营销代金券',
      'merchant_logo'      => 'CDN地址',
      'merchant_name'      => '微信支付',
      'background_color'   => 'COLOR010',
      'coupon_image'       => 'https://qpic.cn/xxx',
    ],
    'coupon_use_rule'      => [
      'combine_use'           => true,
      'coupon_available_time' => [
        'fix_available_time'           => [
          'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
          'begin_time'         => 0,
          'end_time'           => 3600,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 7,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 100,
        'transaction_minimum' => 100,
      ],
      'goods_tag'             => ['string'],
      'trade_type'            => ['MICROAPP'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
    ],
    'out_request_no'       => 'example_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'          => 100,
      'max_amount'           => 5000,
      'max_amount_by_day'    => 400,
      'max_coupons_per_user' => 3,
      'natural_person_limit' => true,
      'prevent_api_abuse'    => true,
    ],
    'no_cash'              => true,
    'stock_type'           => 'NORMAL',
    'comment'              => '零售批次',
    'belong_merchant'      => '98568865',
    'pattern_info'         => [
      'jump_target'        => 'PAYMENT_CODE',
      'mini_program_appid' => 'wx23232232323',
      'mini_program_path'  => '/path/index/index',
      'description'        => '微信支付营销代金券',
      'merchant_logo'      => 'CDN地址',
      'merchant_name'      => '微信支付',
      'background_color'   => 'COLOR010',
      'coupon_image'       => 'https://qpic.cn/xxx',
    ],
    'coupon_use_rule'      => [
      'combine_use'           => true,
      'coupon_available_time' => [
        'fix_available_time'           => [
          'available_week_day' => [0, 1, 2, 3, 4, 5, 6],
          'begin_time'         => 0,
          'end_time'           => 3600,
        ],
        'second_day_available'         => true,
        'available_time_after_receive' => 7,
      ],
      'fixed_normal_coupon'   => [
        'coupon_amount'       => 100,
        'transaction_minimum' => 100,
      ],
      'goods_tag'             => ['string'],
      'trade_type'            => ['MICROAPP'],
      'available_items'       => ['string'],
      'unavailable_items'     => ['string'],
      'available_merchants'   => ['string'],
      'limit_card'            => [
        'name' => '精粹白金',
        'bin'  => ['string'],
      ],
    ],
    'out_request_no'       => 'example_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