Skip to content

开具通用行业电子发票

商户完成收款后,调用本接口开具通用行业电子发票并插入微信用户的卡包。请求的交易信息必须真实存在。 注意:本接口成功返回仅代表开票请求已被受理,当开票完成时,微信支付会根据商户配置的回调地址进行回调通知,商户也可以通过【查询电子发票】接口获取开票结果及开票信息。

请求参数类型描述
jsonobject声明请求的JSON数据结构
sub_mchidstring子商户号
fapiao_apply_idstring发票申请单号
buyer_informationobject购买方信息
typestring购买方类型
INDIVIDUAL | ORGANIZATION 枚举值之一
namestring名称
taxpayer_idstring纳税人识别号
addressstring地址
telephonestring电话
bank_namestring开户银行
bank_accountstring银行账号
phonestring手机号
emailstring邮箱地址
amountinteger订单金额
out_trade_nostring商户订单号
fapiao_bill_typestring开具的发票类型
COMM_FAPIAO | VAT_FAPIAO 枚举值之一
user_apply_messagestring留言信息
fapiao_informationobject需要开具的数电发票信息
fapiao_idstring商户发票单号
total_amountinteger总价税合计
itemsobject[]发票行信息
tax_codestring税局侧规定的货物或应税劳务、服务税收分类编码
goods_namestring货物或应税劳务、服务名称
specificationstring规格型号
unitstring单位
quantityinteger数量
total_amountinteger单行金额合计
tax_ratenumber税率
discountboolean是否折扣行
preferential_policy_codeinteger优惠政策标识
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 枚举值之一
export_business_policy_codeinteger出口业务适用政策代码
1 | 2 | 3 枚举值之一
vat_refund_levy_codeinteger增值税即征即退代码
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 枚举值之一
billing_person_idstring开票人ID
billing_personstring开票人名称
fapiao_bill_typestring发票类型
COMM_FAPIAO | VAT_FAPIAO 枚举值之一
transaction_informationobject[]交易信息
pay_channelstring支付渠道
WECHAT_PAY 枚举值
transaction_idstring支付订单号
out_trade_nostring支付商户订单号
amountinteger交易金额
remarkstring发票备注
headersobject声明请求的头参数
Wechatpay-Serialstring微信支付公钥ID/平台证书序列号
php
$instance->v3->newTaxControlFapiao->fapiaoApplications->issueGeneral->postAsync([
  'json' => [
    'sub_mchid'          => '1900000109',
    'fapiao_apply_id'    => '4200000444201910177461284488',
    'buyer_information'  => [
      'type'               => 'ORGANIZATION',
      'name'               => '深圳市南山区测试企业',
      'taxpayer_id'        => '202003261233701778',
      'address'            => '深圳市南山区深南大道10000号',
      'telephone'          => '075512345678',
      'bank_name'          => '测试银行',
      'bank_account'       => '62001234567890',
      'phone'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'email'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'amount'             => 1000,
      'out_trade_no'       => 'order_20200701_123456',
      'fapiao_bill_type'   => 'COMM_FAPIAO',
      'user_apply_message' => '用户留言',
    ],
    'fapiao_information' => [
      'fapiao_id'                   => '20200701123456',
      'total_amount'                => 382895,
      'items'                       => [[
        'tax_code'                 => '3010101020203000000',
        'goods_name'               => '出租汽车客运服务',
        'specification'            => 'A4',
        'unit'                     => '次',
        'quantity'                 => 100000000,
        'total_amount'             => 429900,
        'tax_rate'                 => 1300,
        'discount'                 => true,
        'preferential_policy_code' => 1,
      ],],
      'export_business_policy_code' => 1,
      'vat_refund_levy_code'        => 1,
      'billing_person_id'           => '128279891283',
      'billing_person'              => 'example_billing_person',
      'fapiao_bill_type'            => 'COMM_FAPIAO',
      'transaction_information'     => [[
        'pay_channel'    => 'WECHAT_PAY',
        'transaction_id' => '4200000008202508080512076713',
        'out_trade_no'   => 'order_20200701_123456',
        'amount'         => 382895,
      ],],
      '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/issue-general')->postAsync([
  'json' => [
    'sub_mchid'          => '1900000109',
    'fapiao_apply_id'    => '4200000444201910177461284488',
    'buyer_information'  => [
      'type'               => 'ORGANIZATION',
      'name'               => '深圳市南山区测试企业',
      'taxpayer_id'        => '202003261233701778',
      'address'            => '深圳市南山区深南大道10000号',
      'telephone'          => '075512345678',
      'bank_name'          => '测试银行',
      'bank_account'       => '62001234567890',
      'phone'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'email'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'amount'             => 1000,
      'out_trade_no'       => 'order_20200701_123456',
      'fapiao_bill_type'   => 'COMM_FAPIAO',
      'user_apply_message' => '用户留言',
    ],
    'fapiao_information' => [
      'fapiao_id'                   => '20200701123456',
      'total_amount'                => 382895,
      'items'                       => [[
        'tax_code'                 => '3010101020203000000',
        'goods_name'               => '出租汽车客运服务',
        'specification'            => 'A4',
        'unit'                     => '次',
        'quantity'                 => 100000000,
        'total_amount'             => 429900,
        'tax_rate'                 => 1300,
        'discount'                 => true,
        'preferential_policy_code' => 1,
      ],],
      'export_business_policy_code' => 1,
      'vat_refund_levy_code'        => 1,
      'billing_person_id'           => '128279891283',
      'billing_person'              => 'example_billing_person',
      'fapiao_bill_type'            => 'COMM_FAPIAO',
      'transaction_information'     => [[
        'pay_channel'    => 'WECHAT_PAY',
        'transaction_id' => '4200000008202508080512076713',
        'out_trade_no'   => 'order_20200701_123456',
        'amount'         => 382895,
      ],],
      '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/issue-general']->postAsync([
  'json' => [
    'sub_mchid'          => '1900000109',
    'fapiao_apply_id'    => '4200000444201910177461284488',
    'buyer_information'  => [
      'type'               => 'ORGANIZATION',
      'name'               => '深圳市南山区测试企业',
      'taxpayer_id'        => '202003261233701778',
      'address'            => '深圳市南山区深南大道10000号',
      'telephone'          => '075512345678',
      'bank_name'          => '测试银行',
      'bank_account'       => '62001234567890',
      'phone'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'email'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'amount'             => 1000,
      'out_trade_no'       => 'order_20200701_123456',
      'fapiao_bill_type'   => 'COMM_FAPIAO',
      'user_apply_message' => '用户留言',
    ],
    'fapiao_information' => [
      'fapiao_id'                   => '20200701123456',
      'total_amount'                => 382895,
      'items'                       => [[
        'tax_code'                 => '3010101020203000000',
        'goods_name'               => '出租汽车客运服务',
        'specification'            => 'A4',
        'unit'                     => '次',
        'quantity'                 => 100000000,
        'total_amount'             => 429900,
        'tax_rate'                 => 1300,
        'discount'                 => true,
        'preferential_policy_code' => 1,
      ],],
      'export_business_policy_code' => 1,
      'vat_refund_levy_code'        => 1,
      'billing_person_id'           => '128279891283',
      'billing_person'              => 'example_billing_person',
      'fapiao_bill_type'            => 'COMM_FAPIAO',
      'transaction_information'     => [[
        'pay_channel'    => 'WECHAT_PAY',
        'transaction_id' => '4200000008202508080512076713',
        'out_trade_no'   => 'order_20200701_123456',
        'amount'         => 382895,
      ],],
      '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->issueGeneral->post([
  'json' => [
    'sub_mchid'          => '1900000109',
    'fapiao_apply_id'    => '4200000444201910177461284488',
    'buyer_information'  => [
      'type'               => 'ORGANIZATION',
      'name'               => '深圳市南山区测试企业',
      'taxpayer_id'        => '202003261233701778',
      'address'            => '深圳市南山区深南大道10000号',
      'telephone'          => '075512345678',
      'bank_name'          => '测试银行',
      'bank_account'       => '62001234567890',
      'phone'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'email'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'amount'             => 1000,
      'out_trade_no'       => 'order_20200701_123456',
      'fapiao_bill_type'   => 'COMM_FAPIAO',
      'user_apply_message' => '用户留言',
    ],
    'fapiao_information' => [
      'fapiao_id'                   => '20200701123456',
      'total_amount'                => 382895,
      'items'                       => [[
        'tax_code'                 => '3010101020203000000',
        'goods_name'               => '出租汽车客运服务',
        'specification'            => 'A4',
        'unit'                     => '次',
        'quantity'                 => 100000000,
        'total_amount'             => 429900,
        'tax_rate'                 => 1300,
        'discount'                 => true,
        'preferential_policy_code' => 1,
      ],],
      'export_business_policy_code' => 1,
      'vat_refund_levy_code'        => 1,
      'billing_person_id'           => '128279891283',
      'billing_person'              => 'example_billing_person',
      'fapiao_bill_type'            => 'COMM_FAPIAO',
      'transaction_information'     => [[
        'pay_channel'    => 'WECHAT_PAY',
        'transaction_id' => '4200000008202508080512076713',
        'out_trade_no'   => 'order_20200701_123456',
        'amount'         => 382895,
      ],],
      'remark'                      => '备注',
    ],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r($response->getStatusCode() === 202);
php
$response = $instance->chain('v3/new-tax-control-fapiao/fapiao-applications/issue-general')->post([
  'json' => [
    'sub_mchid'          => '1900000109',
    'fapiao_apply_id'    => '4200000444201910177461284488',
    'buyer_information'  => [
      'type'               => 'ORGANIZATION',
      'name'               => '深圳市南山区测试企业',
      'taxpayer_id'        => '202003261233701778',
      'address'            => '深圳市南山区深南大道10000号',
      'telephone'          => '075512345678',
      'bank_name'          => '测试银行',
      'bank_account'       => '62001234567890',
      'phone'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'email'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'amount'             => 1000,
      'out_trade_no'       => 'order_20200701_123456',
      'fapiao_bill_type'   => 'COMM_FAPIAO',
      'user_apply_message' => '用户留言',
    ],
    'fapiao_information' => [
      'fapiao_id'                   => '20200701123456',
      'total_amount'                => 382895,
      'items'                       => [[
        'tax_code'                 => '3010101020203000000',
        'goods_name'               => '出租汽车客运服务',
        'specification'            => 'A4',
        'unit'                     => '次',
        'quantity'                 => 100000000,
        'total_amount'             => 429900,
        'tax_rate'                 => 1300,
        'discount'                 => true,
        'preferential_policy_code' => 1,
      ],],
      'export_business_policy_code' => 1,
      'vat_refund_levy_code'        => 1,
      'billing_person_id'           => '128279891283',
      'billing_person'              => 'example_billing_person',
      'fapiao_bill_type'            => 'COMM_FAPIAO',
      'transaction_information'     => [[
        'pay_channel'    => 'WECHAT_PAY',
        'transaction_id' => '4200000008202508080512076713',
        'out_trade_no'   => 'order_20200701_123456',
        'amount'         => 382895,
      ],],
      'remark'                      => '备注',
    ],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r($response->getStatusCode() === 202);
php
$response = $instance['v3/new-tax-control-fapiao/fapiao-applications/issue-general']->post([
  'json' => [
    'sub_mchid'          => '1900000109',
    'fapiao_apply_id'    => '4200000444201910177461284488',
    'buyer_information'  => [
      'type'               => 'ORGANIZATION',
      'name'               => '深圳市南山区测试企业',
      'taxpayer_id'        => '202003261233701778',
      'address'            => '深圳市南山区深南大道10000号',
      'telephone'          => '075512345678',
      'bank_name'          => '测试银行',
      'bank_account'       => '62001234567890',
      'phone'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'email'              => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tPttdY+aQ6zB',
      'amount'             => 1000,
      'out_trade_no'       => 'order_20200701_123456',
      'fapiao_bill_type'   => 'COMM_FAPIAO',
      'user_apply_message' => '用户留言',
    ],
    'fapiao_information' => [
      'fapiao_id'                   => '20200701123456',
      'total_amount'                => 382895,
      'items'                       => [[
        'tax_code'                 => '3010101020203000000',
        'goods_name'               => '出租汽车客运服务',
        'specification'            => 'A4',
        'unit'                     => '次',
        'quantity'                 => 100000000,
        'total_amount'             => 429900,
        'tax_rate'                 => 1300,
        'discount'                 => true,
        'preferential_policy_code' => 1,
      ],],
      'export_business_policy_code' => 1,
      'vat_refund_levy_code'        => 1,
      'billing_person_id'           => '128279891283',
      'billing_person'              => 'example_billing_person',
      'fapiao_bill_type'            => 'COMM_FAPIAO',
      'transaction_information'     => [[
        'pay_channel'    => 'WECHAT_PAY',
        'transaction_id' => '4200000008202508080512076713',
        'out_trade_no'   => 'order_20200701_123456',
        'amount'         => 382895,
      ],],
      'remark'                      => '备注',
    ],
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r($response->getStatusCode() === 202);
返回字典类型描述
空字符串(无返回内容)

参阅 官方文档

Published on the GitHub by TheNorthMemory