Blame view
server_document.md
2.09 KB
1415e2002
![]() |
1 2 3 4 |
1. 充值通知第三方服务端接口(需提供回调地址) ----------------------------- 参数列表: orderId: parter订单号 |
33d14fe20
![]() |
5 6 7 |
tradId: 平台订单号 appId: 游戏接入分配appid userId: 平台用户id |
1415e2002
![]() |
8 |
product: 购买商品名字(50字符) |
33d14fe20
![]() |
9 10 11 12 |
currency: 币种 (目前仅有CNY) amount: 充值金额(分) channel: 支付方式(对应详情见4) sig: 签名(算法详见3) |
1415e2002
![]() |
13 14 |
第三方server端返回值: |
2914c56b3
![]() |
15 |
如果第三方验证成功,则返回字符串"success"即可,否则会通知10次后停止. |
1415e2002
![]() |
16 17 18 19 |
2. 登录验证(可选) ----------------------------------- |
2914c56b3
![]() |
20 |
URL: |
1415e2002
![]() |
21 |
参数: |
2914c56b3
![]() |
22 23 |
userId: gumpId appKey: |
1415e2002
![]() |
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
sessionKey:验证key 返回值: { "code":100000(100000:成功,100012:用户不存在,-1:失败), "msg":"xxxxxx", "userId":1234 } 3.签名算法 -------------------------------- 注意:签名参数不能写成固定数量,一定要获取全部参数并且除sig参数外,然后按照字母升序排列。 ```java /** |
2914c56b3
![]() |
40 |
* 签名算法(JAVA示例) |
1415e2002
![]() |
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
* @param request * @return */ public String sig(HttpServletRequest request, String key){ Enumeration names = request.getParameterNames(); SortedSet<String> allParams = Sets.newTreeSet(); while (names.hasMoreElements()) { String name = (String) names.nextElement(); if (name.equals("sig")) { continue; } try { allParams.add(name + "=" + URLEncoder.encode(request.getParameter(name), "utf-8")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } String params = Joiner.on("&").join(allParams)+key; String computedToken = DigestUtils.md5DigestAsHex(params.getBytes()); return computedToken; } ``` |
2914c56b3
![]() |
67 |
注意:参数是按字母升序排列 akey=value&bkey=value.... + secretkey(签名key) |
1415e2002
![]() |
68 |
|
2914c56b3
![]() |
69 |
4.channel详情 |
1415e2002
![]() |
70 |
-------------------------------- |
2914c56b3
![]() |
71 72 73 74 |
100100:微信 100200:支付宝 100300:银联 |