- Home /
Get userID in Chinese 360 offline payment plugin implementation.
Hi! I am currently trying to implement 360 offline payment system(ver 0.1.4 from 2.02.2015), and cant figure out how to get some of the parameters needed in correct payment and data gathering method call. For example how can I get userID?
I also am not a Chinese speaking person, I can barley english.
When I call
Bundle bundle = new Bundle();
bundle.putInt(ProtocolKeys.FUNCTION_CODE, ProtocolConfigs.FUNC_CODE_LOGIN);
Intent intent = new Intent(context, ContainerActivity.class);
Matrix.invokeActivity(context, intent, mLoginCallback);
private static IDispatcherCallback mLoginCallback = new IDispatcherCallback()
{
@Override
public void onFinished(String data)
{
int returnValue = -1;
Log.i(TAG, "data is " + data);
if (!TextUtils.isEmpty(data))
{
try
{
JSONObject json = new JSONObject(data);
int errCode = json.getInt("error_code");
String errorMsg = json.getString("error_msg");
if (errCode == 0)
{
returnValue = 0;
}
}
catch(JSONException e)
{
e.printStackTrace();
}
}
Matrix.destroy(UnityPlayer.currentActivity);
UnityBridge.LoginCallback(Integer.toString(returnValue));
}
};
this method returns simple string:
{"content":"","error_code":"0","error_msg":"登录成功"}
Later in the documentation I can use some methods to post data to servers:
public static void player(String id, int age, int gender, String source, String rank, String server, String comment)
But where can I get this info?
Also in payments method there are parameters that are weird, like userID is needed in the payment process, but it is not given by the server, but it is set in the application, so there could be potentially multiple userID withe the same values. Is this correct? Can I just set this value to "Joe" for every user and everything will be good?
// Required. User id given by application. 32 characters at most.
bundle.putString(ProtocolKeys.APP_USER_ID, Constants.DEMO_PAY_APP_USER_ID);
Links to the SDK and documentation(lacking explanation unfortunately )
Answer by waitWut · Mar 11, 2015 at 01:05 PM
I'm not very familiar with 360, but let's try:
{"content":"","error_code":"0","error_msg":"登录成功"} Seems to give error code: 0 and msg (Login Successful) with google translate. I would assume that information you're seeking is in the 'data' section of the message.
Have you tried the logon interface/ callback section from the documentation you linked? That would look correct way to parse the information:
private IDispatcherCallback mLoginCallbackSupportOffline