SDK&DEMO
易百JAVA版SDK下载
易百JS版SDK下载
JAVA版SDK示例
收银插件JS SDK
1 概述
1.1 开发场景
无需展示收银台页面,根据脚本提供的方法获取收银台相关的信息资源
1.2 引入的方式
根据对接方的需求自己选择,可局部引入也可以全局引入
案例:局部引入
2 获取Token
2.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
2.2 data
2.2.1代码块
{
"uuid": "20210420-myclggrwugeniktlwwwgejr1uzmehugy",
"appId": "ebuydev100100100",
"action": "authToken",
"timestamp": 1618739210000, //此为毫秒
"lang": "zh_CN"
}
3 拉起收银台
3.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
3.2 data
3.2.1代码块
{
'uuid': "20210521-myclggrwugeniktlweegejr1uzmehugy",
'appId': "ebuydev100100100",
'action': "getCashier",
'timestamp': 1618739210000,
'content': {
'goodsDetail': [
{
'goodsId': 862715,
'goodsNum': 37,
'priceSale': 8696.9,
'goodsName': 'ieqlquzosit',
'spec': 'i',
'category': 'ouom',
'units': 'gv',
'incentiveFlag': 'dnelcp'
},
{
'goodsId': 581229,
'goodsNum': 22,
'priceSale': 5193.53,
'goodsName': 'dyeelkdoipe',
'spec': 'pqo',
'category': 'fxpo',
'units': 'rx',
'incentiveFlag': 'hpts'
},
{
'goodsId': 766204,
'goodsNum': 43,
'priceSale': 3231.9,
'goodsName': 'nzujxhportbxrwhmrvog',
'spec': 'tgt',
'category': 'jw',
'units': 'ff',
'incentiveFlag': 'iqlxaf'
},
{
'goodsId': 647950,
'goodsNum': 4,
'priceSale': 780.13,
'goodsName': 'budxamhxtywijfbftydveehkzsbhpcdssegwomdeejmdxijnnv',
'spec': 'csbbc',
'category': 'u',
'units': 'ip',
'incentiveFlag': 'fkbzeuyk'
}
],
'totalAmount': this.totalAmount,
'currency': this.currency,
'outTradeNo': this.outTradeNo,
'useScene': this.useScene,
'userInfo': {
'userId': 'd962b6c289c14cb2bee03cb49bb2453c',
'platform': 'debug'
},
'storeInfo': {
'shopNo': 'CN600001',
'deviceNo': '5+5^5+5',
'areaCode': 'uzxGMY',
'name': 'vmnvgdy'
},
'orderId': this.orderId,
'orderTitle': 'Votwlhmw Yikec Pfpnh',
'orderDesc': '候元山快验研那提参起照情却教。',
'extendInfo': {},
'oriOrderAmount': 110,
'incentivedAmount': 10,
'spbillCreateIp': '225.160.136.166',
// 'timeStart': '20191112134949',
// 'timeExpire': '20191112134949',
'timeStart': '20210512141949',
'timeExpire': this.timeExpire,
// 'assetInfo': [],
'subsidy': [
{
'account': '5604966441176654_560496644117665',
'amount': 173.504984592
},
{
'account': '4353196375445346@435319637544534',
'amount': 1691.277327537
},
{
'account': '815980830370840@815980830370840-',
'amount': 2395.39
},
{
'account': '8681349441038524+868134944103852',
'amount': 2977.08472422857
}
],
'afterPayUrl': `https://www.baidu.com`,
'cancelPayUrl': `https://www.baidu.com`
},
'lang': this.lang
}
4 获取支付渠道
4.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
4.2 data
4.2.1代码块
{
"uuid": "20210521-yvoxuukemifgpfojnhcvetksrheskrew",
"appId": "2122833592766534",
"action": "queryPluginInfo",
"timestamp": 1619084375,
"lang": "zh_CN",
"content": {
"useScene": "H5"
}
}
5 支付订单
5.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
5.2 data
5.2.1代码块
{ |
"uuid": "20210423-eefohraxoixoghloypckvknmphyduqpg", |
"appId": "ebuydev100100100", |
"action": "createTrade", |
"timestamp": 1619067380, "lang": "zh_CN", |
"content": { |
"payMethod": [{ assetType: "cash" cashAmount: "0.01" payType: "ALIPAY" }, { assetType: "cashcard" cardCoupons: "66665719526903824993744" cashAmount: "0.01" }] |
"outTradeNo": "45322123ee2212223213211eefd", |
"expiration": "1619145364000" |
}, |
} |
|
6 查询支付交易结果
6.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
6.2 data
6.2.1代码块
{
"uuid": "20210422-hmlcpdfmjkwysytgqebxtxnsfmiggoho",
"appId": "3873979181301498",
"action": "queryTrade",
"timestamp": 1619084755,
"lang": "zh_CN",
"content": {
"outTradeNo": "mock100100"
}
}
7 查询资产
7.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
7.2 data
7.2.1代码块
{
"uuid": "20210422-hmlcpdfmjkwysytgqebxtxnsfmiggoho",
"appId": "3873979181301498",
"action": "getMemberAssets",
"timestamp": 1619084755,
"lang": "zh_CN",
"content": {
"memberId": "d962b6c289c14cb2bee03cb49bb2453c",
"outTradeNo": "mock100100"
}
}
8 插件直接唤起支付
8.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
8.2 data
8.2.1代码块
{
"tokenParams":{
"uuid": "20210420-myclggrwugeniktlwwwgejr1uzmehugy",
"appId": "ebuydev100100100",
"action": "authToken",
"timestamp": 1618739210000, //此为毫秒
"lang": "zh_CN"
}
"cashierParams":{
'uuid': "20210521-myclggrwugeniktlweegejr1uzmehugy",
'appId': "ebuydev100100100",
'action': "getCashier",
'timestamp': 1618739210000,
'content': {
'goodsDetail': [
{
'goodsId': 862715,
'goodsNum': 37,
'priceSale': 8696.9,
'goodsName': 'ieqlquzosit',
'spec': 'i',
'category': 'ouom',
'units': 'gv',
'incentiveFlag': 'dnelcp'
},
{
'goodsId': 581229,
'goodsNum': 22,
'priceSale': 5193.53,
'goodsName': 'dyeelkdoipe',
'spec': 'pqo',
'category': 'fxpo',
'units': 'rx',
'incentiveFlag': 'hpts'
},
{
'goodsId': 766204,
'goodsNum': 43,
'priceSale': 3231.9,
'goodsName': 'nzujxhportbxrwhmrvog',
'spec': 'tgt',
'category': 'jw',
'units': 'ff',
'incentiveFlag': 'iqlxaf'
},
{
'goodsId': 647950,
'goodsNum': 4,
'priceSale': 780.13,
'goodsName': 'budxamhxtywijfbftydveehkzsbhpcdssegwomdeejmdxijnnv',
'spec': 'csbbc',
'category': 'u',
'units': 'ip',
'incentiveFlag': 'fkbzeuyk'
}
],
'totalAmount': this.totalAmount,
'currency': this.currency,
'outTradeNo': this.outTradeNo,
'useScene': this.useScene,
'userInfo': {
'userId': 'd962b6c289c14cb2bee03cb49bb2453c',
'platform': 'debug'
},
'storeInfo': {
'shopNo': 'CN600001',
'deviceNo': '5+5^5+5',
'areaCode': 'uzxGMY',
'name': 'vmnvgdy'
},
'orderId': this.orderId,
'orderTitle': 'Votwlhmw Yikec Pfpnh',
'orderDesc': '候元山快验研那提参起照情却教。',
'extendInfo': {},
'oriOrderAmount': 110,
'incentivedAmount': 10,
'spbillCreateIp': '225.160.136.166',
// 'timeStart': '20191112134949',
// 'timeExpire': '20191112134949',
'timeStart': '20210512141949',
'timeExpire': this.timeExpire,
// 'assetInfo': [],
'subsidy': [
{
'account': '5604966441176654_560496644117665',
'amount': 173.504984592
},
{
'account': '4353196375445346@435319637544534',
'amount': 1691.277327537
},
{
'account': '815980830370840@815980830370840-',
'amount': 2395.39
},
{
'account': '8681349441038524+868134944103852',
'amount': 2977.08472422857
}
],
'afterPayUrl': `https://www.baidu.com`,
'cancelPayUrl': `https://www.baidu.com`
},
'lang': this.lang
}
}
8.3 useScene
参数名称 |
参数类型 |
参数说明 |
是否必填 |
useScene |
string |
终端类型 WECHAT_MINI/ALIPAY_NIMI/WEB |
必须 |
8.4 type
参数名称 |
参数类型 |
参数说明 |
是否必填 |
type |
string |
插件功能类型固定:PAY_EBUY |
必须 |
8.5 success
参数名称 |
参数类型 |
参数说明 |
是否必填 |
success |
function |
调用方法事件处理成功的回调 |
必须 |
8.6 fail
参数名称 |
参数类型 |
参数说明 |
是否必填 |
fail |
function |
调用方法事件处理失败的回调 |
必须 |
9 获取小程序支付参数
9.1 方法参数
ebuyHttp(data,useScene,type,success,fail)
9.2 data
9.2.1代码块
{
"tokenParams":{
"uuid": "20210420-myclggrwugeniktlwwwgejr1uzmehugy",
"appId": "ebuydev100100100",
"action": "authToken",
"timestamp": 1618739210000, //此为毫秒
"lang": "zh_CN"
}
"cashierParams":{
'uuid': "20210521-myclggrwugeniktlweegejr1uzmehugy",
'appId': "ebuydev100100100",
'action': "getCashier",
'timestamp': 1618739210000,
'content': {
'goodsDetail': [
{
'goodsId': 862715,
'goodsNum': 37,
'priceSale': 8696.9,
'goodsName': 'ieqlquzosit',
'spec': 'i',
'category': 'ouom',
'units': 'gv',
'incentiveFlag': 'dnelcp'
},
{
'goodsId': 581229,
'goodsNum': 22,
'priceSale': 5193.53,
'goodsName': 'dyeelkdoipe',
'spec': 'pqo',
'category': 'fxpo',
'units': 'rx',
'incentiveFlag': 'hpts'
},
{
'goodsId': 766204,
'goodsNum': 43,
'priceSale': 3231.9,
'goodsName': 'nzujxhportbxrwhmrvog',
'spec': 'tgt',
'category': 'jw',
'units': 'ff',
'incentiveFlag': 'iqlxaf'
},
{
'goodsId': 647950,
'goodsNum': 4,
'priceSale': 780.13,
'goodsName': 'budxamhxtywijfbftydveehkzsbhpcdssegwomdeejmdxijnnv',
'spec': 'csbbc',
'category': 'u',
'units': 'ip',
'incentiveFlag': 'fkbzeuyk'
}
],
'totalAmount': this.totalAmount,
'currency': this.currency,
'outTradeNo': this.outTradeNo,
'useScene': this.useScene,
'userInfo': {
'userId': 'd962b6c289c14cb2bee03cb49bb2453c',
'platform': 'debug'
},
'storeInfo': {
'shopNo': 'CN600001',
'deviceNo': '5+5^5+5',
'areaCode': 'uzxGMY',
'name': 'vmnvgdy'
},
'orderId': this.orderId,
'orderTitle': 'Votwlhmw Yikec Pfpnh',
'orderDesc': '候元山快验研那提参起照情却教。',
'extendInfo': {},
'oriOrderAmount': 110,
'incentivedAmount': 10,
'spbillCreateIp': '225.160.136.166',
// 'timeStart': '20191112134949',
// 'timeExpire': '20191112134949',
'timeStart': '20210512141949',
'timeExpire': this.timeExpire,
// 'assetInfo': [],
'subsidy': [
{
'account': '5604966441176654_560496644117665',
'amount': 173.504984592
},
{
'account': '4353196375445346@435319637544534',
'amount': 1691.277327537
},
{
'account': '815980830370840@815980830370840-',
'amount': 2395.39
},
{
'account': '8681349441038524+868134944103852',
'amount': 2977.08472422857
}
],
'afterPayUrl': `https://www.baidu.com`,
'cancelPayUrl': `https://www.baidu.com`
},
'lang': this.lang
}
}