电子发票

更新时间:2024-04-19 14:49:21

1.0 设置企业开票信息

  • URL:/invoice/saveInvoiceConfig
  • Method:POST
参数名称 类型 长度 必填 说明
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 流水号
taxpayer_no String 32 Y 纳税人识别号
address String 32 Y 地址
phone String 11 Y 电话
card_bank String 32 Y 开户行名称
card_no String 32 Y 开户行账号
payee String 10 Y 收款人
reviewer String 10 Y 复核人
drawer String 12 Y 开票人
key_sign String 32 N 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为请求参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01
成功 ,02
失败,响应码仅代表通信状态,不代表业务结果
result_code String 2 N 业务处理状态码
return_msg String 128 N 返回信息
trace_no String 32 N 请求流水号
key_sign String 32 N 签名

以上为响应参数

1.1 商品信息拉取(仅支持百旺)

  • URL:/invoice/goodsNotify
  • Method:POST
  • 备注: [税盘商品信息新增/修改后才需要调用]
参数名称 类型 长度 必填 说明
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 流水号
key_sign String 32 Y 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为请求参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01
成功 ,02
失败,响应码仅代表通信状态,不代表业务结果
return_msg String 128 Y 返回信息提示,“同步成功”,“请求受限”等
result_code String 2 N 业务结果:01
成功 ,02
失败
trace_no String 40 N 商户名称
key_sign String 32 Y 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为响应参数

1.2 查询商品列表

  • URL:/invoice/queryGoods
  • Method:POST
参数名称 类型 长度 必填 说明
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 流水号
current_pageid int 8 Y 页码:初始值为0
key_sign String 32 Y 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为请求参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01
成功 ,02
失败,响应码仅代表通信状态,不代表业务结果
return_msg String 128 Y 返回信息提示,“同步成功”,“请求受限”等
result_code String 2 N 业务结果:01
成功 ,02
失败
trace_no String 40 N 商户名称
current_pageid int 8 Y 页码:初始值为0
count String 256 Y 总条数
goods_list String 2048 Y 商品信息
key_sign String 32 Y 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为响应参数

商品信息对象参数(goodsList)

参数名称 类型 长度 必填 说明
goods_name String 32 Y 商品名称
goods_code String 8 Y 商品编码
total_fee String 11 Y 价税总计金额 (分)
tax_rate String 8 Y 税率 千分比

1.3 默认商品设置

  • URL:/invoice/goodsConfig
  • Method:POST
参数名称 类型 长度 必填 说明
api_ver String 3 Y 版本号(默认200)
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 流水号
config_type String 2 Y 设置类型:0.默认商品
goodscode String 128 Y 商品代码数组,设置默认商品
key_sign String 32 Y 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为请求参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01
成功 ,02
失败,响应码仅代表通信状态,不代表业务结果
return_msg String 128 Y 返回信息提示,“名称重复”,“请求受限”等
result_code String 2 N 业务结果:01
成功 ,02
失败
trace_no String 32 N 请求流水号
key_sign String 32 Y 签名字符串,拼装所有传递参数(字典序)+令牌,UTF-8编码,32位md5加密转换

以上为响应参数

1.4 自主开票接口

  • URL:invoice/quickFinishInvoice
  • Method:POST
参数名称 类型 长度 必填 说明
api_ver String 3 Y 版本号(默认200)
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 流水号
out_trade_no String 32 N 扫呗订单号,和issue_total_fee不能同时为空(备注:商品信息不为空时,商品价税总金额<=订单总金额)
issue_total_fee String 11 N 开票总金额(备注:传值后开票金额=issue_total_fee且商品价税总金额<=issue_total_fee)
invoice_type String 2 Y 发票类型 1:增值税专用发票,2:增值税普通发票,3:增值税电子发票,4:增值税专用发票电子发票
purchase_name String 15 Y 购货单位名称
purchase_no String 15 N 购货单位识别号, 如果不为空必须为15-20位,数字或大写字母
purchase_addressphone String 15 N 购货单位地址电话
purchase_cardinfo String 15 N 购货单位银行帐号
mobile_phone String 11 N 手机号和邮箱不能同时为空
email String 30 N 手机号和邮箱不能同时为空
goodsList List 1024 Y 商品信息
notify_url String 128 N 成功开票后回通过该地址通知调用方
remarks String 100 N 发票备注
key_sign String 32 Y 传参字典序后,拼接令牌(access_token)再MD5加密
  • 当api_ver = 200时,参与签名的字段:merchant_no,terminal_id,trace_no,out_trade_no,issue_total_fee,goodsList,notify_url,remarks(有值时参与签名)

商品信息对象参数(goodsList)

参数名称 类型 长度 必填 说明
goods_name String 15 Y 商品名称
goods_code String 8 Y 商品编码
total_fee String 32 Y 价税总计金额 (分)
tax_rate String 32 Y 税率 小数点最多 3位
tax_policy String 1 N 税收政策,0或者不传:正常税率,1免税
model String 32 N 商品规格
num String 12 Y 商品数量(最大支持包括小数点在内12位)
unit String 10 N 计量单位
price String 11 Y 商品单价(分)
include_tax int 1 Y 金额是否含税,0含税,1不含税
discount String N 32 折扣金额(分)

