订单支付(Pay.orderPay)
输入
/**
*
* @param mchName 商户名(小于等于128位字节)
* @param mchID 商户号 传门户上唯一商户号
* @param outTradeNo 商户订单号(小于等于32位)
* @param body 商品描述(小于等于128位字节)
* @param detail 商品详情(小于等于512位字节)
* @param random 随机数 随意字段,需与签名中Random一致
* @param sign 签名 签名字段(appID, body, mchID, outTradeNo, totalFee, random, secureKey)
* @param attach 附加数据 保留字段 随意传字符串
* @param confirmOrder 确认支付 保留字段 默认传:N
* @param totalFee 总金额 单位:元 (2位小数)
* @param limitPay 指定支付方式 保留字段 默认传:01
* @param feeType 货币类型 保留字段 默认传:CNY (人民币)
* @param goodsTag 商品标记 保留字段 默认传:""
* @param timeValid 交易有效时间 保留字段 默认传:120
* @param deviceInfo 硬件信息 保留字段 传设备唯一标示
* @param sku 具体商品信息,不能只送sku,可以只送spu或者2个都不送
* @param spu 具体商品信息,不能只送sku,可以只送spu或者2个都不送
* @param extraMessage 附加信息(快捷填表)注:不能传null,没有附加信息请传空map,map中的字段请使用String,不能用int。
* @param callbackMap 查询Map 保留字段 传空map
* @param payType 支付类型(HRSDK.PAY_JSH 极时花支付,HRSDK.PAY_JF 极付支付)
* @param activity 页面Act
*/
public static void orderPay(String mchName, String mchID, String outTradeNo, String body, String detail, String random, String sign, String attach, final String confirmOrder, String totalFee, String limitPay,
String feeType, String goodsTag, String timeValid, String deviceInfo, String sku, String spu, Map extraMessage, Map callbackMap,int payType, Activity activity)
extraMessage结构
//开发者用来帮助用户在绑卡页面自动填表的数据
Map extraMessage = new HashMap();
extraMessage.put("mobile", "15692125542");//弱实名手机号
extraMessage.put("realName", "王小明");//真实姓名
extraMessage.put("cardNo", "6217002870038316624");//银行卡号
extraMessage.put("identity", "42070419900611503X");//证件号码
extraMessage.put("revmobile", "15692125542");//银行预留手机号
加签方式(建议由服务端加签。防止secretKey泄漏)
public static String signOrderPay(String appID, String body, String mchID, String outTradeNo, String totalFee, String random, String secretKey) {
StringBuffer buffer = new StringBuffer();
buffer.append("appID=" + appID + "&");
buffer.append("body=" + body + "&");
buffer.append("mchID=" + mchID + "&");
buffer.append("outTradeNo=" + outTradeNo + "&");
buffer.append("totalFee=" + totalFee + "&");
buffer.append("random=" + random + "&");
buffer.append("key=" + secretKey);
return getMD5(buffer.toString()).toUpperCase();
}
输出
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case HRSDK.METHOD_PAY:
if (resultCode == RESULT_OK) {
HashMap resultMap = (HashMap) data.getSerializableExtra("data");
if (resultMap != null) {
//结果代码 String 正常为全0,出错时为错误码
resultMap.get("returnCode");
//结果信息 String 正常为空字符串,出错时为错误信息
resultMap.get("returnMsg");
//错误代码 String 正常为全0,出错时为错误码
resultMap.get("errorCode");
//错误信息 String 正常为空字符串,出错时为错误信息
resultMap.get("errorMsg");
//商户号 String
resultMap.get("mchID");
//商户订单号 String
resultMap.get("outTradeNo");
//支付流水号 String
resultMap.get("payID");
//总金额 String
resultMap.get("totalFee");
//支付金额 String
resultMap.get("payFee");
//签名 String
resultMap.get("sign");
//随机数 String
resultMap.get("random");
}
}
break;
}
}