文档中心 员工接口 员工免密支付

员工免密支付

1.功能说明

员工免密支付

注意:

使用此接口需事先将企业信息和商家信息报备给关爱通,有关爱通人员配置后才可使用。

2.接口调用说明

请求URL

https://openapi.guanaitong.tech/employee/checkUserAndToPay

HTTP请求方式

POST

输入参数说明

(1)公共参数

发送请求是必须传入公共参数,详见公共参数

(2)私有参数

参数名称 是否必须 参数类型 长度限制 描述
auth_code string [40] 授权码,只能使用一次,并且有效期为1分钟(正式),失效请重新获取;见信任登录获取员工授权码
seller_appid string 32 商家apppid,由关爱通线下提供
outer_trade_no string [10,30] 外部交易号,seller_appid开头,例如:1000000122
pay_type int [1] 支付类型 1、积分支付 2、额度支付[员工额度资产为多个的时候,下面的account_openid不能为空]
point decimal [0.01,99999999.99] 下单金额
reason string [1,254] 下单原因
account_openid string 32 当pay_type为2时,即额度支付时,如果员工有多个额度资产,这个参数同步,否则报错;当员工额度只有一个时可以不填;获取见员工资产接口
return_url string [1,2000] 支付完成后,跳转的商家订单显示URL
notify_url string [1,254] 商家提供的notify_url。订单完成后,关爱通会对此URL进行请求,通知商家订单成功
attach string [1,100] 附加信息,原样返回,复杂参数建议urlencode
trade_info string [1,4000] 同步 交易详情,JSON格式。内容如下

(3)trade_info对象

参数名称 是否必须 参数类型 长度限制 描述
third_trade_no string [1,50] 第三方订单号
third_total_amount decimal [0.01,99999999.99] 订单原金额
third_pay_amount decimal [0.01,99999999.99] 支付金额
third_cost_amount decimal [0.00,99999999.99] 结算成本价
is_third_orders int 1 是否有子订单 1有 2无
third_orders list 有子订单同步。子订单信息列表,List«third_order»
goods_detail list 无子订单同步。商品信息列表,List«goods_detail»

(4)third_order对象

参数名称 是否必须 参数类型 长度限制 描述
third_sub_trade_no string [1,50] 第三方子订单编号
third_sub_delivery_fee decimal [0.00,99999999.99] 有运费同步 否则填0
third_sub_total_amount decimal [0.01,99999999.99] 子订单原金额
third_sub_pay_amount decimal [0.01,99999999.99] 子订单原支付金额
third_sub_cost_amount decimal [0.00,99999999.99] 子订单原结算成本价
goods_detail list 商品信息列表,List«goods_detail»

(5)goods_detail对象

参数名称 是否必须 参数类型 长度限制 描述
sku_id string [1,50] 商品编号
name string [1,50] 商品名称
quantity int 最少为1 数量
good_price decimal [0.01,99999999.99] 原价,若商品支付价格和原价一致,可以不填支付价,否则建议填写
good_pay_amount decimal [0.00,99999999.99] 支付价
good_cost_amount decimal [0.00,99999999.99] 成本价
请求示例urlencoded前(浏览器的URL)为:
https://openapi.guanaitong.tech/employee/checkUserAndToPay?reason=测试支付&
outer_trade_no=201107831558403602084&sign=ab6e9c377c45020f0e1681d5d6da2e620dcc021e&
notify_url=http://10.100.32.228:8087/open/notify&version=1.0.0&point=10.2&
trade_info={"third_pay_amount":1,"third_cost_amount":0,"third_total_amount":1,"is_third_orders":2,"third_trade_no":1212,
"goods_detail":[{"good_price":2,"quantity":2,"name":2,"sku_id":2,"good_cost_amount":0,"good_pay_amount":2}]}&
auth_code=828544880731AA6035EA247DDF72FD65229F7F27&access_token=4d65b389ed98f9f033d3701d4fa847b5&account_openid=
c2e74b2af66bf79921281ea8d5b38d7c&return_url=http://10.100.32.228:8087/open/return&pay_type=2&seller_appid=20110783&
timestamp=1558403602
                    
