税局登录
<p>[TOC]</p>
<h3>1 接口调用说明</h3>
<h4>1.1 请求方式</h4>
<p>如接口没有单独说明,所有接口均为:<strong>POST</strong></p>
<h4>1.2 请求格式</h4>
<p>如接口没有单独说明,所有接口均为:<strong>application/x-www-form-urlencoded</strong></p>
<h4>1.3 请求参数</h4>
<p>请求参数包括公共参数和业务参数(业务参数见具体接口说明)
调用接口时,需要把<strong>公共参数</strong>和<strong>业务参数</strong>一并放在<strong>请求参数</strong>中提交</p>
<h5>1.3.1 公共请求参数</h5>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</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>签名,详见<a href="#签名算法">签名算法说明</a></td>
</tr>
</tbody>
</table>
<p><a name="签名算法"></a></p>
<h5>1.3.2 签名算法说明</h5>
<pre><code>sign = sha256(appId + appSecret + timestamp)</code></pre>
<p>用服务商分配的 <strong>appId</strong>、服务商分配的 <strong>appSecret</strong>,当前时间戳(毫秒) <strong>timestamp</strong>,按上述顺序拼接成字符串,再进行 <strong>sha256</strong> 哈希得到。如下:</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>
<h4>1.4 返回说明</h4>
<h5>1.4.1 公共返回字段说明</h5>
<p>所有接口均返回以下公共字段:</p>
<table>
<thead>
<tr>
<th>字段名</th>
<th><div style="width:420px">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>返回码,详见:code返回码说明</td>
</tr>
<tr>
<td>msg</td>
<td>code对应的描述</td>
</tr>
<tr>
<td>charge</td>
<td>计费标志 true为计费,false为不计费</td>
</tr>
<tr>
<td>taskNo</td>
<td>本次请求号</td>
</tr>
<tr>
<td>data</td>
<td>返回具体结果,object类型,详见data返回字段描述</td>
</tr>
</tbody>
</table>
<p><a name="code返回码说明"></a></p>
<h5>1.4.2 code返回码说明</h5>
<table>
<thead>
<tr>
<th>code</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>200</td>
<td>成功</td>
</tr>
<tr>
<td>202</td>
<td>已发送验证码,请再调用校验验证码接口完成登录</td>
</tr>
<tr>
<td>301</td>
<td>登录相关错误,以实际返回为准</td>
</tr>
<tr>
<td>302</td>
<td>短信验证码发送频繁</td>
</tr>
<tr>
<td>400</td>
<td>参数错误</td>
</tr>
<tr>
<td>404</td>
<td>接口地址不正确</td>
</tr>
<tr>
<td>500</td>
<td>系统维护,请稍候再试</td>
</tr>
<tr>
<td>601</td>
<td>接口未开通</td>
</tr>
<tr>
<td>602</td>
<td>账号停用</td>
</tr>
<tr>
<td>604</td>
<td>接口停用</td>
</tr>
<tr>
<td>606</td>
<td>调用超限,请稍候再试</td>
</tr>
<tr>
<td>607</td>
<td>ip不在白名单</td>
</tr>
<tr>
<td>609</td>
<td>请求过于频繁,请稍候再试</td>
</tr>
<tr>
<td>610</td>
<td>请求超时</td>
</tr>
<tr>
<td>999</td>
<td>其他,以实际返回为准</td>
</tr>
</tbody>
</table>
<hr />
<h3>2 登录接口</h3>
<h4>2.1 接口描述</h4>
<ul>
<li>用于税局的新版登录</li>
<li>如果税局登录需要短信验证码登录,则触发短信发送,然后需要调用校验验证码接口</li>
<li>如果税局登录不需要短信验证码登录,则可直接登录成功。浙江不需要短信验证码</li>
</ul>
<h4>2.2 请求地址</h4>
<p><code>https://api.jumdata.com/invoice/common/login</code></p>
<h4>2.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>nsrsbh</td>
<td>String</td>
<td>是</td>
<td>纳税人识别号</td>
</tr>
<tr>
<td>dq</td>
<td>String</td>
<td>是</td>
<td>地区编码, 详见:[地区编码说明](<a href="https://www.showdoc.com.cn/p/b8ef364b0b7b0825676bdc31f104134b">https://www.showdoc.com.cn/p/b8ef364b0b7b0825676bdc31f104134b</a> "地区编码说明")</td>
</tr>
<tr>
<td>sflx</td>
<td>String</td>
<td>是</td>
<td>身份类型,详见:[身份类型说明](<a href="https://www.showdoc.com.cn/p/b8ef364b0b7b0825676bdc31f104134b">https://www.showdoc.com.cn/p/b8ef364b0b7b0825676bdc31f104134b</a> "身份类型说明")</td>
</tr>
<tr>
<td>gryhm</td>
<td>String</td>
<td>是</td>
<td>登录账号,该值可为:居民身份证/手机号/用户名</td>
</tr>
<tr>
<td>gryhmm</td>
<td>String</td>
<td>是</td>
<td>登录密码</td>
</tr>
<tr>
<td>sjhm</td>
<td>String</td>
<td>否</td>
<td>手机号码,除浙江外,该值必填</td>
</tr>
</tbody>
</table>
<h4>2.4 登录成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: false //该接口不计费
}</code></pre>
<h4>2.5 发送验证码返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 202,
&quot;msg&quot;: &quot;已发送验证码,请再调用校验验证码接口完成登录&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: false, //该接口不计费
&quot;data&quot;: {
&quot;validateCodeSmsTaskId&quot;: &quot;12121321323123123323&quot; // 短信验证码taskId,校验验证码时需要传入该参数
}
}</code></pre>
<h4>2.6 失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 302,
&quot;msg&quot;: &quot;短信验证码发送频繁&quot;,
&quot;taskNo&quot;: &quot;487974114181909820820522&quot;,
&quot;charge&quot;: false
}</code></pre>
<hr />
<h3>3 校验验证码接口</h3>
<h4>3.1 接口描述</h4>
<ul>
<li>用于调用登录接口发送短信验证码之后去校验验证码</li>
</ul>
<h4>3.2 请求地址</h4>
<p><code>https://api.jumdata.com/invoice/common/login/validate-code</code></p>
<h4>3.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>nsrsbh</td>
<td>String</td>
<td>是</td>
<td>纳税人识别号</td>
</tr>
<tr>
<td>validateCodeSmsTaskId</td>
<td>String</td>
<td>是</td>
<td>登录接口返回的短信验证码taskId</td>
</tr>
<tr>
<td>smsValidateCode</td>
<td>String</td>
<td>是</td>
<td>短信验证码</td>
</tr>
</tbody>
</table>
<h4>3.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028997165459&quot;,
&quot;charge&quot;: false // 该接口不计费
}</code></pre>
<h4>3.5 失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 400,
&quot;msg&quot;: &quot;短信验证码不能为空&quot;,
&quot;charge&quot;: false
}</code></pre>
<hr />
<h3>4 判断登录状态接口</h3>
<h4>4.1 接口描述</h4>
<ul>
<li>用于判断登录税局的状态</li>
</ul>
<h4>4.2 请求地址</h4>
<p><code>https://api.jumdata.com/invoice/common/login/status</code></p>
<h4>4.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>nsrsbh</td>
<td>String</td>
<td>是</td>
<td>纳税人识别号</td>
</tr>
<tr>
<td>dq</td>
<td>String</td>
<td>是</td>
<td>地区编码, 详见:[地区编码说明](<a href="https://www.showdoc.com.cn/jumdata/10986961478820891">https://www.showdoc.com.cn/jumdata/10986961478820891</a> "地区编码说明")</td>
</tr>
<tr>
<td>sflx</td>
<td>String</td>
<td>是</td>
<td>身份类型,详见:[身份类型说明](<a href="https://www.showdoc.com.cn/jumdata/10986961478820891">https://www.showdoc.com.cn/jumdata/10986961478820891</a> "身份类型说明")</td>
</tr>
<tr>
<td>gryhm</td>
<td>String</td>
<td>是</td>
<td>登录账号,该值可为:居民身份证/手机号/用户名</td>
</tr>
<tr>
<td>gryhmm</td>
<td>String</td>
<td>是</td>
<td>登录密码</td>
</tr>
<tr>
<td>sjhm</td>
<td>String</td>
<td>否</td>
<td>手机号码,除浙江外,该值必填</td>
</tr>
</tbody>
</table>
<h4>4.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: false
}</code></pre>
<h4>4.5 登录失效返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 301,
&quot;msg&quot;: &quot;登录已失效&quot;,
&quot;taskNo&quot;: &quot;260373057204669927965496&quot;,
&quot;charge&quot;: false
}</code></pre>
<h4>4.6 失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 400,
&quot;msg&quot;: &quot;纳税人识别号不能为空&quot;,
&quot;charge&quot;: false
}</code></pre>
<h3>5 获取登录二维码</h3>
<h4>5.1 接口描述</h4>
<ul>
<li>获取扫码登录的二维码图片</li>
</ul>
<h4>5.2 请求地址</h4>
<p><code>https://api.jumdata.com/invoice/common/login/qrcode/get</code></p>
<h4>5.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>nsrsbh</td>
<td>String</td>
<td>是</td>
<td>纳税人识别号</td>
</tr>
<tr>
<td>dq</td>
<td>String</td>
<td>是</td>
<td>地区编码, 详见:[地区编码说明](<a href="https://www.showdoc.com.cn/p/b8ef364b0b7b0825676bdc31f104134b">https://www.showdoc.com.cn/p/b8ef364b0b7b0825676bdc31f104134b</a> "地区编码说明")</td>
</tr>
</tbody>
</table>
<h4>5.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: false, //该接口不计费
&quot;data&quot;: {
&quot;qrcodeContent&quot;: &quot;&quot;, // 二维码内容
&quot;qrcodeImageUrl&quot;: &quot;&quot;, // 二维码图片地址,有效期30分钟
&quot;qrcodeId&quot;: &quot;be2ba2a0d8444fabbec65a43486cc5ed&quot;, // 二维码id,获取扫码登录结果需要用到
&quot;taskId&quot;: 1762794678531752000 // 扫码任务id,获取扫码登录结果需要用到
}
}</code></pre>
<h4>5.5 失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 400,
&quot;msg&quot;: &quot;参数dq不能为空&quot;,
&quot;charge&quot;: false
}</code></pre>
<hr />
<h3>6 获取扫码登录结果</h3>
<h4>6.1 接口描述</h4>
<ul>
<li>扫猫登录之后需要调用该接口获取扫码登录结果</li>
</ul>
<h4>6.2 请求地址</h4>
<p><code>https://api.jumdata.com/invoice/common/login/qrcode/result</code></p>
<h4>6.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>taskId</td>
<td>String</td>
<td>是</td>
<td>扫码任务id, 获取登录二维码接口返回</td>
</tr>
<tr>
<td>qrcodeId</td>
<td>String</td>
<td>是</td>
<td>二维码id,获取登录二维码接口返回</td>
</tr>
<tr>
<td>sflx</td>
<td>String</td>
<td>否</td>
<td>身份类型,详见:[身份类型说明](<a href="https://www.showdoc.com.cn/jumdata/10986961478820891">https://www.showdoc.com.cn/jumdata/10986961478820891</a> "身份类型说明")</td>
</tr>
</tbody>
</table>
<h4>6.4 登录成功返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;526782409178028989145499&quot;,
&quot;charge&quot;: false, //该接口不计费
&quot;data&quot;: {
&quot;nsrsbh&quot;: &quot;&quot;,// 纳税人识别号
&quot;accountId&quot;: &quot;&quot;,// 账户ID
&quot;nsrsbhName&quot;: &quot;&quot;, // 登录税局成功纳税人名称
&quot;individualId&quot;: &quot;&quot;,// 自然人唯一标识
&quot;dq&quot;: &quot;&quot; // 地区
}
}</code></pre>
<h4>6.5 登录失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 301,
&quot;msg&quot;: &quot;请扫码认证在继续操作&quot;,
&quot;taskNo&quot;: &quot;487974114181909820820522&quot;,
&quot;charge&quot;: false
}</code></pre>
<hr />
<h3>7 扫码登录校验</h3>
<h4>7.1 接口描述</h4>
<ul>
<li>校验扫码登录信息是否有效</li>
</ul>
<h4>7.2 请求地址</h4>
<p><code>https://api.jumdata.com/invoice/common/login/qrcode/check</code></p>
<h4>7.3 业务参数</h4>
<table>
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必须</th>
<th><div style="width:420px;">说明</div></th>
</tr>
</thead>
<tbody>
<tr>
<td>nsrsbh</td>
<td>String</td>
<td>是</td>
<td>纳税人识别号</td>
</tr>
<tr>
<td>accountId</td>
<td>String</td>
<td>是</td>
<td>账户ID,获取扫码登录结果接口返回</td>
</tr>
</tbody>
</table>
<h4>7.4 成功返回样例</h4>
<pre><code class="language-json">{
&quot;msg&quot;: &quot;成功&quot;,
&quot;taskNo&quot;: &quot;716204852169006665775412&quot;,
&quot;charge&quot;: false,
&quot;code&quot;: 200,
&quot;data&quot;: {
&quot;result&quot;: false //false:失效,true:有效
}
}</code></pre>
<h4>7.5 失败返回样例</h4>
<pre><code class="language-json">{
&quot;code&quot;: 400,
&quot;msg&quot;: &quot;纳税人识别号不能为空&quot;,
&quot;charge&quot;: false
}</code></pre>