cURL
curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--data '
{
"bill_amount": "20.00",
"bill_code": "51060123",
"bill_date": "20230411",
"bill_no": "0272000001",
"check_code": "7ffdbe",
"id_card_last6": "083411",
"mode": "detail",
"payer_name": "张某某"
}
'import requests
url = "https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify"
payload = {
"bill_amount": "20.00",
"bill_code": "51060123",
"bill_date": "20230411",
"bill_no": "0272000001",
"check_code": "7ffdbe",
"id_card_last6": "083411",
"mode": "detail",
"payer_name": "张某某"
}
headers = {
"x-ti-app-id": "<x-ti-app-id>",
"x-ti-secret-code": "<x-ti-secret-code>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<x-ti-app-id>',
'x-ti-secret-code': '<x-ti-secret-code>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
bill_amount: '20.00',
bill_code: '51060123',
bill_date: '20230411',
bill_no: '0272000001',
check_code: '7ffdbe',
id_card_last6: '083411',
mode: 'detail',
payer_name: '张某某'
})
};
fetch('https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bill_amount' => '20.00',
'bill_code' => '51060123',
'bill_date' => '20230411',
'bill_no' => '0272000001',
'check_code' => '7ffdbe',
'id_card_last6' => '083411',
'mode' => 'detail',
'payer_name' => '张某某'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ti-app-id: <x-ti-app-id>",
"x-ti-secret-code: <x-ti-secret-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify"
payload := strings.NewReader("{\n \"bill_amount\": \"20.00\",\n \"bill_code\": \"51060123\",\n \"bill_date\": \"20230411\",\n \"bill_no\": \"0272000001\",\n \"check_code\": \"7ffdbe\",\n \"id_card_last6\": \"083411\",\n \"mode\": \"detail\",\n \"payer_name\": \"张某某\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<x-ti-app-id>")
req.Header.Add("x-ti-secret-code", "<x-ti-secret-code>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify")
.header("x-ti-app-id", "<x-ti-app-id>")
.header("x-ti-secret-code", "<x-ti-secret-code>")
.header("Content-Type", "application/json")
.body("{\n \"bill_amount\": \"20.00\",\n \"bill_code\": \"51060123\",\n \"bill_date\": \"20230411\",\n \"bill_no\": \"0272000001\",\n \"check_code\": \"7ffdbe\",\n \"id_card_last6\": \"083411\",\n \"mode\": \"detail\",\n \"payer_name\": \"张某某\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<x-ti-app-id>'
request["x-ti-secret-code"] = '<x-ti-secret-code>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bill_amount\": \"20.00\",\n \"bill_code\": \"51060123\",\n \"bill_date\": \"20230411\",\n \"bill_no\": \"0272000001\",\n \"check_code\": \"7ffdbe\",\n \"id_card_last6\": \"083411\",\n \"mode\": \"detail\",\n \"payer_name\": \"张某某\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"result": {
"accounting_status": "",
"bill_code": "51060123",
"bill_date": "2023-04-11",
"bill_name": "四川省医疗门诊收费票据(电子)",
"bill_no": "0272000001",
"bill_status": "01",
"check_code": "7ffdbe",
"code": 1000,
"collector": "工行自助机",
"file_type": "pdf",
"file_url": "http://example.com/archive/xxxxx.pdf",
"fiscal_seal": "",
"fiscal_seal_no": "",
"item_details": [
{
"amount": "1.0000",
"code": "",
"index": 1,
"name": "●挂号费",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "1.0",
"remark": "",
"standard": "",
"type": "",
"unit": "次"
},
{
"amount": "19.0000",
"code": "",
"index": 2,
"name": "材料费",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "1.0",
"remark": "",
"standard": "",
"type": "",
"unit": "次"
}
],
"item_list": [
{
"amount": "1.00",
"code": "",
"index": 1,
"name": "挂号费",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "",
"remark": "",
"standard": "",
"type": "",
"unit": ""
},
{
"amount": "19.00",
"code": "",
"index": 2,
"name": "其他门急诊收费项目",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "",
"remark": "",
"standard": "",
"type": "",
"unit": ""
}
],
"message": "处理成功",
"other_info": [
{
"en_value": "",
"key": "ywlsh",
"label": "业务流水号",
"value": "MZ20230411XXXXXXXX"
},
{
"en_value": "",
"key": "mzh",
"label": "门诊号",
"value": "23031500000"
},
{
"en_value": "",
"key": "jzrq",
"label": "就诊日期",
"value": "20230411"
},
{
"en_value": "",
"key": "yljglx",
"label": "医疗机构类型",
"value": "中医医院"
},
{
"en_value": "",
"key": "yblx",
"label": "医保类型",
"value": ""
},
{
"en_value": "",
"key": "grxjzf",
"label": "个人现金支付",
"value": "20.00"
}
],
"payee": "某某骨科医院",
"payer": "张某某",
"payer_tax_id": "513124********3411",
"print_status": "",
"query_count": 1,
"remark": "",
"reviewer": "工行自助机",
"supplementary_info": "",
"time": "2026-05-06 11:47:17",
"total_amount": "20.00",
"total_amount_cn": "贰拾元整",
"void_date": "",
"void_reason": "",
"void_time": ""
}
},
"message": "OK"
}发票验真
发票验真(财政票)
财政票据验真。直接调用底层验真 API,同步返回结果。支持医疗门诊/住院收费电子票据等财政票据。
mode 查验模式说明:
-
national:全国版,走财政部全国网站查验,速度快,部分票据可能无明细,仅支持开票时间在一年内的电子票据
-
detail:明细版,根据是否传入 id_card_last6 + payer_name 自动判断:两者都传则走地方版(各地区网站);未传齐则走全国明细版(先全国再地方,确保返回明细)
默认 “national”
POST
/
doc-agent
/
api
/
v1
/
capability
/
fiscal-bill
/
verify
cURL
curl --request POST \
--url https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify \
--header 'Content-Type: application/json' \
--header 'x-ti-app-id: <x-ti-app-id>' \
--header 'x-ti-secret-code: <x-ti-secret-code>' \
--data '
{
"bill_amount": "20.00",
"bill_code": "51060123",
"bill_date": "20230411",
"bill_no": "0272000001",
"check_code": "7ffdbe",
"id_card_last6": "083411",
"mode": "detail",
"payer_name": "张某某"
}
'import requests
url = "https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify"
payload = {
"bill_amount": "20.00",
"bill_code": "51060123",
"bill_date": "20230411",
"bill_no": "0272000001",
"check_code": "7ffdbe",
"id_card_last6": "083411",
"mode": "detail",
"payer_name": "张某某"
}
headers = {
"x-ti-app-id": "<x-ti-app-id>",
"x-ti-secret-code": "<x-ti-secret-code>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-ti-app-id': '<x-ti-app-id>',
'x-ti-secret-code': '<x-ti-secret-code>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
bill_amount: '20.00',
bill_code: '51060123',
bill_date: '20230411',
bill_no: '0272000001',
check_code: '7ffdbe',
id_card_last6: '083411',
mode: 'detail',
payer_name: '张某某'
})
};
fetch('https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'bill_amount' => '20.00',
'bill_code' => '51060123',
'bill_date' => '20230411',
'bill_no' => '0272000001',
'check_code' => '7ffdbe',
'id_card_last6' => '083411',
'mode' => 'detail',
'payer_name' => '张某某'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-ti-app-id: <x-ti-app-id>",
"x-ti-secret-code: <x-ti-secret-code>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify"
payload := strings.NewReader("{\n \"bill_amount\": \"20.00\",\n \"bill_code\": \"51060123\",\n \"bill_date\": \"20230411\",\n \"bill_no\": \"0272000001\",\n \"check_code\": \"7ffdbe\",\n \"id_card_last6\": \"083411\",\n \"mode\": \"detail\",\n \"payer_name\": \"张某某\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-ti-app-id", "<x-ti-app-id>")
req.Header.Add("x-ti-secret-code", "<x-ti-secret-code>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify")
.header("x-ti-app-id", "<x-ti-app-id>")
.header("x-ti-secret-code", "<x-ti-secret-code>")
.header("Content-Type", "application/json")
.body("{\n \"bill_amount\": \"20.00\",\n \"bill_code\": \"51060123\",\n \"bill_date\": \"20230411\",\n \"bill_no\": \"0272000001\",\n \"check_code\": \"7ffdbe\",\n \"id_card_last6\": \"083411\",\n \"mode\": \"detail\",\n \"payer_name\": \"张某某\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://agents.textin.com/doc-agent/api/v1/capability/fiscal-bill/verify")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-ti-app-id"] = '<x-ti-app-id>'
request["x-ti-secret-code"] = '<x-ti-secret-code>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"bill_amount\": \"20.00\",\n \"bill_code\": \"51060123\",\n \"bill_date\": \"20230411\",\n \"bill_no\": \"0272000001\",\n \"check_code\": \"7ffdbe\",\n \"id_card_last6\": \"083411\",\n \"mode\": \"detail\",\n \"payer_name\": \"张某某\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"data": {
"result": {
"accounting_status": "",
"bill_code": "51060123",
"bill_date": "2023-04-11",
"bill_name": "四川省医疗门诊收费票据(电子)",
"bill_no": "0272000001",
"bill_status": "01",
"check_code": "7ffdbe",
"code": 1000,
"collector": "工行自助机",
"file_type": "pdf",
"file_url": "http://example.com/archive/xxxxx.pdf",
"fiscal_seal": "",
"fiscal_seal_no": "",
"item_details": [
{
"amount": "1.0000",
"code": "",
"index": 1,
"name": "●挂号费",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "1.0",
"remark": "",
"standard": "",
"type": "",
"unit": "次"
},
{
"amount": "19.0000",
"code": "",
"index": 2,
"name": "材料费",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "1.0",
"remark": "",
"standard": "",
"type": "",
"unit": "次"
}
],
"item_list": [
{
"amount": "1.00",
"code": "",
"index": 1,
"name": "挂号费",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "",
"remark": "",
"standard": "",
"type": "",
"unit": ""
},
{
"amount": "19.00",
"code": "",
"index": 2,
"name": "其他门急诊收费项目",
"paid_amount": "",
"paid_amount_rate": "",
"quantity": "",
"remark": "",
"standard": "",
"type": "",
"unit": ""
}
],
"message": "处理成功",
"other_info": [
{
"en_value": "",
"key": "ywlsh",
"label": "业务流水号",
"value": "MZ20230411XXXXXXXX"
},
{
"en_value": "",
"key": "mzh",
"label": "门诊号",
"value": "23031500000"
},
{
"en_value": "",
"key": "jzrq",
"label": "就诊日期",
"value": "20230411"
},
{
"en_value": "",
"key": "yljglx",
"label": "医疗机构类型",
"value": "中医医院"
},
{
"en_value": "",
"key": "yblx",
"label": "医保类型",
"value": ""
},
{
"en_value": "",
"key": "grxjzf",
"label": "个人现金支付",
"value": "20.00"
}
],
"payee": "某某骨科医院",
"payer": "张某某",
"payer_tax_id": "513124********3411",
"print_status": "",
"query_count": 1,
"remark": "",
"reviewer": "工行自助机",
"supplementary_info": "",
"time": "2026-05-06 11:47:17",
"total_amount": "20.00",
"total_amount_cn": "贰拾元整",
"void_date": "",
"void_reason": "",
"void_time": ""
}
},
"message": "OK"
}财政电子票据验真错误码
响应中data.result.code 的含义如下:
| 错误码 | 说明 |
|---|---|
| 1000 | 成功 |
| 999 | 其它错误 |
| 1001 | 网站访问异常 |
| 1002 | 超出该张票据最大查验次数 |
| 1003 | 验证码错误 |
| 1006 | 未查询到当前发票数据 |
| 1007 | 当前地区维护中,请稍后 |
| 1008 | 开票日期超出范围,仅可查验最近一年内开具的电子票据 |
| 1009 | 局端请求异常 |
| 1010 | 税局服务异常,建议 15-20 分钟后重试 |
Body
application/json
票据金额
票据代码
开票日期(格式: yyyyMMdd,如 "20240226")
票据号码
校验码
身份证后六位(明细版中用于路由判断:传了则走地方版,部分地区票据必填)
查验模式:
- "national": 全国版,走财政部全国网站查验,速度快,部分票据可能无明细,仅支持开票时间在一年内的电子票据
- "detail": 明细版,根据是否传入 id_card_last6 + payer_name 自动判断走地方版或全国明细版 默认 "national"
交款人(明细版中用于路由判断:传了则走地方版,部分票据必填)
⌘I