Commit 6ee82922bb7c27cc80e4e2ee47682266ed8fe5b1

Authored by 赵康
Exists in master

Merge branch 'master' of http://git.letsgame.mobi/document/inlandsdk

Showing 1 changed file Side-by-side Diff

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