Install
$ npm install --save rs-websdk
import
es5:<script type="text/javascript" src="./node_modules/rs-websdk/rs-websdk.js"></script>es6:
Usage
支付demo: RSWALLET支付查询: RSWALLET
Document
支付接口
方法名
RSWALLET.pay()
请求参数
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
企业编码 | company_code | 是 | String(32) | wxd678efh567hg6787 | - |
二维码编码 | qr_code | 是 | String(32) | 1230000109 | - |
用户标识 | open_id | 是 | String(128) | oUpF8uMuAJO_M2pxb1Q9zNjWeS6o | 支付用户的唯一的标识(微信=open_id 支付宝=user_id) |
订单号 | order_no | 是 | String(32) | 20150806125346 | uuid生成 |
支付类型 | channel | 是 | string(32) | 20001 | 支付类型简称: 微信扫码:20001 支付宝扫码:30001 |
支付宝扫码: | amount | 是 | Int | 100 | 订单总金额, 单位:分 |
商品标题 | goods_title | 是 | String( 128) | 每日优鲜 | - |
商品描述 | goods_desc | 否 | String( 128) | 腾讯充值中心-QQ会员充值 | - |
用户自定义参数 | optional | 否 | object | {name:'1212'} | 附加数据用户自定义的参数,将会在通知中原样返回,该字段的主要用于商户携带订单的自定义数据(false) |
成功回调函数 | success | 是 | function | success:function(data){console.log('demo')} | 执行成功操作,data为返回值,详细见表(支付成功返回结果) |
失败回调函数 | error | 是 | function | error:function(data){console.log('demo')} | 执行失败操作,data为返回值,详细见表(支付失败返回结果) |
支付查询结果接口
方法名
RSWALLET.payInfo()
请求参数
字段名 | 变量名 | 类型 | 必填 | 示例值 | 描述 |
---|---|---|---|---|---|
企业编码 | company_code | String(32) | 是 | wxd678efh567hg6787 | - |
订单号 | order_no | String(32) | 是 | 20150806125346 | - |
成功回调函数 | success | function | 是 | success:function(data){console.log('demo')} | 执行成功操作,data为返回值,详细见表(支付成功返回结果) |
失败回调函数 | error | function | 是 | error:function(data){console.log('demo')} | 执行失败操作,data为返回值,详细见表(支付失败返回结果) |
支付&支付结果查询回调
支付成功返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
订单号 | serial_no | 是 | String(32) | 20150806125346 | - |
订单时间 | trade_time | 是 | String(32) | 2017-12-12 12:12 00 | - |
收款方 | goods_title | 是 | String( 128) | 每日优鲜 | - |
返回状态码 | res_code | 是 | String(16) | 100 | 100:成功 |
返回信息 | res_msg | 是 | String(128) | 签名失败 | 返回信息,如非空,为成信息 |
支付失败返回结果
字段名 | 变量名 | 必填 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
返回状态码 | res_code | 是 | String(16) | 100 | 默认100:系统支付失败 200:用户中断操作 |
返回信息 | res_msg | 是 | String(128) | 签名失败 | 返回信息,如非空,为错误原因 |
License
MIT © Sindre Sorhus