Skip to content

创建电子发票卡券模板

为商户创建电子发票的卡券模板,该卡券模板在开具的电子发票插入微信用户卡包时使用。调用该接口将覆盖商户之前配置的电子发票卡券模板。

请求参数类型描述
jsonobject声明请求的JSON数据结构
sub_mchidstring子商户号
card_appidstring插卡公众号AppID
card_template_informationobject卡券模板信息
payee_namestring收款方名称
logo_urlstring卡券logo地址
custom_cellobject卡券自定义cell位配置
wordsstringcell位文字
descriptionstringcell位描述
jump_urlstring点击cell位跳转的地址
miniprogram_user_namestring点击cell位跳转的小程序的用户名
miniprogram_pathstring点击cell位跳转的小程序的页面路径
php
$instance->v3->newTaxControlFapiao->cardTemplate->postAsync([
  'json' => [
    'sub_mchid' => '1900000109',
    'card_appid' => 'wxb1170446a4c0a5a2',
    'card_template_information' => [
      'payee_name' => '某公司',
      'logo_url' => 'http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0',
      'custom_cell' => [
        'words' => '电子发票',
        'description' => '查看发票',
        'jump_url' => 'http://www.qq.com',
        'miniprogram_user_name' => 'gh_86a091e50ad4@app',
        'miniprogram_path' => 'pages/xxxPage',
      ],
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/new-tax-control-fapiao/card-template')->postAsync([
  'json' => [
    'sub_mchid' => '1900000109',
    'card_appid' => 'wxb1170446a4c0a5a2',
    'card_template_information' => [
      'payee_name' => '某公司',
      'logo_url' => 'http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0',
      'custom_cell' => [
        'words' => '电子发票',
        'description' => '查看发票',
        'jump_url' => 'http://www.qq.com',
        'miniprogram_user_name' => 'gh_86a091e50ad4@app',
        'miniprogram_path' => 'pages/xxxPage',
      ],
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/new-tax-control-fapiao/card-template']->postAsync([
  'json' => [
    'sub_mchid' => '1900000109',
    'card_appid' => 'wxb1170446a4c0a5a2',
    'card_template_information' => [
      'payee_name' => '某公司',
      'logo_url' => 'http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0',
      'custom_cell' => [
        'words' => '电子发票',
        'description' => '查看发票',
        'jump_url' => 'http://www.qq.com',
        'miniprogram_user_name' => 'gh_86a091e50ad4@app',
        'miniprogram_path' => 'pages/xxxPage',
      ],
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->newTaxControlFapiao->cardTemplate->post([
  'json' => [
    'sub_mchid' => '1900000109',
    'card_appid' => 'wxb1170446a4c0a5a2',
    'card_template_information' => [
      'payee_name' => '某公司',
      'logo_url' => 'http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0',
      'custom_cell' => [
        'words' => '电子发票',
        'description' => '查看发票',
        'jump_url' => 'http://www.qq.com',
        'miniprogram_user_name' => 'gh_86a091e50ad4@app',
        'miniprogram_path' => 'pages/xxxPage',
      ],
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/new-tax-control-fapiao/card-template')->post([
  'json' => [
    'sub_mchid' => '1900000109',
    'card_appid' => 'wxb1170446a4c0a5a2',
    'card_template_information' => [
      'payee_name' => '某公司',
      'logo_url' => 'http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0',
      'custom_cell' => [
        'words' => '电子发票',
        'description' => '查看发票',
        'jump_url' => 'http://www.qq.com',
        'miniprogram_user_name' => 'gh_86a091e50ad4@app',
        'miniprogram_path' => 'pages/xxxPage',
      ],
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/new-tax-control-fapiao/card-template']->post([
  'json' => [
    'sub_mchid' => '1900000109',
    'card_appid' => 'wxb1170446a4c0a5a2',
    'card_template_information' => [
      'payee_name' => '某公司',
      'logo_url' => 'http://mmbiz.qpic.cn/mmbiz/iaL1LJM1mF9aRKPZJkmG8xXhiaHqkKSVMMWeN3hLut7X7hicFNjakmxibMLGWpXrEXB33367o7zHN0CwngnQY7zb7g/0',
      'custom_cell' => [
        'words' => '电子发票',
        'description' => '查看发票',
        'jump_url' => 'http://www.qq.com',
        'miniprogram_user_name' => 'gh_86a091e50ad4@app',
        'miniprogram_path' => 'pages/xxxPage',
      ],
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
card_appidstring插卡公众号AppID
card_idstring卡券模板id

参阅 官方文档

Published on the GitHub by TheNorthMemory