Skip to content

将电子发票插入微信用户卡包

商户自行开具电子发票后,可调用本接口将电子发票插入微信用户的卡包。

请求参数类型描述
fapiao_apply_idstring发票申请单号
jsonobject声明请求的JSON数据结构
sub_mchidstring子商户号
scenestring插卡场景
buyer_informationobject购买方信息
typestring购买方类型
namestring名称
taxpayer_idstring纳税人识别号
addressstring地址
telephonestring电话
bank_namestring开户银行
bank_accountstring银行账号
phonestring手机号
emailstring邮箱地址
fapiao_card_informationobject[]电子发票卡券信息列表
fapiao_media_idstring电子发票文件ID
fapiao_numberstring发票号码
fapiao_codestring发票代码
fapiao_timestring开票时间
check_codestring校验码
passwordstring密码
total_amountinteger总价税合计
tax_amountinteger总税额
amountinteger总金额
seller_informationobject销售方信息
namestring名称
taxpayer_idstring纳税人识别号
addressstring地址
telephonestring电话
bank_namestring开户银行
bank_accountstring银行账号
extra_informationobject附加信息
payeestring收款人
reviewerstring复核人
drawerstring开票人
itemsobject[]发票行信息
tax_codestring货物或应税劳务、服务编码
goods_namestring货物或应税劳务、服务名称
specificationstring规格型号
unitstring单位
quantityinteger数量
unit_priceinteger单价
amountinteger单行金额
tax_amountinteger单行税额
total_amountinteger单行金额合计
tax_rateinteger税率
tax_prefer_markstring税收优惠政策标识
discountboolean是否折扣行
remarkstring备注信息
headersobject声明请求的头参数
Wechatpay-Serialstring平台公钥ID/平台公钥证书序列号
php
$instance->v3->newTaxControlFapiao->fapiaoApplications->_fapiao_apply_id_->insertCards->postAsync([
  'fapiao_apply_id' => '4200000444201910177461284488',
  'json' => [
    'sub_mchid' => '1900000109',
    'scene' => 'WITH_WECHATPAY',
    'buyer_information' => [
      'type' => 'ORGANIZATION',
      'name' => '深圳市南山区测试企业',
      'taxpayer_id' => '202003261233701778',
      'address' => '深圳市南山区深南大道10000号',
      'telephone' => '075512345678',
      'bank_name' => '测试银行',
      'bank_account' => '62001234567890',
      'phone' => '18507550000',
      'email' => '123110@qq.com',
    ],
    'fapiao_card_information' => [[
      'fapiao_media_id' => 'ASNFZ4mrze/+3LqYdlQyEA==',
      'fapiao_number' => '12897794',
      'fapiao_code' => '044001911211',
      'fapiao_time' => '2020-07-01T12:00:00+08:00',
      'check_code' => '69001808340631374774',
      'password' => '006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21',
      'total_amount' => 382895,
      'tax_amount' => 44050,
      'amount' => 338845,
      'seller_information' => [
        'name' => '深圳市南山区测试公司',
        'taxpayer_id' => '202003261233701778',
        'address' => '深圳市南山区深南大道10000号',
        'telephone' => '075512345678',
        'bank_name' => '测试银行',
        'bank_account' => '62001234567890',
      ],
      'extra_information' => [
        'payee' => '张三',
        'reviewer' => '李四',
        'drawer' => '王五',
      ],
      'items' => [[
        'tax_code' => '3010101020203000000',
        'goods_name' => '出租汽车客运服务',
        'specification' => 'A4',
        'unit' => '次',
        'quantity' => 100000000,
        'unit_price' => 380442000000,
        'amount' => 380442,
        'tax_amount' => 49458,
        'total_amount' => 429900,
        'tax_rate' => 1300,
        'tax_prefer_mark' => 'NO_FAVORABLE',
        'discount' => true,
      ],],
      'remark' => '备注',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r($response->getStatusCode() === 202);
})
->wait();
php
$instance->chain('v3/new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards')->postAsync([
  'fapiao_apply_id' => '4200000444201910177461284488',
  'json' => [
    'sub_mchid' => '1900000109',
    'scene' => 'WITH_WECHATPAY',
    'buyer_information' => [
      'type' => 'ORGANIZATION',
      'name' => '深圳市南山区测试企业',
      'taxpayer_id' => '202003261233701778',
      'address' => '深圳市南山区深南大道10000号',
      'telephone' => '075512345678',
      'bank_name' => '测试银行',
      'bank_account' => '62001234567890',
      'phone' => '18507550000',
      'email' => '123110@qq.com',
    ],
    'fapiao_card_information' => [[
      'fapiao_media_id' => 'ASNFZ4mrze/+3LqYdlQyEA==',
      'fapiao_number' => '12897794',
      'fapiao_code' => '044001911211',
      'fapiao_time' => '2020-07-01T12:00:00+08:00',
      'check_code' => '69001808340631374774',
      'password' => '006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21',
      'total_amount' => 382895,
      'tax_amount' => 44050,
      'amount' => 338845,
      'seller_information' => [
        'name' => '深圳市南山区测试公司',
        'taxpayer_id' => '202003261233701778',
        'address' => '深圳市南山区深南大道10000号',
        'telephone' => '075512345678',
        'bank_name' => '测试银行',
        'bank_account' => '62001234567890',
      ],
      'extra_information' => [
        'payee' => '张三',
        'reviewer' => '李四',
        'drawer' => '王五',
      ],
      'items' => [[
        'tax_code' => '3010101020203000000',
        'goods_name' => '出租汽车客运服务',
        'specification' => 'A4',
        'unit' => '次',
        'quantity' => 100000000,
        'unit_price' => 380442000000,
        'amount' => 380442,
        'tax_amount' => 49458,
        'total_amount' => 429900,
        'tax_rate' => 1300,
        'tax_prefer_mark' => 'NO_FAVORABLE',
        'discount' => true,
      ],],
      'remark' => '备注',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r($response->getStatusCode() === 202);
})
->wait();
php
$instance['v3/new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards']->postAsync([
  'fapiao_apply_id' => '4200000444201910177461284488',
  'json' => [
    'sub_mchid' => '1900000109',
    'scene' => 'WITH_WECHATPAY',
    'buyer_information' => [
      'type' => 'ORGANIZATION',
      'name' => '深圳市南山区测试企业',
      'taxpayer_id' => '202003261233701778',
      'address' => '深圳市南山区深南大道10000号',
      'telephone' => '075512345678',
      'bank_name' => '测试银行',
      'bank_account' => '62001234567890',
      'phone' => '18507550000',
      'email' => '123110@qq.com',
    ],
    'fapiao_card_information' => [[
      'fapiao_media_id' => 'ASNFZ4mrze/+3LqYdlQyEA==',
      'fapiao_number' => '12897794',
      'fapiao_code' => '044001911211',
      'fapiao_time' => '2020-07-01T12:00:00+08:00',
      'check_code' => '69001808340631374774',
      'password' => '006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21',
      'total_amount' => 382895,
      'tax_amount' => 44050,
      'amount' => 338845,
      'seller_information' => [
        'name' => '深圳市南山区测试公司',
        'taxpayer_id' => '202003261233701778',
        'address' => '深圳市南山区深南大道10000号',
        'telephone' => '075512345678',
        'bank_name' => '测试银行',
        'bank_account' => '62001234567890',
      ],
      'extra_information' => [
        'payee' => '张三',
        'reviewer' => '李四',
        'drawer' => '王五',
      ],
      'items' => [[
        'tax_code' => '3010101020203000000',
        'goods_name' => '出租汽车客运服务',
        'specification' => 'A4',
        'unit' => '次',
        'quantity' => 100000000,
        'unit_price' => 380442000000,
        'amount' => 380442,
        'tax_amount' => 49458,
        'total_amount' => 429900,
        'tax_rate' => 1300,
        'tax_prefer_mark' => 'NO_FAVORABLE',
        'discount' => true,
      ],],
      'remark' => '备注',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r($response->getStatusCode() === 202);
})
->wait();
php
$response = $instance->v3->newTaxControlFapiao->fapiaoApplications->_fapiao_apply_id_->insertCards->post([
  'fapiao_apply_id' => '4200000444201910177461284488',
  'json' => [
    'sub_mchid' => '1900000109',
    'scene' => 'WITH_WECHATPAY',
    'buyer_information' => [
      'type' => 'ORGANIZATION',
      'name' => '深圳市南山区测试企业',
      'taxpayer_id' => '202003261233701778',
      'address' => '深圳市南山区深南大道10000号',
      'telephone' => '075512345678',
      'bank_name' => '测试银行',
      'bank_account' => '62001234567890',
      'phone' => '18507550000',
      'email' => '123110@qq.com',
    ],
    'fapiao_card_information' => [[
      'fapiao_media_id' => 'ASNFZ4mrze/+3LqYdlQyEA==',
      'fapiao_number' => '12897794',
      'fapiao_code' => '044001911211',
      'fapiao_time' => '2020-07-01T12:00:00+08:00',
      'check_code' => '69001808340631374774',
      'password' => '006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21',
      'total_amount' => 382895,
      'tax_amount' => 44050,
      'amount' => 338845,
      'seller_information' => [
        'name' => '深圳市南山区测试公司',
        'taxpayer_id' => '202003261233701778',
        'address' => '深圳市南山区深南大道10000号',
        'telephone' => '075512345678',
        'bank_name' => '测试银行',
        'bank_account' => '62001234567890',
      ],
      'extra_information' => [
        'payee' => '张三',
        'reviewer' => '李四',
        'drawer' => '王五',
      ],
      'items' => [[
        'tax_code' => '3010101020203000000',
        'goods_name' => '出租汽车客运服务',
        'specification' => 'A4',
        'unit' => '次',
        'quantity' => 100000000,
        'unit_price' => 380442000000,
        'amount' => 380442,
        'tax_amount' => 49458,
        'total_amount' => 429900,
        'tax_rate' => 1300,
        'tax_prefer_mark' => 'NO_FAVORABLE',
        'discount' => true,
      ],],
      'remark' => '备注',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r($response->getStatusCode() === 202);
php
$response = $instance->chain('v3/new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards')->post([
  'fapiao_apply_id' => '4200000444201910177461284488',
  'json' => [
    'sub_mchid' => '1900000109',
    'scene' => 'WITH_WECHATPAY',
    'buyer_information' => [
      'type' => 'ORGANIZATION',
      'name' => '深圳市南山区测试企业',
      'taxpayer_id' => '202003261233701778',
      'address' => '深圳市南山区深南大道10000号',
      'telephone' => '075512345678',
      'bank_name' => '测试银行',
      'bank_account' => '62001234567890',
      'phone' => '18507550000',
      'email' => '123110@qq.com',
    ],
    'fapiao_card_information' => [[
      'fapiao_media_id' => 'ASNFZ4mrze/+3LqYdlQyEA==',
      'fapiao_number' => '12897794',
      'fapiao_code' => '044001911211',
      'fapiao_time' => '2020-07-01T12:00:00+08:00',
      'check_code' => '69001808340631374774',
      'password' => '006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21',
      'total_amount' => 382895,
      'tax_amount' => 44050,
      'amount' => 338845,
      'seller_information' => [
        'name' => '深圳市南山区测试公司',
        'taxpayer_id' => '202003261233701778',
        'address' => '深圳市南山区深南大道10000号',
        'telephone' => '075512345678',
        'bank_name' => '测试银行',
        'bank_account' => '62001234567890',
      ],
      'extra_information' => [
        'payee' => '张三',
        'reviewer' => '李四',
        'drawer' => '王五',
      ],
      'items' => [[
        'tax_code' => '3010101020203000000',
        'goods_name' => '出租汽车客运服务',
        'specification' => 'A4',
        'unit' => '次',
        'quantity' => 100000000,
        'unit_price' => 380442000000,
        'amount' => 380442,
        'tax_amount' => 49458,
        'total_amount' => 429900,
        'tax_rate' => 1300,
        'tax_prefer_mark' => 'NO_FAVORABLE',
        'discount' => true,
      ],],
      'remark' => '备注',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r($response->getStatusCode() === 202);
php
$response = $instance['v3/new-tax-control-fapiao/fapiao-applications/{fapiao_apply_id}/insert-cards']->post([
  'fapiao_apply_id' => '4200000444201910177461284488',
  'json' => [
    'sub_mchid' => '1900000109',
    'scene' => 'WITH_WECHATPAY',
    'buyer_information' => [
      'type' => 'ORGANIZATION',
      'name' => '深圳市南山区测试企业',
      'taxpayer_id' => '202003261233701778',
      'address' => '深圳市南山区深南大道10000号',
      'telephone' => '075512345678',
      'bank_name' => '测试银行',
      'bank_account' => '62001234567890',
      'phone' => '18507550000',
      'email' => '123110@qq.com',
    ],
    'fapiao_card_information' => [[
      'fapiao_media_id' => 'ASNFZ4mrze/+3LqYdlQyEA==',
      'fapiao_number' => '12897794',
      'fapiao_code' => '044001911211',
      'fapiao_time' => '2020-07-01T12:00:00+08:00',
      'check_code' => '69001808340631374774',
      'password' => '006>299-375/326>2+7/*0-+<351059<80<4*/5>+<11631+*3030/5*37+/-243159658+013>3409*044>4-/1+/9->*>69501*6++1997--21',
      'total_amount' => 382895,
      'tax_amount' => 44050,
      'amount' => 338845,
      'seller_information' => [
        'name' => '深圳市南山区测试公司',
        'taxpayer_id' => '202003261233701778',
        'address' => '深圳市南山区深南大道10000号',
        'telephone' => '075512345678',
        'bank_name' => '测试银行',
        'bank_account' => '62001234567890',
      ],
      'extra_information' => [
        'payee' => '张三',
        'reviewer' => '李四',
        'drawer' => '王五',
      ],
      'items' => [[
        'tax_code' => '3010101020203000000',
        'goods_name' => '出租汽车客运服务',
        'specification' => 'A4',
        'unit' => '次',
        'quantity' => 100000000,
        'unit_price' => 380442000000,
        'amount' => 380442,
        'tax_amount' => 49458,
        'total_amount' => 429900,
        'tax_rate' => 1300,
        'tax_prefer_mark' => 'NO_FAVORABLE',
        'discount' => true,
      ],],
      'remark' => '备注',
    ],],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r($response->getStatusCode() === 202);
返回字典类型描述

参阅 官方文档

Published on the GitHub by TheNorthMemory