接口文档· 更新于 2026-11-26
同步接口-全电红字信息表填开
POST
/openapi/invoice/hsy/allElectric/red/apply发票外部服务转发接口;上游原始路径:/hsy/allElectric/red/apply;来源 Controller:HsyController;上游鉴权:SignatureInterceptor:sign=MD5(appkey + 客户号/企业号 + timestamp),source 控制明密文
请求地址
生产环境
https://open.gch168.com/openapi/invoice/hsy/allElectric/red/apply- 请求方式
- POST
- 内容类型
- application/json
- 传输安全
- TLS 1.2 及以上
支持的鉴权方式
查看接入认证说明 →以下任一鉴权方式通过即可调用,签名细节与凭证获取请查看接入说明。
Header 签名(普通开放接口)API_KEY
通过 ApiKey、客户号或企业号识别租户,并对时间戳、随机串进行 MD5 签名校验,适用于绝大多数普通开放接口。
Sign = MD5(secretKey + timestamp + nonceStr),签名比较忽略大小写
请求头
公共请求头 →| 请求头 | 必填 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| appkey | 必填 | String | invoice-app-key | 调用方应用密钥,发票转发层读取该请求头做签名归属;Hsy/DirectNuoNuo 上游拦截器读取同名 Query 参数 |
| timestamp | 必填 | String | 1710000000000 | 请求时间戳,5 分钟内有效,发票转发层读取该请求头做签名归属;Hsy/DirectNuoNuo 上游拦截器读取同名 Query 参数 |
| sign | 必填 | String |
请求参数
| 参数名 | 位置 | 类型 | 必填 | 示例值 | 说明 |
|---|---|---|---|---|---|
appkey | QUERY | String | 必填 | invoice-app-key | 调用方应用密钥,Hsy/DirectNuoNuo 上游 SignatureInterceptor 读取该 Query 参数 |
timestamp | QUERY | String | 必填 | 1710000000000 | 请求时间戳,5 分钟内有效,Hsy/DirectNuoNuo 上游 SignatureInterceptor 读取该 Query 参数 |
param | BODY | String | 必填 | {"accessKey":"accessKeyValue","secretKey":"secretKeyValue","xSerialToken":"xSerialTokenValue","xRegisterIdToken":"xRegisterIdTokenValue","userTax":"91330000123456789X","taxNoType":"91330000123456789X","invoiceNo":"invoiceNoValue","invoiceCode":"invoiceCodeValue","invoiceType":1,"reason":"reasonValue"} | 发票服务拦截器读取的业务参数;source=pb 时为明文 JSON 字符串,其他来源为 AES 密文。子级为解密后的业务 JSON 字段。 |
accessKey | BODY | String | 选填 | accessKeyValue | 令牌,自己处理得到的token @NotEmpty(message = "令牌不能为空") @JSONField(serialize = false) private String xAccessToken; /** * ISV token调用接口时为必填,填写内容为操作公司的税号 */ @JSONField(serialize = false) private String xTaxToken; 对应X-Access-Token;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
secretKey | BODY | String | 选填 | secretKeyValue | secretKey;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
xSerialToken | BODY | String | 选填 | xSerialTokenValue | 流水号,您可根据自己实际需求选填该信息,若填写则接口及回调将在serialNo字段返回该参数;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
xRegisterIdToken | BODY | String | 选填 | xRegisterIdTokenValue | 登记信息身份证号,指定操作人员,ISV 级别密钥支持传入指定数电账户;@JSONField(serialize=false),上游用于内部转换或请求头映射 |
userTax | BODY | String | 选填 | 91330000123456789X | 用户税号--额外字段,必传,对应X-Tax-Token @NotEmpty(message = "商户税号不能为空");@JSONField(serialize=false),上游用于内部转换或请求头映射 |
taxNoType | BODY | String | 必填 | 91330000123456789X | 录入方身份 01-销方 02-购方 |
invoiceNo | BODY | String | 必填 | invoiceNoValue | 发票号码 |
invoiceCode | BODY | String | 选填 | invoiceCodeValue | invoiceCode |
invoiceType | BODY | Integer | 必填 | 1 | 发票类型 7 全电发票(普通发票), 8 全电发票(专用发票) |
reason | BODY | String | 必填 | reasonValue | 红冲原因 03-开票有误 04-销货退回 05-销售折让 06-应税服务中止 |
sellerTaxNo | BODY | String | 选填 | 91330000123456789X | 购方申请时该参数为必填 |
purchaserTaxNo | BODY | String | 选填 | 91330000123456789X | 购方申请时该参数为必填 |
drewDate | BODY | String | 选填 | 2026-05-27 12:00:00 | 购方申请时该参数为必填 格式 yyyy-MM-dd HH:mm:ss 注意,填写蓝票开票时间时必须精确到秒,否则无法正确填开红字信息表 |
响应参数
业务成功时返回 code = 200,其余状态码见下方接口状态码与全局状态码。
| 字段名 | 类型 | 示例值 | 说明 |
|---|---|---|---|
code | Integer | 200 | 业务响应码 |
msg | String | success | 响应消息 |
data | Object | {"redApplicationId":"redApplicationIdValue","redApplicationNo":"redApplicationNoValue","makeInvoiceFlag":"makeInvoiceFlagValue","redInvoice":{"id":"idValue","error":"errorValue","settlementNo":"settlementNoValue","invoiceType":1,"invoiceStatus":1001,"billingType":1}} | 响应业务数据;source=pb 时为明文 JSON,非 pb 来源可能为 AES 加密字符串。子级为源码中可追踪到的业务字段。 |
redApplicationId | String | redApplicationIdValue | redApplicationId |
redApplicationNo | String | redApplicationNoValue | redApplicationNo |
makeInvoiceFlag | String | makeInvoiceFlagValue | makeInvoiceFlag |
redInvoice | Object | {} | redInvoice |
id | String | idValue | id |
error | String | errorValue | error |
settlementNo | String | settlementNoValue | settlementNo |
invoiceType | Integer | 1 | invoiceType |
invoiceStatus | Integer | 1001 | invoiceStatus |
billingType | Integer | 1 | billingType |
invoiceCode | String | invoiceCodeValue | invoiceCode |
invoiceNo | String | invoiceNoValue | invoiceNo |
sellerName | String | sellerNameValue | sellerName |
sellerTaxNo | String | 91330000123456789X | sellerTaxNo |
sellerNo | String | sellerNoValue | sellerNo |
sellerAddress | String | sellerAddressValue | sellerAddress |
sellerTel | String | sellerTelValue | sellerTel |
sellerBankName | String | sellerBankNameValue | sellerBankName |
sellerBankAccount | String | sellerBankAccountValue | sellerBankAccount |
purchaserName | String | purchaserNameValue | purchaserName |
purchaserTaxNo | String | 91330000123456789X | purchaserTaxNo |
purchaserAddress | String | purchaserAddressValue | purchaserAddress |
purchaserTel | String | purchaserTelValue | purchaserTel |
purchaserBankName | String | purchaserBankNameValue | purchaserBankName |
purchaserBankAccount | String | purchaserBankAccountValue | purchaserBankAccount |
purchaserEmail | String | purchaserEmailValue | purchaserEmail |
purchaserPhone | String | purchaserPhoneValue | purchaserPhone |
payee | String | payeeValue | payee |
reviewer | String | reviewerValue | reviewer |
drawer | String | drawerValue | drawer |
amount | Number | 100.00 | amount |
amountWithTax | Number | 100.00 | amountWithTax |
taxAmount | Number | 100.00 | taxAmount |
invoiceDrewDate | String | 2026-05-27 12:00:00 | private Date drewDate; |
redApplicationNo | String | redApplicationNoValue | redApplicationNo |
oldInvoiceCode | String | oldInvoiceCodeValue | oldInvoiceCode |
oldInvoiceNo | String | oldInvoiceNoValue | oldInvoiceNo |
remark | String | remarkValue | remark |
ciphertext | String | ciphertextValue | ciphertext |
createUserName | String | createUserNameValue | createUserName |
pdfUrl | String | pdfUrlValue | pdfUrl |
ofdUrl | String | ofdUrlValue | ofdUrl |
viewUrl | String | viewUrlValue | viewUrl |
xmlUrl | String | xmlUrlValue | xmlUrl |
emailStatus | Integer | 1001 | emailStatus |
phoneStatus | Integer | 1001 | phoneStatus |
signStatus | Integer | 1001 | signStatus |
exten1 | String | exten1Value | private Object logisticsFlag; |
exten2 | String | exten2Value | exten2 |
exten3 | String | exten3Value | exten3 |
exten4 | String | exten4Value | exten4 |
exten5 | String | exten5Value | exten5 |
exten6 | String | exten6Value | exten6 |
exten7 | String | exten7Value | exten7 |
exten8 | String | exten8Value | exten8 |
exten9 | String | exten9Value | exten9 |
exten10 | String | exten10Value | exten10 |
elementCode | String | elementCodeValue | elementCode |
specificElements | Array | [] | specificElements |
elementExt1 | String | elementExt1Value | elementExt1 |
elementExt2 | String | elementExt2Value | elementExt2 |
elementExt3 | String | elementExt3Value | elementExt3 |
elementExt4 | String | elementExt4Value | elementExt4 |
elementExt5 | String | elementExt5Value | elementExt5 |
elementExt6 | String | elementExt6Value | elementExt6 |
elementExt7 | String | elementExt7Value | elementExt7 |
elementExt8 | String | elementExt8Value | elementExt8 |
elementExt9 | String | elementExt9Value | elementExt9 |
elementExt10 | String | elementExt10Value | elementExt10 |
detailList | Array | [] | detailList |
id | Integer | 1001 | id |
goodsName | String | goodsNameValue | goodsName |
goodsCode | String | goodsCodeValue | goodsCode |
shortName | String | shortNameValue | shortName |
categoryName | String | categoryNameValue | categoryName |
revenueCode | String | revenueCodeValue | revenueCode |
specification | String | specificationValue | specification |
unit | String | unitValue | unit |
unitPrice | Number | 100.00 | unitPrice |
quantity | Number | 100.00 | quantity |
taxRate | Number | 100.00 | taxRate |
amount | Number | 100.00 | amount |
taxAmount | Number | 100.00 | taxAmount |
amountWithTax | Number | 100.00 | amountWithTax |
zeroTax | Integer | 1001 | zeroTax |
discountAmount | Number | 100.00 | discountAmount |
taxPre | Integer | 1001 | taxPre |
taxPreType | Integer | 1 | taxPreType |
taxSpecialType | String | 91330000123456789X | taxSpecialType |
deduction | Number | 100.00 | deduction |
invoiceLineType | Integer | 1 | invoiceLineType |
状态码
全局状态码 →| 状态码 | 说明 |
|---|---|
| 200 | 调用成功 |
请求与响应示例
请求示例
请求示例
POST /openapi/invoice/hsy/allElectric/red/apply?appkey=invoice-app-key×tamp=1710000000000
appkey: invoice-app-key
timestamp: 1710000000000
sign: A1234567890123456789012345678901
source: pb
{"param":"{\"accessKey\":\"accessKeyValue\",\"secretKey\":\"secretKeyValue\",\"xSerialToken\":\"xSerialTokenValue\",\"xRegisterIdToken\":\"xRegisterIdTokenValue\",\"userTax\":\"91330000123456789X\",\"taxNoType\":\"91330000123456789X\",\"invoiceNo\":\"invoiceNoValue\",\"invoiceCode\":\"invoiceCodeValue\",\"invoiceType\":1,\"reason\":\"reasonValue\"}"}
响应示例
响应示例
{
"code": 200,
"msg": "success",
"data": {
"redApplicationId": "redApplicationIdValue",
"redApplicationNo": "redApplicationNoValue",
"makeInvoiceFlag": "makeInvoiceFlagValue",
"redInvoice": {
"id": "idValue",
"error": "errorValue",
"settlementNo": "settlementNoValue",
"invoiceType": 1,
"invoiceStatus": 1001,
"billingType": 1
}
}
}