上传预存code
商家券的Code码可由微信后台随机分配,同时支持商户自定义。如商家已有自己的优惠券系统,可直接使用自定义模式。即商家预先向微信支付上传券Code,当券在发放时,微信支付自动从已导入的Code中随机取值(不能指定),派发给用户。
请求参数 | 类型 | 描述 |
---|---|---|
stock_id | string | 批次号 |
json | object | 声明请求的JSON 数据结构 |
coupon_code_list | string[] | 券code列表 |
upload_request_no | string | 请求业务单据号 |
php
$instance->v3->marketing->busifavor->stocks->_stock_id_->couponcodes->postAsync([
'stock_id' => '98065001',
'json' => [
'coupon_code_list' => ['string'],
'upload_request_no' => '100002322019090134234sfdf',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/marketing/busifavor/stocks/{stock_id}/couponcodes')->postAsync([
'stock_id' => '98065001',
'json' => [
'coupon_code_list' => ['string'],
'upload_request_no' => '100002322019090134234sfdf',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/marketing/busifavor/stocks/{stock_id}/couponcodes']->postAsync([
'stock_id' => '98065001',
'json' => [
'coupon_code_list' => ['string'],
'upload_request_no' => '100002322019090134234sfdf',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->marketing->busifavor->stocks->_stock_id_->couponcodes->post([
'stock_id' => '98065001',
'json' => [
'coupon_code_list' => ['string'],
'upload_request_no' => '100002322019090134234sfdf',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/busifavor/stocks/{stock_id}/couponcodes')->post([
'stock_id' => '98065001',
'json' => [
'coupon_code_list' => ['string'],
'upload_request_no' => '100002322019090134234sfdf',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/busifavor/stocks/{stock_id}/couponcodes']->post([
'stock_id' => '98065001',
'json' => [
'coupon_code_list' => ['string'],
'upload_request_no' => '100002322019090134234sfdf',
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
stock_id | string | 批次号 |
total_count | integer | 去重后上传code总数 |
success_count | integer | 上传成功code个数 |
success_codes | string[] | 上传成功的code列表 |
success_time | string | 上传成功时间 |
fail_count | integer | 上传失败code个数 |
fail_codes | object[] | 上传失败的code及原因 |
coupon_code | string | 上传失败的券code |
code | string | 上传失败错误码 |
message | string | 上传失败错误信息 |
exist_codes | string[] | 已存在的code列表 |
duplicate_codes | string[] | 本次请求中重复的code列表 |
参阅 官方文档
查询预存code列表
请求参数 | 类型 | 描述 |
---|---|---|
stock_id | string | 批次号 |
query | object | 声明请求的查询参数 |
status | string | 券code状态SENDED | USED | EXPIRED | DELETED | DEACTIVATED 枚举值之一 |
appid | string | 公众账号ID |
offset | number | 分页页码 |
limit | number | 分页大小 |
php
$instance->v3->marketing->busifavor->stocks->_stock_id_->couponcodes->getAsync([
'stock_id' => '98065001',
'query' => [
'status' => 'SENDED',
'appid' => 'wx233544546545989',
'offset' => 0,
'limit' => 20,
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/marketing/busifavor/stocks/{stock_id}/couponcodes')->getAsync([
'stock_id' => '98065001',
'query' => [
'status' => 'SENDED',
'appid' => 'wx233544546545989',
'offset' => 0,
'limit' => 20,
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/marketing/busifavor/stocks/{stock_id}/couponcodes']->getAsync([
'stock_id' => '98065001',
'query' => [
'status' => 'SENDED',
'appid' => 'wx233544546545989',
'offset' => 0,
'limit' => 20,
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->marketing->busifavor->stocks->_stock_id_->couponcodes->get([
'stock_id' => '98065001',
'query' => [
'status' => 'SENDED',
'appid' => 'wx233544546545989',
'offset' => 0,
'limit' => 20,
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/marketing/busifavor/stocks/{stock_id}/couponcodes')->get([
'stock_id' => '98065001',
'query' => [
'status' => 'SENDED',
'appid' => 'wx233544546545989',
'offset' => 0,
'limit' => 20,
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/marketing/busifavor/stocks/{stock_id}/couponcodes']->get([
'stock_id' => '98065001',
'query' => [
'status' => 'SENDED',
'appid' => 'wx233544546545989',
'offset' => 0,
'limit' => 20,
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
stock_id | string | 批次号 |
total_count | integer | 批次总数 |
limit | integer | 分页大小 |
offset | integer | 分页页码 |
data | object[] | 券code信息 |
code | string | 商户上传code |
code_status | string | 商户上传code分配状态 |
upload_time | string | 上传时间 |
dispatched_time | string | 被分配时间 |
openid | string | 领券用户的OpenID |
unionid | string | 领券用户的UnionID |
coupon_code | string | 用户券code |
参阅 官方文档