1.支付(新版本--回调统一版)

提示:新接入的游戏请使用该新版支付

LjWxSdk.startPay(myBehaviour, payInfo);
字段 类型 描述 是否必填
data json 数据

data参数如下:

字段 类型 描述 是否必填
channel string 用户渠道(必须传注册时的渠道号,必须与用户注册数据关联,不能存在客户端),参见渠道号获取
cpOrderNumber string CP方订单编号
productId string 产品编号
productDesc string 产品描述
amount number 产品金额(单位:元)
serverId string 区服id
roleId string 角色id(游戏内的角色id,由于区服不同,可能会有多个角色)
accountId string 游戏内账号id(一个账号对应多个角色)
notifyUrl string 米大师回调通知地址 如果为空则读取后台配置的通知服务器,如果都没有将不进行后台通知
notifyMinUrl string 小程序支付回调通知地址
openId string 用户openid(微信openid)
zoneId string 分区id(支付分区,不要随意改值)
productNum number 购买数量
isNewUser number 区分活跃新增用户 1:新增用户 2:活跃用户
pay_amount number 支付金额
product_name string 商品名字
product_desc string 商品描述
unionId string 用户unionid
extra string 透传信息,原样返回,不超过255长度
totalAmount string 充值总金额
buyQuantity number 兑换比例
appId string 支付小程序appid(由对接人员提供)
gameId string 支付小程序gname(由对接人员提供)
gameName string 游戏gname(对接人员提供)
env number 0-正式,1-沙箱
offerId string 米大师应用id

部分参数参考值:

//渠道号获取
Channel= DDSDK.getChannel();
//回调地址
notifyUrl=”http://127.0.0.1:8080/callPay”;
//额外参数(物品类型|订单id|服务器id)
extra="0|gd18f3f8a8514e5ea5eeb6f9f729fb3c|server001"

示例代码如下:


		System.Random random = new System.Random();
        string numStr= random.Next(1000, 100000)+"";
        PayInfo payInfo = new PayInfo();
        payInfo.channel = "default";
        payInfo.cpOrderNumber = "M20230422982253"+ numStr;
        payInfo.productId = "1yuan";
        payInfo.productDesc = "1元充值";
        payInfo.amount = 1f;

        payInfo.serverId = "1";
        payInfo.roleId = "18866";
        payInfo.accountId = "200374725";
        payInfo.notifyUrl = "https://plis.sh40.cn/pay/notify/type/wxxcx_lingjing";
        payInfo.notifyMinUrl = "https://plis.sh40.cn/pay/notify/type/wxxcx_lingjing";
        payInfo.extra = "M20230422982253" + numStr;
        payInfo.openId = LjWxSdk.getOpenid();
        payInfo.zoneId = "1";
        payInfo.productNum =1;
        payInfo.isNewUser = 2;
        payInfo.unionId = LjWxSdk.getUnionid();
        payInfo.totalAmount = 1f;
        payInfo.env = 0;
        payInfo.buyQuantity = 10;
        payInfo.offerId = "1450048907";
        payInfo.gameName = LjWxSdk.LJSDK_GNAME;
        payInfo.product_name = payInfo.productId;
        payInfo.product_desc = payInfo.productDesc;
        payInfo.pay_amount = payInfo.amount;
        LjWxSdk.startPay(this, payInfo);
		
		

 

2.支付服务端接口

字段 类型 描述
orderid string 订单id
gameid string 游戏id(透传)
productid string 物品id(透传)
gameuid string 游戏uid(透传)
game_openid string 用户unionid(透传)
serverid string 游戏区服id
product_num string 物品购买数量(如购买1钻石 返回1)
timeStamp Long 时间戳
extra string 透传信息,原样返回,不超过255长度
key string MD5加密算法,需要校验
return_code string success接口返回成功
issendbox string 是否沙箱模式
amount Double 支付金额
prop_id_list array 游戏道具列表
account_id string 游戏内账号id(一个账号对应多个角色)

说明:
请求方式:post
参数格式:application/json
key算法:MD5(orderid+gameid+productid+product_num+timeStamp+game_key)(用字符串拼接)
game_key:(根据gameid来判断使用哪个秘钥,gameid由对接人员提供)
小游戏的gameid对应米大师的secret
小程序的gameid对应小程序的game_key

参考:接口返回以json格式返回

{
    "gameid":"test",
    "timeStamp":1539323383844,
    "productid":"p1",
    "orderid":"3bbfddedd969423b9100b688c90ce583",
    "game_openid":"111",
    "extra":"extra111",
    "gameuid":"1",
    "product_num":"11",
    "serverid":"",
    "return_code":"success",
    "key":"4df802714c047ffed17f3a8ae0c43479",
    "amount":"6",
    "prop_id_list":[],
    "account_id":""
}

游戏服务器接口返回:{'status':1}
(status 为1表示成功,否则均为失败 失败20秒后进行重试 ,重试2次)