返回参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01成功
return_msg String 128 Y 返回信息提示,“查询成功”,“请求受限”等
result_code String 2 N 业务结果,01成功,表示开票成功;02失败,表示开票失败
merchant_no String 15 N 商户号
trace_no String 32 Y 流水号
invoice_serino String 32 N 开票流水号

1.5 负数开票(冲红)接口

  • URL:invoice/redInvoice
  • Method:POST
参数名称 类型 长度 必填 说明
api_ver String 3 Y 版本号
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 请求终端流水号
invoice_code String 32 N 待冲红的发票代码
invoice_num String 32 N 待冲红的发票号码
blue_invoice_serino String 30 Y 待冲红的开票流水号
notify_url String 128 N 成功开票后回通过该地址通知调用方
key_sign String 32 Y 传参字典序后,拼接令牌(access_token)再MD5加密

返回参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01成功
return_msg String 128 Y 返回信息提示,“请求成功”,“请求受限”等
result_code String 2 N 业务结果,01成功,表示开票成功;02失败,表示开票失败
merchant_no String 15 N 商户号
trace_no String 32 Y 流水号
red_invoice_serino String 32 N 负数开票流水号

1.6 发票作废接口

  • URL:invoice/invalidInvoice
  • Method:POST
  • 备注: f_invoice_tradeserial_xw 数据表 issue_status 新增 3 :发票作废 标识位
参数名称 类型 长度 必填 说明
api_ver String 3 Y 版本号
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 请求终端流水号
invoice_code String 32 N 待作废的发票代码
invoice_num String 32 N 待作废的发票号码
blue_invoice_serino String 30 Y 待作废的开票流水号
notify_url String 128 N 作废成功后回通过该地址通知调用方
key_sign String 32 Y 传参字典序后,拼接令牌(access_token)再MD5加密

返回参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01成功
return_msg String 128 Y 返回信息提示,“查询成功”,“请求受限”等
result_code String 2 N 业务结果,01成功,表示作废成功;02失败,表示作废失败
merchant_no String 15 N 商户号
trace_no String 32 Y 流水号
invalid_invoice_serino String 32 N 作废的开票流水号

1.7 发票查询

  • URL:/invoice/queryInvoice
  • Method:POST
参数名称 类型 长度 必填 说明
merchant_no String 15 Y 商户号
terminal_id String 8 Y 终端号
trace_no String 32 Y 请求终端流水号
invoice_code String 32 N 发票代码;发票代码/发票号码/开票流水号 不能同时为空
invoice_num String 32 N 发票号码;发票代码/发票号码/开票流水号 不能同时为空
invoice_serino String 32 N 开票流水号;发票代码/发票号码/开票流水号 不能同时为空
key_sign String 32 Y 传参字典序后,拼接令牌(access_token)再MD5加密

返回参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:01成功
return_msg String 128 Y 返回信息提示,“请求成功”,“请求受限”等
result_code String 2 N 业务结果,01成功,表示开票成功;02失败,表示开票失败
merchant_no String 15 N 商户号
trace_no String 32 Y 流水号
invoice_num String 32 N 发票号码
out_trade_no String 32 N 扫呗交易订单号
issue_status String 2 Y 开票状态0未开票,1开票成功
invoice_type String 2 Y 开票类型:0:正数票开具1:负数票开具
purchase_no String 20 N 购货单位识别号, 如果不为空必须为15-20位,数字或大写字母
purchase_name String 100 N 购货单位名称
purchase_address String 100 N 购货单位银行帐号
purchase_cardinfo String 11 Y 价税合计总金额(分)
invoice_serino String 30 Y 开票流水号
file_url String 200 N 发票文件下载链接
goodsList String 1024 Y 商品信息
key_sign String 32 Y 签名

商品信息对象参数(goodsList)

参数名称 类型 长度 必填 说明
goods_name String 32 Y 商品名称
goods_code String 8 Y 商品编码
total_fee String 11 Y 价税总计金额 (分)
tax_rate String 8 Y 税率 千分比

1.8 回调通知

  • Method:POST
  • Content-Type:text/xml(文本格式接收后再转json)
参数名称 类型 长度 必填 说明
invoice_serino String 30 Y 开票流水号
issue_status String 2 Y 开票状态 0 失败,1成功
business_type String 2 Y 业务类型 : "1" : 正数开票 "2" : 负数开票 "3" : 发票作废
invoice_code String 32 N 发票代码
invoice_num String 32 N 发票号码
purchase_no String 20 N 购货单位识别号, 如果不为空必须为15-20位,数字或大写字母
purchase_name String 100 N 购货单位名称
purchase_address String 100 N 购货单位地址电话
purchase_cardinfo String 100 N 购货单位银行帐号
issue_total_fee String 11 N 价税合计总金额(分)
tax_fee String 11 N 总税额(分)

以上为推送的参数

参数名称 类型 长度 必填 说明
return_code String 2 Y 响应码:
01 成功 ,
02 失败
return_msg String 128 Y 返回信息提示,“签名失败”,“参数格式校验错误"等

以上为需要返回的参数 ,格式为json: {"return_code":"01","return_msg":"success"}


© 利楚商服 2020 All rights reserved.