搜索结果
返回
最后更新时间: 2021-02-04 03:12:47 PM
The game developer needs to read the public configuration and prepare relevant configuration.
The game developer needs to complete the login module first and integrate all interfaces.
Before integrating the payment module, the game developer must integrate the Youzu server selection system first (please contact with operation and operation and maintenance colleagues).
Interface Description: Invoking this interface will open the payment interface of the channel.
Note 1: The following configuration is required before the joint debugging,then the game server can receive the notification of successful payment:
1. Operation and maintenance system configures the OpSid and the Ip or domain name of the game server.
2. Configure the template recharge callback address on the packaging tool.
Note 2: The game can’t rely on the callback of the payment to perform the game logic processing, such as the first recharge display, etc. (There is no callback of successful payment in some channels)
Interface invoke:
Dictionary<string, object> productDic = new Dictionary<string, object>();
productDic.Add(SuperSDKPlatform.KEY_PRICE, "1"); //购买的商品价格,必须为整形数字
productDic.Add(SuperSDKPlatform.KEY_PRODUCT_ID, "productId");//购买的商品ID, (某些充值是需要指定商品ID的,比如苹果)
productDic.Add(SuperSDKPlatform.KEY_PRODUCT_NAME, "productName");//购买的商品名字
productDic.Add(SuperSDKPlatform.KEY_PRODUCT_DESC,"productDesc");//购买的商品的描述
productDic.Add(SuperSDKPlatform.KEY_POINT_RATE, "pointRate");//比如萌江湖中是1元换10个元宝,那么pointRate填10, pointName填 元宝
productDic.Add(SuperSDKPlatform.KEY_POINT_NAME, "pointName");//比如萌江湖中是1元换10个元宝,那么pointRate填10, pointName填 元宝
productDic.Add(SuperSDKPlatform.KEY_ORDER_TITLE,"orderTitle");//订单标题,部分平台的订单标题有要求
productDic.Add(SuperSDKPlatform.KEY_PAY_EXTRA, "");//扩展参数,必传可传空
//调用支付接口
SuperSDK.getInstance().Invoke(SuperSDKPlatform.MODULE_NAME, SuperSDKPlatform.FUNC_PAY, productDic);
Interface callback:
public void OnCallBack(string moduleName, string funcName, string result)
{
Debug.Log("moduleName:" + moduleName);
Debug.Log("funcName:" + funcName);
Debug.Log("result:" + result);
JsonData resultData = JsonMapper.ToObject(result);
//平台模块回调
if (moduleName.Equals(SuperSDKPlatform.MODULE_NAME))
{
if (funcName.Equals(SuperSDKPlatform.FUNC_PAY_ORDER_ID))
{
//获取订单成功
string orderId = JsonMapper.ToJson(resultData["data"]);
}
}
else if (funcName.Equals(SuperSDKPlatform.FUNC_PAY))
{
if ((int)resultData["code"] == SuperSDKConstants.SUCCESS)
{
//支付成功
//注意:游戏不能依赖此接口处理逻辑(比如:首充界面显示)
}
else
{
//支付失败
}
}
}
Callback log printing:
moduleName:platform
funcName:payOrderId
result: {
"code": 1,
"msg": "get orderId success",
"data": "OS_ZXLX97IK1B98RDL8L"
}
moduleName: platform
funcName: pay
result: {"code":1,"msg":"pay success"}
Constant string | Actual string | Description |
---|---|---|
SuperSDKPlatform.MODULE_NAME | platform | Platform module |
SuperSDKPlatform.FUNC_PAY | pay | pay method |
SuperSDKPlatform.FUNC_PAY_ORDER_ID | payOrderId | Method of getting orderID callback |
SuperSDKPlatform.KEY_PRICE | price | top up amount |
SuperSDKPlatform.KEY_PRODUCT_ID | productId | Product ID |
SuperSDKPlatform.KEY_PRODUCT_NAME | productName | product name |
SuperSDKPlatform.KEY_PRODUCT_DESC | productDesc | product description |
SuperSDKPlatform.KEY_POINT_RATE | pointRate | The exchange rate of real money to game currency , such as 1:10, fill in 10 |
SuperSDKPlatform.KEY_POINT_NAME | pointName | Currency of the game, such as diamond |
SuperSDKPlatform.KEY_ORDER_TITLE | orderTitle | Order title |