开具电子发票
商户完成收款后,调用本接口开具电子发票并插入微信用户的卡包。若是非微信支付场景,需要先通过【获取抬头填写链接】接口获取抬头填写链接,并等待用户完成填写才能调用本接口;若是微信支付场景,则无需额外获取抬头填写链接。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
sub_mchid | string | 子商户号 |
scene | string | 开票场景 |
fapiao_apply_id | string | 发票申请单号 |
buyer_information | object | 购买方信息 |
type | string | 购买方类型 |
name | string | 名称 |
taxpayer_id | string | 纳税人识别号 |
address | string | 地址 |
telephone | string | 电话 |
bank_name | string | 开户银行 |
bank_account | string | 银行账号 |
phone | string | 手机号 |
string | 邮箱地址 | |
fapiao_information | object[] | 需要开具的发票信息 |
fapiao_id | string | 商户发票单号 |
total_amount | integer | 总价税合计 |
need_list | boolean | 是否以清单形式开具发票 |
remark | string | 发票备注 |
items | object[] | 发票行信息 |
tax_code | string | 税局侧规定的货物或应税劳务、服务税收分类编码 |
goods_category | string | 税局侧规定的货物或应税劳务、服务分类名称 |
goods_name | string | 货物或应税劳务、服务名称 |
goods_id | number | 企业侧维护的货物或应税劳务、服务编码 |
specification | string | 规格型号 |
unit | string | 单位 |
quantity | integer | 数量 |
total_amount | integer | 单行金额合计 |
tax_rate | number | 税率 |
tax_prefer_mark | string | 税收优惠政策标识 |
discount | boolean | 是否折扣行 |
headers | object | 声明请求的头参数 |
Wechatpay-Serial | string | 平台公钥ID/平台公钥证书序列号 |
php
$instance->v3->newTaxControlFapiao->fapiaoApplications->postAsync([
'json' => [
'sub_mchid' => '1900000109',
'scene' => 'WITH_WECHATPAY',
'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',
],
'fapiao_information' => [[
'fapiao_id' => '20200701123456',
'total_amount' => 382895,
'need_list' => true,
'remark' => '备注',
'items' => [[
'tax_code' => '3010101020203000000',
'goods_category' => '运输服务',
'goods_name' => '出租汽车客运服务',
'goods_id' => 1,
'specification' => 'A4',
'unit' => '次',
'quantity' => 100000000,
'total_amount' => 429900,
'tax_rate' => 1300,
'tax_prefer_mark' => 'NO_FAVORABLE',
'discount' => true,
],],
],],
],
'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')->postAsync([
'json' => [
'sub_mchid' => '1900000109',
'scene' => 'WITH_WECHATPAY',
'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',
],
'fapiao_information' => [[
'fapiao_id' => '20200701123456',
'total_amount' => 382895,
'need_list' => true,
'remark' => '备注',
'items' => [[
'tax_code' => '3010101020203000000',
'goods_category' => '运输服务',
'goods_name' => '出租汽车客运服务',
'goods_id' => 1,
'specification' => 'A4',
'unit' => '次',
'quantity' => 100000000,
'total_amount' => 429900,
'tax_rate' => 1300,
'tax_prefer_mark' => 'NO_FAVORABLE',
'discount' => true,
],],
],],
],
'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']->postAsync([
'json' => [
'sub_mchid' => '1900000109',
'scene' => 'WITH_WECHATPAY',
'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',
],
'fapiao_information' => [[
'fapiao_id' => '20200701123456',
'total_amount' => 382895,
'need_list' => true,
'remark' => '备注',
'items' => [[
'tax_code' => '3010101020203000000',
'goods_category' => '运输服务',
'goods_name' => '出租汽车客运服务',
'goods_id' => 1,
'specification' => 'A4',
'unit' => '次',
'quantity' => 100000000,
'total_amount' => 429900,
'tax_rate' => 1300,
'tax_prefer_mark' => 'NO_FAVORABLE',
'discount' => true,
],],
],],
],
'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->post([
'json' => [
'sub_mchid' => '1900000109',
'scene' => 'WITH_WECHATPAY',
'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',
],
'fapiao_information' => [[
'fapiao_id' => '20200701123456',
'total_amount' => 382895,
'need_list' => true,
'remark' => '备注',
'items' => [[
'tax_code' => '3010101020203000000',
'goods_category' => '运输服务',
'goods_name' => '出租汽车客运服务',
'goods_id' => 1,
'specification' => 'A4',
'unit' => '次',
'quantity' => 100000000,
'total_amount' => 429900,
'tax_rate' => 1300,
'tax_prefer_mark' => 'NO_FAVORABLE',
'discount' => true,
],],
],],
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r($response->getStatusCode() === 202);
php
$response = $instance->chain('v3/new-tax-control-fapiao/fapiao-applications')->post([
'json' => [
'sub_mchid' => '1900000109',
'scene' => 'WITH_WECHATPAY',
'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',
],
'fapiao_information' => [[
'fapiao_id' => '20200701123456',
'total_amount' => 382895,
'need_list' => true,
'remark' => '备注',
'items' => [[
'tax_code' => '3010101020203000000',
'goods_category' => '运输服务',
'goods_name' => '出租汽车客运服务',
'goods_id' => 1,
'specification' => 'A4',
'unit' => '次',
'quantity' => 100000000,
'total_amount' => 429900,
'tax_rate' => 1300,
'tax_prefer_mark' => 'NO_FAVORABLE',
'discount' => true,
],],
],],
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r($response->getStatusCode() === 202);
php
$response = $instance['v3/new-tax-control-fapiao/fapiao-applications']->post([
'json' => [
'sub_mchid' => '1900000109',
'scene' => 'WITH_WECHATPAY',
'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',
],
'fapiao_information' => [[
'fapiao_id' => '20200701123456',
'total_amount' => 382895,
'need_list' => true,
'remark' => '备注',
'items' => [[
'tax_code' => '3010101020203000000',
'goods_category' => '运输服务',
'goods_name' => '出租汽车客运服务',
'goods_id' => 1,
'specification' => 'A4',
'unit' => '次',
'quantity' => 100000000,
'total_amount' => 429900,
'tax_rate' => 1300,
'tax_prefer_mark' => 'NO_FAVORABLE',
'discount' => true,
],],
],],
],
'headers' => [
'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
],
]);
print_r($response->getStatusCode() === 202);
返回字典 | 类型 | 描述 |
---|
参阅 官方文档