接口文档· 更新于 2026-11-26
同步接口-全电红字信息表操作
POST
/openapi/invoice/hsy/allElectric/red/operation发票外部服务转发接口;上游原始路径:/hsy/allElectric/red/operation;来源 Controller:HsyController;上游鉴权:SignatureInterceptor:sign=MD5(appkey + 客户号/企业号 + timestamp),source 控制明密文
请求地址
生产环境
https://open.gch168.com/openapi/invoice/hsy/allElectric/red/operation- 请求方式
- 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","operationStatus":"operationStatusValue","redApplicationId":"redApplicationIdValue","sellerTaxNo":"91330000123456789X","operationPartyType":"operationPartyTypeValue","purchaserTaxNo":"91330000123456789X"} | 发票服务拦截器读取的业务参数;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),上游用于内部转换或请求头映射 |
operationStatus | BODY | String | 必填 | operationStatusValue | 红字操作状态 01-同意 02-不同意 03-撤销 注意:以下类型单据允许撤销 我作为销售方,由销售方录入且状态为待购方确认和无需确认; 我作为购买方,由购买方录入且状态为待销方确认和无需确认; 以下单据可以审批: 我作为购买方,由销售方录入且状态为待购方确认; 我作为销售方,由购买方录入且状态为待销方确认; |
redApplicationId | BODY | String | 必填 | redApplicationIdValue | 红字确认单uuid |
sellerTaxNo | BODY | String | 必填 | 91330000123456789X | 销售方税号 |
operationPartyType | BODY | String | 必填 | operationPartyTypeValue | 操作方身份 01-销方 02-购方 |
purchaserTaxNo | BODY | String | 选填 | 91330000123456789X | 购方税号 |
响应参数
业务成功时返回 code = 200,其余状态码见下方接口状态码与全局状态码。
| 字段名 | 类型 | 示例值 | 说明 |
|---|---|---|---|
code | Integer | 200 | 业务响应码 |
msg | String | success | 响应消息 |
data | Object | {"total":"totalValue","pages":"pagesValue","size":"sizeValue","current":"currentValue","records":[{"taxNoType":"91330000123456789X","sellerTaxNo":"91330000123456789X","sellerName":"sellerNameValue","invoiceType":"invoiceTypeValue","purchaserName":"purchaserNameValue","purchaserTaxNo":"91330000123456789X"}]} | 响应业务数据;source=pb 时为明文 JSON,非 pb 来源可能为 AES 加密字符串。子级为源码中可追踪到的业务字段。 |
total | String | totalValue | total |
pages | String | pagesValue | pages |
size | String | sizeValue | size |
current | String | currentValue | current |
records | Array | [] | records |
taxNoType | String | 91330000123456789X | taxNoType |
sellerTaxNo | String | 91330000123456789X | sellerTaxNo |
sellerName | String | sellerNameValue | sellerName |
invoiceType | String | invoiceTypeValue | invoiceType |
purchaserName | String | purchaserNameValue | purchaserName |
purchaserTaxNo | String | 91330000123456789X | purchaserTaxNo |
redTaxAmount | String | 91330000123456789X | redTaxAmount |
redAmount | String | redAmountValue | redAmount |
redAmountWithTax | String | 91330000123456789X | redAmountWithTax |
blueTaxAmount | String | 91330000123456789X | blueTaxAmount |
blueAmount | String | blueAmountValue | blueAmount |
blueAmountWithTax | String | 91330000123456789X | blueAmountWithTax |
invoiceNo | String | invoiceNoValue | invoiceNo |
blueDrewDate | String | 2026-05-27 12:00:00 | blueDrewDate |
status | String | statusValue | status |
reason | String | reasonValue | reason |
redInvoiceType | String | redInvoiceTypeValue | redInvoiceType |
redApplicationId | String | redApplicationIdValue | redApplicationId |
redInvoiceNo | String | redInvoiceNoValue | redInvoiceNo |
redDrewDate | String | 2026-05-27 12:00:00 | redDrewDate |
redApplicationNo | String | redApplicationNoValue | redApplicationNo |
applySource | String | applySourceValue | applySource |
状态码
全局状态码 →| 状态码 | 说明 |
|---|---|
| 200 | 调用成功 |
请求与响应示例
请求示例
请求示例
POST /openapi/invoice/hsy/allElectric/red/operation?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\",\"operationStatus\":\"operationStatusValue\",\"redApplicationId\":\"redApplicationIdValue\",\"sellerTaxNo\":\"91330000123456789X\",\"operationPartyType\":\"operationPartyTypeValue\",\"purchaserTaxNo\":\"91330000123456789X\"}"}
响应示例
响应示例
{
"code": 200,
"msg": "success",
"data": {
"total": "totalValue",
"pages": "pagesValue",
"size": "sizeValue",
"current": "currentValue",
"records": [
{
"taxNoType": "91330000123456789X",
"sellerTaxNo": "91330000123456789X",
"sellerName": "sellerNameValue",
"invoiceType": "invoiceTypeValue",
"purchaserName": "purchaserNameValue",
"purchaserTaxNo": "91330000123456789X"
}
]
}
}