签名说明
<p>签名说明
第一步,设所有发送或者接收到的数据为集合 M,将集合 M 内非空参数值的参数按照参数名 ASCII 码从小到大排序
(字典序),使用 URL 键值对的格式(即 key1=value1&key2=value2…)拼接成字符串 stringA
特别注意以下重要规则:</p>
<ol>
<li>◆ 参数名 ASCII 码从小到大排序(字典序);</li>
<li>◆ 如果参数的值为空不参与签名;
2.1 ◆ 如果参数的值为数组或需进行json_encode进行转换</li>
<li>◆ 参数名区分大小写;</li>
<li>◆验证调用返回或主动通知签名时,传送的 sign 参数不参与签名,将生成的签名与该 sign 值作校验。
第二步,在 stringA 最后拼接上 key 得到 stringsignTemp 字符串,并对 stringsignTemp 进行 MD5 运算,再将得
到的字符串所有字符转换为大写,得到 sign 值 signValue。
请求示例:
<pre><code>{
&quot;third_sn&quot;: &quot;as202406181125091235&quot;,
&quot;remark&quot;: &quot;-&quot;,
&quot;product&quot;: [
{
&quot;product_id&quot;: &quot;77&quot;,
&quot;sku_id&quot;: &quot;110&quot;,
&quot;number&quot;: &quot;1&quot;,
&quot;price&quot;: &quot;36&quot;,
&quot;sub_sn&quot;: &quot;as202406181125091236&quot;
},
{
&quot;product_id&quot;: &quot;78&quot;,
&quot;sku_id&quot;: &quot;111&quot;,
&quot;number&quot;: &quot;1&quot;,
&quot;price&quot;: &quot;1128.00&quot;,
&quot;sub_sn&quot;: &quot;as202406181125091239&quot;
},
{
&quot;product_id&quot;: &quot;93&quot;,
&quot;sku_id&quot;: &quot;0&quot;,
&quot;number&quot;: &quot;1&quot;,
&quot;price&quot;: &quot;60&quot;,
&quot;sub_sn&quot;: &quot;as202406181125091239&quot;
}
],
&quot;address&quot;: {
&quot;province&quot;: &quot;四川省&quot;,
&quot;city&quot;: &quot;成都市&quot;,
&quot;district&quot;: &quot;新都区&quot;,
&quot;detail&quot;: &quot;无知路&quot;,
&quot;phone&quot;: &quot;18783220363&quot;,
&quot;contacts&quot;: &quot;梁大人&quot;
},
&quot;appid&quot;: &quot;8ea3a97f341ad27b&quot;,
}</code></pre>
<p>第一步:
对参数按照 key=value 的格式,并按照参数名 ASCII 字典序排序得到字符串如下:
address={"city":"成都市","contacts":"梁大人","detail":"无知路","district":"新都区","phone":"18783220363","province":"四川省"}&appid=8ea3a97f341ad27b&product=[{"product_id":"77","sku_id":"110","number":"1","price":"36","sub_sn":"as202406181125091236"},{"product_id":"78","sku_id":"111","number":"1","price":"1128.00","sub_sn":"as202406181125091239"},{"product_id":"93","sku_id":"0","number":"1","price":"60","sub_sn":"as202406181125091239"}]&remark=-&third_sn=as202406181125091235&
第二步:拼接 API 密钥:
stringsignTemp=“stringA&key=afe0bafce14f63af5da236f2de3ed742”
第三步对stringsingTemp进行md5加密得到
8c801a4503a3aa379db0ea6c7a736671
第四步,对加密后的md5值进行大写转换 得到:
8C801A4503A3AA379DB0EA6C7A736671</p></li>
</ol>
<p>最终得到发送的数据如下:</p>
<pre><code>{
&quot;third_sn&quot;: &quot;as202406181125091235&quot;,
&quot;remark&quot;: &quot;-&quot;,
&quot;product&quot;: [
{
&quot;product_id&quot;: &quot;77&quot;,
&quot;sku_id&quot;: &quot;110&quot;,
&quot;number&quot;: &quot;1&quot;,
&quot;price&quot;: &quot;36&quot;,
&quot;sub_sn&quot;: &quot;as202406181125091236&quot;
},
{
&quot;product_id&quot;: &quot;78&quot;,
&quot;sku_id&quot;: &quot;111&quot;,
&quot;number&quot;: &quot;1&quot;,
&quot;price&quot;: &quot;1128.00&quot;,
&quot;sub_sn&quot;: &quot;as202406181125091239&quot;
},
{
&quot;product_id&quot;: &quot;93&quot;,
&quot;sku_id&quot;: &quot;0&quot;,
&quot;number&quot;: &quot;1&quot;,
&quot;price&quot;: &quot;60&quot;,
&quot;sub_sn&quot;: &quot;as202406181125091239&quot;
}
],
&quot;address&quot;: {
&quot;province&quot;: &quot;四川省&quot;,
&quot;city&quot;: &quot;成都市&quot;,
&quot;district&quot;: &quot;新都区&quot;,
&quot;detail&quot;: &quot;无知路&quot;,
&quot;phone&quot;: &quot;18783220363&quot;,
&quot;contacts&quot;: &quot;梁大人&quot;
},
&quot;appid&quot;: &quot;8ea3a97f341ad27b&quot;,
&quot;sign&quot;: &quot;8C801A4503A3AA379DB0EA6C7A736671&quot;
}</code></pre>