区块链发票查验V2
<p>[TOC]</p>
<h3>接口描述</h3>
<ul>
<li>查验区块链发票是否真实</li>
<li>支持深圳、北京、云南</li>
</ul>
<h3>请求说明</h3>
<h4>请求地址</h4>
<p><code>https://api.jumdata.com/invoice/validate/blockchain/v2</code></p>
<h4>请求方式</h4>
<ul>
<li>GET/POST</li>
</ul>
<h4>请求格式</h4>
<ul>
<li>x-www-form-urlencoded</li>
</ul>
<h4>请求参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:400px">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>appId</td>
<td>String</td>
<td>是</td>
<td>服务商分配的唯一标识</td>
</tr>
<tr>
<td>timestamp</td>
<td>Long</td>
<td>是</td>
<td>当前时间戳</td>
</tr>
<tr>
<td>sign</td>
<td>String</td>
<td>是</td>
<td>签名,详见签名算法说明</td>
</tr>
<tr>
<td>fpdm</td>
<td>String</td>
<td>是</td>
<td>发票代码</td>
</tr>
<tr>
<td>fphm</td>
<td>String</td>
<td>是</td>
<td>发票号码</td>
</tr>
<tr>
<td>dq</td>
<td>String</td>
<td>-</td>
<td>地区 深圳:4403,北京:1100,云南:5300 默认:4403-深圳</td>
</tr>
<tr>
<td>xfsbh</td>
<td>String</td>
<td>-</td>
<td>销售方识别号 深圳、云南必填</td>
</tr>
<tr>
<td>jym</td>
<td>String</td>
<td>是</td>
<td>校验码</td>
</tr>
</tbody>
</table>
<h4>签名算法说明</h4>
<p><code>sign = sha256(appId + appSecret + timestamp)</code></p>
<p>用服务商分配的 appId、服务商分配的 appSecret,当前时间时间戳 timestamp,按上述顺序拼接成字符串,再进行 sha256 哈希得到。如下:</p>
<pre><code class="language-java">String appId = &quot;xyzxy2121zxyz&quot;;
String timestamp = &quot;1555378976238&quot;;
String appSecret = &quot;efcefcef1121cefcefc1212121&quot;;
String str = appId + appSecret + timestamp;
String sign = sha256(str);</code></pre>
<h3>返回说明</h3>
<h4>成功返回样例</h4>
<h5>深圳 - 使用校验码</h5>
<pre><code class="language-json">{
&quot;code&quot;: 200, // 返回码,详见code返回码说明
&quot;msg&quot;: &quot;成功&quot;, //code对应的描述
&quot;taskNo&quot;: &quot;12552230716560623515&quot;, // 本次唯一请求号
&quot;charge&quot;: true, // 计费标志
&quot;data&quot;: {
&quot;fpdm&quot;: &quot;1440318091**&quot;, // 发票代码
&quot;fphm&quot;: &quot;000000**&quot;, // 发票号码
&quot;kprq&quot;: &quot;2018-08-10 00:10:07&quot;, // 开票日期
&quot;xfsbh&quot;: &quot;9144030073884274**&quot;, // 销售方识别号
&quot;xfmc&quot;: &quot;深圳市XX有限公司&quot;, // 销售方名称
&quot;gfmc&quot;: &quot;深圳XX服务有限公司&quot;, // 购买方名称
&quot;jshj&quot;: 198.00, // 价税合计
&quot;fpzt&quot;: &quot;1&quot;, // 发票状态,1-已开票 2-已打印 3-已收票 4-已报销 5-已冲红 6-已登记异常 7-已标记销毁 8-已回退
&quot;yczt&quot;: &quot;0&quot; // 异常状态,1-异常发票 0-正常发票
}
}</code></pre>
<h5>北京</h5>
<pre><code class="language-json">{
&quot;code&quot;: 200, // 返回码,详见code返回码说明
&quot;msg&quot;: &quot;成功&quot;, //code对应的描述
&quot;taskNo&quot;: &quot;12552230716560623515&quot;, // 本次唯一请求号
&quot;charge&quot;: true, // 计费标志
&quot;data&quot;: {
&quot;kprq&quot;: &quot;2020-03-03 00:00:00&quot;, // 开票日期
&quot;fpdm&quot;: &quot;1110020091**&quot;, // 发票代码
&quot;fphm&quot;: &quot;000000**&quot;, // 发票号码
&quot;xfmc&quot;: &quot;北京XX有限公司&quot;, // 销售方名称
&quot;yczt&quot;: &quot;0&quot; // 异常状态,1-异常发票 0-正常发票
}
}</code></pre>
<h5>云南</h5>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;12552230716560623515&quot;,
&quot;charge&quot;: true,
&quot;data&quot;: {
&quot;xfsbh&quot;:&quot;9153**********8312&quot;, //销方识别号
&quot;gfmc&quot;:&quot;昆明地铁****公司&quot;, //购方名称
&quot;dq&quot;:&quot;云南&quot;, //地区
&quot;kprq&quot;:&quot;2020-03-20 13:47:46&quot;, //开票日期
&quot;kjlx&quot;:&quot;1&quot;, //开具类型
&quot;fpdm&quot;:&quot;1530****0382&quot;, //发票代码
&quot;fplx&quot;:&quot;100&quot;, //发票类型
&quot;fpzt&quot;:&quot;5&quot;, //发票状态
&quot;jshj&quot;:2, //价税合计
&quot;xfmc&quot;:&quot;昆明轨道交通集团有限公司&quot;, //销方名称
&quot;yczt&quot;:&quot;0&quot;, //异常状态
&quot;fphm&quot;:&quot;00****47&quot;, //发票号码
&quot;jym&quot;:&quot;1459d&quot; //校验码
}
}</code></pre>
<h4>查无此票返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 201,
&quot;msg&quot;: &quot;查无此票&quot;,
&quot;taskNo&quot;: &quot;12552230716560623515&quot;,
&quot;charge&quot;: true
}</code></pre>
<h4>不一致返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 202,
&quot;msg&quot;: &quot;不一致&quot;,
&quot;taskNo&quot;: &quot;12552230716560623515&quot;,
&quot;charge&quot;: true
}
}
</code></pre>
<h4>失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 400,
&quot;msg&quot;: &quot;发票编号不能为空&quot;,
&quot;charge&quot;: false
}</code></pre>
<h4>code返回码说明</h4>
<p><a href="https://www.showdoc.com.cn/p/ec82c9f1cb47cd306fea5b700d3ca953#code返回码说明">code返回码说明</a></p>