支付宝网页调用签名sign
支付宝提供的网页支付接口,notify_url调用时签名要使用非排序方式,原demo有bug,致使多次调用计算签名都失败,最终找出了问题,AlipayCore类中createLinkStringNoSort()方法不能使用HashMap,代之以LinkedHashMap,以此做记录。
public static String createLinkStringNoSort(Map<String, String> params) { Map<String, String> sParaSort = new LinkedHashMap<String,String>(); sParaSort.put("service", params.get("service")); sParaSort.put("v", params.get("v")); sParaSort.put("sec_id", params.get("sec_id")); sParaSort.put("notify_data", params.get("notify_data")); String prestr = ""; for (String key : sParaSort.keySet()) { prestr = prestr + key + "=" + sParaSort.get(key) + "&"; } prestr = prestr.substring(0, prestr.length() - 1); return prestr; }
相关推荐
Lzs 2020-10-23
聚合室 2020-11-16
零 2020-09-18
Justhavefun 2020-10-22
jacktangj 2020-10-14
ChaITSimpleLove 2020-10-06
Andrea0 2020-09-18
周游列国之仕子 2020-09-15
afanti 2020-09-16
88234852 2020-09-15
YClimb 2020-09-15
风雨断肠人 2020-09-04
卖口粥湛蓝的天空 2020-09-15
stulen 2020-09-15
pythonxuexi 2020-09-06
abfdada 2020-08-26
梦的天空 2020-08-25