日期 |
接口 |
内容 |
2017-03-24 |
|
创建文档 |
2018-04-10 |
分期支付 |
新增分期支付接口 |
2019-06-04 |
|
删除分期支付接口,修正其它接口参数说明 |
2019-07-12 |
|
新增接口,并对旧有接口进行修改 |
1. 调用方式
demo下载地址:http://oss.lcsw.cn/MyApplication.zip
1.1. 请求方式
第三方通过intent调用,intent中传入必须的请求参数,具体传入的名称在相应的接口中说明。然后通过intent调起相应的Activity。
调用示例
Intent intent = new Intent();
intent.putExtra("print_content", printcontent);
//注意:调用不同的接口,需要将下方的目标Activity修改为相应的Activity名称。
ComponentName cn = new ComponentName("cn.lcsw.lcpos", "cn.lcsw.lcpos.activity.Exported_PrintFunc_Activity");
intent.setComponent(cn);
getActivity().startActivityForResult(intent, PRINT_REQUEST);
1.2. POS返回方式
所有的返回都通过intent返回,intent中返回数据的字段名称为result。result是JSON字符串,其中的具体参数字段由每个接口定义。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
|
请求返回的结果,JSON字符串,不同的接口内容不同。 |
调用示例
// 获取接口返回结果
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (resultCode) {
case Activity.RESULT_CANCELED:
String reason = data.getStringExtra("result");
//从result中解析对应字段
break;
case Activity.RESULT_OK:
String result = data.getStringExtra("result");
//从result中解析对应字段
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
2. 移动支付
2.1. 刷卡(条码)支付
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_PayFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
pay_type |
String |
|
Y |
交易类型 010微信,020 支付宝,040 现金,060qq钱包,080京东钱包,090口碑,100翼支付,110银联二维码,000自动识别类型 |
total_fee |
String |
|
Y |
交易金额 单位分 |
terminal_trace |
String |
|
Y |
终端流水号 |
terminal_time |
String |
|
Y |
终端交易时间,yyyyMMddHHmmss,全局统一时间格式 |
show_result |
String |
|
N |
"1"支付成功后跳转结果页,!"1"不跳转 |
sub_appid |
String |
|
N |
公众号appid |
order_body |
String |
|
N |
订单内容备注 显示在交易结果页 |
attach |
String |
|
N |
附加数据,原样返回 |
goods_detail |
String |
|
N |
订单包含的商品列表信息,JSON格式。pay_type为010,020,090时,可选填此字段 |
goods_tag |
String |
|
N |
订单优惠标记,代金券或立减优惠功能的参数(字段值:cs和bld) |
goods_detail的内容说明如下:
参数名称 |
类型 |
长度 |
必填 |
说明 |
goods_id |
String |
|
N |
商品编号 |
goods_name |
String |
|
N |
商品名称 |
quantity |
String |
|
N |
商品数量(注:pay_type为010时,此字段类型为int) |
price |
String |
|
N |
商品单价,单位为分 |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
响应码:“01”成功 ,02”失败,请求成功不代表业务处理成功 |
return_msg |
String |
|
Y |
返回信息提示 |
result_code |
String |
|
N |
业务结果:“01”成功 ,02”失败 |
pay_type |
String |
|
N |
交易类型 010微信,020 支付宝,040 现金,060qq钱包,080京东钱包,090口碑,100翼支付,110银联二维码,000自动识别类型 |
merchant_name |
String |
|
N |
利楚商户名 |
merchant_no |
String |
|
N |
利楚商户号 |
terminal_id |
String |
|
N |
利楚终端号 |
terminal_trace |
String |
|
N |
终端流水号 |
terminal_time |
String |
|
N |
终端交易时间,yyyyMMddHHmmss,全局统一时间格式 |
total_fee |
String |
|
N |
交易金额 单位分 |
end_time |
String |
|
N |
终端交易结束时间,yyyyMMddHHmmss |
out_trade_no |
String |
|
N |
利楚唯一订单号 |
channel_trade_no |
String |
|
N |
通道订单号,微信订单号、支付宝订单号等 |
channel_order_no |
String |
|
N |
银行渠道订单号,微信支付时显示在支付成功页面的条码,可用作扫码查询和扫码退款时匹配 |
user_id |
String |
|
N |
付款方用户id,“微信openid”、“支付宝账户”、“qq号”等,返回时不参与签名 |
attach |
String |
|
N |
附加数据,原样返回 |
receipt_fee |
String |
|
N |
实收金额,pay_type为010、020、090时必填 |
2.2. 退款
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_RefundFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
paytype |
String |
|
Y |
交易类型 010微信,020 支付宝,040 现金,060qq钱包,080京东钱包,090口碑,100翼支付,110银联二维码,000自动识别类型 |
refund_fee |
String |
|
Y |
退款金额 单位分 |
out_trade_no |
String |
|
Y |
订单号,查询凭据,利楚订单号、微信订单号、支付宝订单号任意一个 |
show_result |
String |
|
N |
"1"退款成功后跳转结果页,!"1"不跳转 |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
响应码:“01”成功 ,02”失败,请求成功不代表业务处理成功 |
return_msg |
String |
|
Y |
返回信息提示 |
result_code |
String |
|
N |
业务结果:“01”成功 ,02”失败 |
pay_type |
String |
|
N |
交易类型 010微信,020 支付宝,040 现金,060qq钱包,080京东钱包,090口碑,100翼支付,110银联二维码,000自动识别类型 |
merchant_name |
String |
|
N |
利楚商户名 |
merchant_no |
String |
|
N |
利楚商户号 |
terminal_id |
String |
|
N |
利楚终端号 |
terminal_trace |
String |
|
N |
终端流水号 |
terminal_time |
String |
|
N |
终端退款时间,yyyyMMddHHmmss,全局统一时间格式 |
refund_fee |
String |
|
N |
退款金额,单位分 |
end_time |
String |
|
N |
终端交易结束时间,yyyyMMddHHmmss |
out_trade_no |
String |
|
N |
利楚唯一订单号 |
out_refund_no |
String |
|
N |
利楚唯一退款单号 |
注意:
需要商户当前账户内有大于退款金额的余额,否则会造成余额不足,退款失败;
限支付30天内退款,超过30天,不能进行退款操作(具体退款限制时间由通道决定)。
3. 银联支付
3.1. 消费和消费撤销
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
消费"SALE"、消费撤销"VOID" |
total_fee |
String |
|
N |
type为"SALE"时必传,交易金额 单位分,范围[1,10000000000) |
terminal_trace |
String |
|
N |
type为"SALE"时非必传,为第三方订单号,长度限制为30。type为"VOID"时,必传,长度6,为消费成功返回的terminal_trace |
show_result |
String |
|
N |
"1"支付成功后跳转结果页,!"1"不跳转 |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
响应码:“01”成功 ,02”失败,请求成功不代表业务处理成功 |
return_msg |
String |
|
Y |
返回信息提示 |
result_code |
String |
|
N |
业务结果:“01”成功 ,02”失败 |
pay_type |
String |
|
N |
交易类型“030” |
merchant_name |
String |
|
N |
利楚商户名 |
uni_merchant_no |
String |
|
N |
银联商户号 |
uni_card_no |
String |
|
N |
交易银行卡号 |
merchant_no |
String |
|
N |
利楚商户号 |
terminal_id |
String |
|
N |
利楚终端号 |
terminal_trace |
String |
|
N |
凭证号 |
terminal_time |
String |
|
N |
终端交易时间,yyyyMMddHHmmss |
total_fee |
String |
|
N |
交易金额,单位分 |
end_time |
String |
|
N |
终端交易结束时间,yyyyMMddHHmmss |
out_trade_no |
String |
|
N |
参考号 |
operaterid |
String |
|
N |
操作员号 |
order_number |
String |
|
N |
第三方订单号 |
pay_status_code |
String |
|
N |
交易状态码 ”1“成功 |
3.2. 签到
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
传"SIGN" |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
业务结果:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
3.3. 查银行卡余额
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
传"BALANCE" |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
业务结果:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
3.4. 重打印上一笔
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
传"LAST" |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
业务结果:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
3.5. 交易联网查询并重印
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
传"NETQUERY" |
old_trace |
String |
|
Y |
原交易凭证号 |
data |
String |
|
Y |
日期,格式为mmdd 如10月20日:1020 |
order_number |
String |
|
N |
原消费订单号 |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
响应码:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
result_code |
String |
|
N |
业务结果:“01”成功 ,02”失败 |
pay_type |
String |
|
N |
交易类型“030” |
merchant_name |
String |
|
N |
利楚商户名 |
merchant_no |
String |
|
N |
利楚商户号 |
terminal_id |
String |
|
N |
利楚终端号 |
terminal_trace |
String |
|
N |
凭证号 |
terminal_time |
String |
|
N |
终端交易时间,yyyyMMddHHmmss |
total_fee |
String |
|
N |
交易金额,单位元 |
end_time |
String |
|
N |
终端交易结束时间,yyyy-MM-dd HH-mm-ss |
out_trade_no |
String |
|
N |
参考号 |
operaterid |
String |
|
N |
操作员号 |
order_number |
String |
|
N |
第三方订单号 |
3.6. 日结
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
传"SETTLE" |
is_print |
boolean |
|
N |
传true打印结算小票,不传默认不打印小票 |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
业务结果:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
3.7. 隔日退货
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_UnionFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
type |
String |
|
Y |
传"REFUND" |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
业务结果:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
4. 打印自定义小票
- 目标类名称:
cn.lcsw.lcpos.activity.Exported_PrintFunc_Activity
- 请求参数,使用Intent传递,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
print_content |
String |
|
Y |
打印数据,JSON字符串,包含名为spos的JSON数组。示例见本节最末 |
- 每一部分打印的内容由如下字段定义:
参数名称 |
类型 |
长度 |
必填 |
说明 |
content-type |
String |
|
|
内容样式: one-dimension一维码,two-dimension二维码,txt文本 |
content |
String |
|
|
内容 |
size |
String |
|
|
1-3,打印字体大小 |
position |
String |
|
|
打印位置 center居中right靠右 left 靠左 |
offset |
String |
|
|
偏移 |
bold |
String |
|
|
是否加粗 0否1是 |
italic |
String |
|
|
是否斜体 0否1是 |
height |
String |
|
|
高度 |
- 返回参数,从Intent中返回,参数名称为Intent中使用的字段名。
参数名称 |
类型 |
长度 |
必填 |
说明 |
result |
String |
|
Y |
请求返回的结果,JSON字符串,不同的接口内容不同。 |
以下字段是result中包含的字段。
参数名称 |
类型 |
长度 |
必填 |
说明 |
return_code |
String |
|
Y |
业务结果:“01”成功 ,02”失败 |
return_msg |
String |
|
Y |
返回信息提示 |
- 接口调取示例
// 组织输入参数
String printcontent = "{\"spos\":[{\"position\":\"center\",\"content\":\"POS签购单\",\"content-type\":\"txt\",\"bold\":\"0\",\"height\":\"-1\",\"italic\":\"0\",\"offset\":\"0\",\"size\":\"3\"},{\"position\":\"left\",\"content\":\"请妥善保管\",\"content-type\":\"txt\",\"bold\":\"0\",\"height\":\"-1\",\"italic\":\"0\",\"offset\":\"0\",\"size\":\"1\"}]}";
// 请求接口
Intent intent = new Intent();
intent.putExtra("print_content", printcontent);
ComponentName cn = new ComponentName("cn.lcsw.lcpos", "cn.lcsw.lcpos.activity.Exported_PrintFunc_Activity");
intent.setComponent(cn);
getActivity().startActivityForResult(intent, PRINT_REQUEST);
// 获取接口返回结果
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (resultCode) {
case Activity.RESULT_CANCELED:
String reason = data.getStringExtra("result");
// TODO
break;
case Activity.RESULT_OK:
String result = data.getStringExtra(“result”);
// TODO
break;
}
super.onActivityResult(requestCode, resultCode, data);
}
- print_content的示例:
{"spos":[
{"position":"center","content":"POS签购单","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"left","content":"请妥善保管","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"1"},
{"position":"center","content":"_____________________","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"center","content":" ","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"left","content":"商户名称(MERCHANT NAME):\n武汉市江岸区便捷货运部\n商户编号(MERCHANT NO):\n818521042150005\n终端编号(TERMINAL NO):\n60919624","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"发卡行: 04105840","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"收单行: 48180000","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"批次号(BATCH NO): 000018","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"交易类别:","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"银行卡","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"left","content":"银行卡号:","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"right","content":"623058******3229340","content-type":"txt","bold":"1","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"left","content":"凭证号: 100006","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"日期\/时间(DATA\/TIME): 2017-02-08 15:08:00","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"交易金额(AMOUNT):","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"right","content":"¥0.01","content-type":"txt","bold":"1","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"left","content":"操作员号: ","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"right","content":"3377","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"交易结果: ","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"right","content":"支付成功","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"2"},
{"position":"left","content":"持卡人签名:","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"center","content":"_____________________","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"center","content":" ","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"3"},
{"position":"center","content":"感谢您的支持,欢迎下次惠顾","content-type":"txt","bold":"0","height":"-1","italic":"0","offset":"0","size":"1"}
]}