通用电子发票查验
<p>[TOC]</p>
<h3>接口描述</h3>
<ul>
<li>查验通用电子发票是否真实</li>
<li>目前支持浙江、广东</li>
<li>每张发票每天最多可查验5次</li>
</ul>
<h3>请求说明</h3>
<h4>请求地址</h4>
<p><code>https://api.jumdata.com/invoice/validate/general-electronic</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>kprq</td>
<td>String</td>
<td>是</td>
<td>开票日期 格式yyyy-MM-dd / yyyyMMdd</td>
</tr>
<tr>
<td>xfsbh</td>
<td>String</td>
<td>是</td>
<td>销方识别号</td>
</tr>
<tr>
<td>jshj</td>
<td>String</td>
<td>是</td>
<td>价税合计</td>
</tr>
<tr>
<td>dq</td>
<td>String</td>
<td>是</td>
<td>地区代码 广东-4400 浙江-3300</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>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;180178417212511371125593&quot;,
&quot;charge&quot;: true,
&quot;data&quot;: {
&quot;xfsbh&quot;: &quot;9233********C205&quot;, //销方识别号
&quot;gfsbh&quot;: &quot;9137********3311&quot;, //购方识别号
&quot;fpdm&quot;: &quot;23********3111&quot;, //发票代码
&quot;gfmc&quot;: &quot;山东********科技有限公司 &quot;, //购方名称
&quot;fplx&quot;: &quot;102&quot;, //发票类型 见发票类型
&quot;dq&quot;: &quot;浙江&quot;, //地区
&quot;fpzt&quot;: &quot;0&quot;, //发票状态 0正常 2作废 3已红冲 7部分红冲 8全额红冲
&quot;kprq&quot;: &quot;2023-03-22&quot;, //开票日期
&quot;kjlx&quot;: &quot;1&quot;, //开具类型 1自开 2代开
&quot;jshj&quot;: &quot;91.14&quot;, //价税合计
&quot;xfmc&quot;: &quot;绍兴******产品厂&quot;, //销方名称
&quot;fplbmc&quot;: &quot;电子发票&quot;, //发票类别名称
&quot;fphm&quot;: &quot;67****59&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,
&quot;data&quot;: {
&quot;fplx&quot;: &quot;102&quot;
}
}</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,
&quot;data&quot;: {
&quot;fplx&quot;: &quot;102&quot;
}
}
</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>