This module provides various functions that the channel must integrate. The game must be connected to all interfaces to ensure that it is properly placed in the channel. This module is a mandatory module.
The game developer needs to read thepublic configuration,and prepare relevant configuration.
The game developer needs to complete thelogin 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 the payment page and pay the amount.
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:The following parameters are required and cannot be empty. Otherwise it will cause the payment failure.
Map<String, String> params = new HashMap<String, String>();
params.put(BCoreConst.platform.KEY_PRICE, "1"); //必传,购买金额,必须为大于0的整形数字,单位/元
params.put(BCoreConst.platform.KEY_PRODUCT_ID, "商品ID"); //必传,productId,商品唯一标识
params.put(BCoreConst.platform.KEY_PRODUCT_NAME, "商品名称");//必传,productName,商品名称
params.put(BCoreConst.platform.KEY_PRODUCT_DESC, "商品描述");//必传,productDesc,商品描述
params.put(BCoreConst.platform.KEY_POINT_RATE, "10"); //必传,货币兑换比例,整形数字,现实货币与游戏货币的兑换比例,如现实货币1RMB,兑换游戏货币10元宝,则填10
params.put(BCoreConst.platform.KEY_POINT_NAME, "元宝"); //必传,游戏货币名称,如元宝、钻石、金币等
params.put(BCoreConst.platform.KEY_ORDER_TITLE, "30元月卡");//必传,订单标题,显示在充值页面的标题,部分平台对该值有要求
//调起支付
SuperSDK.invoke(BCoreConst.platform.MODULE_NAME, BCoreConst.platform.FUNC_PAY, params);
Interface callback:
private OnSuperSDKListener mSuperSDKListener = new OnSuperSDKListener() {
@Override
public void onSuperSDK(String moduleName, String funcName, String result) {
//调用接口异步监听结果。
Log.d(TAG, "moduleName:" + moduleName + "\nfuncName:" + funcName + "\nresult:" + result);
if(BCoreConst.platform.MODULE_NAME.equals(moduleName) && BCoreConst.platform.FUNC_PAY_ORDER_ID.equals(funcName)) {
//支付获取订单号成功
JSONObject json = JsonUtils.parseObject(result);
// 获取订单成功
String orderId = json.getString("data");
Log.d(TAG, "payOrderId success: " + orderId);
} else if(BCoreConst.platform.MODULE_NAME.equals(moduleName) && BCoreConst.platform.FUNC_PAY.equals(funcName)) {
//支付结束回调
JSONObject json = JsonUtils.parseObject(result);
int code = json.getIntValue("code");
if (BCoreCode.SUCCESS == code) {
Log.d(TAG, "pay success");
} else {
String msg = json.getString("msg");
Log.d(TAG, "pay failed: " + code + ", " + msg);
}
} else {
Log.d("supersdk", "其他模块方法的监听结果");
}
}
};
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"}
Interface Description: Invoking the payment page and pay the amount.
Note: Before the joint debugging, operation and maintenance system needs to configure OpSid for the district service.
Interface invoke: The following parameters are required and cannot be empty. Otherwise it will cause the payment failure.
Map<String, String> params = new HashMap<String, String>();
params.put(BCoreConst.platform.KEY_PRICE, "1"); //必传,购买金额,必须为大于0的整形数字,单位/元
params.put(BCoreConst.platform.KEY_PRODUCT_ID, "商品ID"); //必传,productId,商品唯一标识
params.put(BCoreConst.platform.KEY_PRODUCT_NAME, "商品名称");//必传,productName,商品名称
params.put(BCoreConst.platform.KEY_PRODUCT_DESC, "商品描述");//必传,productDesc,商品描述
params.put(BCoreConst.platform.KEY_POINT_RATE, "10"); //必传,货币兑换比例,整形数字,现实货币与游戏货币的兑换比例,如现实货币1RMB,兑换游戏货币10元宝,则填10
params.put(BCoreConst.platform.KEY_POINT_NAME, "元宝"); //必传,游戏货币名称,如元宝、钻石、金币等
params.put(BCoreConst.platform.KEY_ORDER_TITLE, "30元月卡");//必传,订单标题,显示在充值页面的标题,部分平台对该值有要求
//调起支付
SuperSDK.invoke(BCoreConst.platform.MODULE_NAME, BCoreConst.platform.FUNC_PAY, params);
Interface callback: not required
Interface Description: if there is an unpaid order under a role of current district server , game developer will be noticed by the SuperSDK unified listener (OnSuperSDKListener) .
Note 1: If the game developer receives an unpaid order, the game developer needs to obtain the order details through the server request (game main checking order interface) and process them.
Note 2: the funcName of the order notification is different from the payment funcName in <1>
Order notification:
private OnSuperSDKListener mSuperSDKListener = new OnSuperSDKListener() {
@Override
public void onSuperSDK(String moduleName, String funcName, String result) {
//调用接口异步监听结果。
Log.d(TAG, "moduleName:" + moduleName + "\nfuncName:" + funcName + "\nresult:" + result);
//请注意,订单通知方法名与支付无关
if(BCoreConst.platform.MODULE_NAME.equals(moduleName) && BCoreConst.platform.FUNC_PURCHASES.equals(funcName)) {
//未消费订单通知
JSONObject json = JsonUtils.parseObject(result);
int code = json.getIntValue("code");
if(code != BCoreCode.SUCCESS) {
return;
}
String data = json.getString("data");
if(TextUtils.isEmpty(data)) {
return;
}
//拉取订单,打印每个订单
String[] orders = data.split("\\|");
for (String order : orders) {
Log.e("result", "order="+order);
}
} else {
Log.d("supersdk", "其他模块方法的监听结果");
}
}
};
Log printing:
//未消费订单通知,data下为订单号,多个订单号以竖线"|"分割
moduleName: platform
funcName: purchases
result: {
"code": 1,
"msg": "success",
"data": "order1|order2|...|ordern"
}
Interface Description: After the game developer receives the unpaid order and confirms the processing is completed (distribution of currency), use this interface to consume this order.
Note: Multiple orders can be consumed at a time, and multiple orders are split with a vertical line “|”. If there is only one order, the order number can be directly transmitted.
Interface invoke: The following parameters are required and cannot be empty. Otherwise it will lead to consumption failure
Map<String, String> params = new HashMap<String, String>();
params.put(BCoreConst.platform.KEY_ORDERS, "order1|order2|...|ordern");//必传,传入SuperSDK订单号,当需要消费多笔订单时,以竖线"|"分割。
//调起支付
SuperSDK.invoke(BCoreConst.platform.MODULE_NAME, BCoreConst.platform.FUNC_CONSUME, params);
Interface callback: null
Constant string | Actual string | Description |
---|---|---|
BCoreConst.platform.MODULE_NAME | platform | Platform module name |
login | ||
BCoreConst.platform.FUNC_LOGIN | login | Login method |
logout | ||
BCoreConst.platform.FUNC_HAS_LOGOUT | hasLogout | Whether the channel has a logout interface |
BCoreConst.platform.FUNC_LOGOUT | logout | Logout interface |
pay | ||
BCoreConst.platform.FUNC_PAY | pay | Open the payment page |
BCoreConst.platform.FUNC_PAY_ORDER_ID | payOrderId | Get the order number successfully callback |
BCoreConst.platform.KEY_PRICE | price | Recharge amount |
BCoreConst.platform.KEY_PRODUCT_ID | productId | Product ID |
BCoreConst.platform.KEY_PRODUCT_NAME | productName | product name |
BCoreConst.platform.KEY_PRODUCT_DESC | productDesc | product description |
BCoreConst.platform.KEY_POINT_RATE | pointRate | The ratio of real currency to game currency exchange, such as 1:10, fill in 10 |
BCoreConst.platform.KEY_POINT_NAME | pointName | Game currency name, such as diamond |
BCoreConst.platform.KEY_ORDER_TITLE | orderTitle | Order title |
Role data report | ||
BCoreConst.platform.FUNC_ENTER_GAME | enterGame | Enter the game interface |
BCoreConst.platform.FUNC_CREATE_ROLE | createRole | Create a role interface |
BCoreConst.platform.FUNC_LEVEL_UP | levelUp | level Up interface |
BCoreConst.platform.KEY_ROLE_ID | role_id | Role ID |
BCoreConst.platform.KEY_ROLE_NAME | role_name | Role Name |
BCoreConst.platform.KEY_ROLE_LEVEL | level | Role level |
BCoreConst.platform.KEY_VIP_GRADE | vip_grade | Role vip |
BCoreConst.platform.KEY_SERVER_ID | server_id | Server ID |
BCoreConst.platform.KEY_SERVER_NAME | server_name | name of server |
BCoreConst.platform.KEY_OP_SID | opSid | Channel server ID |
BCoreConst.platform.KEY_ROLE_CREATE_TIME | roleCreateTime | To create a role time, you must use server time, unit / s |
Forum, UserCenter,CustomerService | ||
BCoreConst.platform.FUNC_HAS_FORUM | hasForum | whether there is a forum |
BCoreConst.platform.FUNC_OPEN_FORUM | openForum | Open forum |
BCoreConst.platform.FUNC_HAS_USER_CENTER | hasUserCenter | whether there is a user center |
BCoreConst.platform.FUNC_OPEN_USER_CENTER | openUserCenter | Open the user center |
BCoreConst.platform.FUNC_HAS_CUSTOMER_SERVICE | hasCustomerService | whether there is a customer service |
BCoreConst.platform.FUNC_OPEN_CUSOMER_SERVICE | openCustomerService | Open customer service |
Exit the game | ||
BCoreConst.platform.FUNC_EXIT | exit | Exit the game |
open login page, open home page | ||
BCoreConst.platform.FUNC_OPEN_LOGIN_PAGE | openLoginPage | open login page, open home page |
BCoreConst.platform.FUNC_OPEN_HOME_PAGE | openHomePage | open login page, open home page |
add supersdk event tracking | ||
BCoreConst.platform.FUNC_REPORT | report | Add a event tracking method name |
BCoreConst.platform.KEY_EVENT_ID | event_id | Event ID |