请求示例经过Urlencoded后(浏览器的URL)为:
https://openapi.guanaitong.tech/employee/checkUserAndToPay?reason=%E6%B5%8B%E8%AF%95%E6%94%AF%E4%BB%98&
outer_trade_no=201107831558403602084&sign=ab6e9c377c45020f0e1681d5d6da2e620dcc021e¬ify_url=http%3A%2F%2F10.100.32.228%3A8087%2Fopen%2Fnotify&
version=1.0.0&point=10.2&trade_info=%7B%22third_pay_amount%22%3A1%2C%22third_cost_amount%22%3A0%2C%22third_total_amount%22%3A1%2C%22is_third_orders%22%3A2%2C%22
third_trade_no%22%3A1212%2C%22goods_detail%22%3A%5B%7B%22good_price%22%3A2%2C%22quantity%22%3A2%2C%22name%22%3A2%2C%22sku_id%22%3A2%2C%22good_cost_amount%22%3A0%2C%22
good_pay_amount%22%3A2%7D%5D%7D&auth_code=828544880731AA6035EA247DDF72FD65229F7F27&
access_token=4d65b389ed98f9f033d3701d4fa847b5&account_openid=c2e74b2af66bf79921281ea8d5b38d7c&
return_url=http%3A%2F%2F10.100.32.228%3A8087%2Fopen%2Freturn&pay_type=2&seller_appid=20110783&
timestamp=1558403602

                    

4.从关爱通收银台,跳回商家页面(return_url)

请求URL

调用支付接口时,填写的return_url

HTTP请求方式

GET

跳转页面

输入参数说明
参数名称 参数类型 描述
appid string 应用appid
outer_trade_no string 跳转收银台时传递的外部交易号
attach string 前面附带的信息
pay_result string success成功 fail 失败
timestamp string 时间戳,其值为1970-1-01 00:00:00.000到当前时刻的时间距离,单位是秒,时区为GMT+8(东八区)。如1469691921。关爱通接口允许的时间戳偏差为5分钟,偏差超过5分钟的请求将被拒绝。
sign string 签名,见 签名机制
请求示例(浏览器URL)为:
https://test.guanaitong.tech/?outer_trade_no=100000010000000001&appid=10000001&
timestamp=1537253931&sign=c9a7ede47d9f40a599d76e98a8c8a039d7ae4e2d&pay_result=success
                    
跳转说明

(1)用户支付完成后,会跳转到商家填写的return_url地址;

(2)商家根据outerTradeNo进入订单支付中的页面;

(3)商家服务端等待来自关爱通的notify通知,更新订单状态后,页面改为订单成功;

5.支付回调(notify_url)

请求URL

调用支付接口时,填写的notify_url

HTTP请求方式

POST

输入参数说明
参数名称 参数类型 描述
appid string 应用appid
outer_trade_no string 外部交易号
buyer_open_id string 下单人open_id
attach string 前面附带的信息
total_amount decimal 下单金额
trade_no string 关爱通交易号
timestamp string 时间戳,其值为1970-1-01 00:00:00.000到当前时刻的时间距离,单位是秒,时区为GMT+8(东八区)。如1469691921。关爱通接口允许的时间戳偏差为5分钟,偏差超过5分钟的请求将被拒绝。
sign string 签名,见 签名机制
请求示例
POST 商家URI,如:/syncPay/notify HTTP/1.1
Host: 商家域名,如:test.guanaitong.tech
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache

appid=10000001&outer_trade_no=100000010000000001&total_amount=100.00&
buyer_open_id=d87797eea12a2f80ad72ed93214a0908&trade_no=2018070920000005&
timestamp=1531120153&sign=31f531d0ca40e6d7fb02688564f637f458e63ec8
                    
返回参数说明

(1)notify只有在关爱通订单成功后才会发送;

(2)商家在收到了请求、校验通过后,请即时更新自己的订单状态,并返回success(不要带任何其他源码内容);

(3)若关爱通的notify请求无响应或者接收的内容不是“success”,则认为通知失败,等一段时间后会再次请求(notify请求会在此后24小时内按递增时间间隔继续发送通知);

(4)notify仅为通知,不论第三方返回成功或失败,都不会改变关爱通的订单状态;

正确返回示例
success
错误返回示例
fail