首先大体思路是这样的:
先创建一个卡券,注意自定义创建的卡券有三个参数是不一样的
quantity 为0 库存
use_custom_code 为true 是否自定义Code码
get_custom_code_mode 为 GET_CUSTOM_CODE_MODE_DEPOSIT 卡券为预存code模式卡券
创建成功后导入code码
public function inputCode()
{
$url = "http://api.weixin.qq.com/card/code/deposit?access_token=" . $this->token;
$data = array(
"card_id" => "card_id", // 刚刚创建成功的card_id
"code" => array(
"dsfrgthtyj", "gtrhyjuk", "gtrhrgdsvgdrf", "grthytjyj", "grgesgxccgrh" //code码
)
);
$res = curl_post($url, json_encode($data));
var_dump($res);
}