跳转至

1.标准收单

标准收单

1.使用场景

适用于与第三方供应商(商家)对接支付关爱通时,使用。商家在其页面完成购物后,点击关爱通支付,调用关爱通接口获取到关爱通支付地址,进行跳转(自适应客户端,显示PC或移动端支付页面),完成支付校验后,扣除关爱通资产,完成订单。

2.该接口使用需知

1.请求URL时,请不要添加额外参数,签名时会用对所有参数进行签名;

2.商家服务端按规则拼接好URL后(各参数建议经过Urlencode),通知浏览器进行302跳转;

3.支付完成后会立即跳转到“return_url”,建议商家此时显示支付中页面;

4.请一定要提供接口,接收notify请求,并及时返回结果(“success”);

5.支付状态请根据notify_url的请求(或者根据订单查询接口)来判断,千万不能根据return_url中的pay_result。

3.时序图

img

4.接口调用说明

请求URL https://openapi.guanaitong.com/seller/v3/pay/excashier

HTTP请求方式 POST

输入参数说明

(1)公共参数 发送请求时必须传入公共参数,详见公共参数

(2)私有参数

参数名称 是否必须 参数类型 长度限制 描述
outerTradeNo String [2,50] 外部交易号,请以appid开头
timeOrdered string 50 下单时间,格式(yyyy-MM-dd HH:mm:ss)
buyerOpenId String 32 下单员工唯一标识
reason String [0,245] 买家备注
totalAmount BigDecimal (10, 2) 订单总金额(含运费),支付的总金额
costAmount BigDecimal (10, 2) 订单结算成本价,差价模式下,costAmount与tradeInfo必填其一
tradeInfo Object 订单信息
attach string [0,100] 附加信息,原样返回,复杂参数建议urlencode
tradeType int 1 交易类型 1即时交易 2非即时交易 默认为即时交易
returnUrl string [1,254] 支付完成后,跳转的商家订单显示URL
notifyUrl string [1,254] 商家提供的notifyUrl。订单完成后,关爱通会对此URL进行请求,通知商家订单成功
expireTime string [0,50] 订单支付超时时间,格式(yyyy-MM-dd HH:mm:ss)
provinceCode String [0,50] 消费省会编码
provinceName String [0,50] 消费省会
cityCode String [0,50] 消费城市编码
cityName String [0,50] 消费城市
locationCode String [0,50] 消费地区编码
locationName String [0,50] 消费地区
shopName String [0,100] 商家名称
shopPhone String [0,50] 商家电话
shopAddress String [0,500] 商家地址
poiCateCode String [0,100] 商家一级品类code
poiCateDesc String [0,100] 商家一级品类名称
poi2ndCateCode String [0,100] 商家二级品类code
poi2ndCateDesc String [0,100] 商家二级品类名称
poi3rdCateCode String [0,100] 商家三级品类code
poi3rdCateDesc String [0,100] 商家三级品类名称
recipientName String [0,50] 收货人名称
recipientPhone String [0,50] 收货人电话
recipientAddress String [0,500] 收货人地址

TradeInfo对象

参数名称 是否必须 参数类型 长度限制 描述
thirdTradeNo string [1,50] 第三方订单号
thirdTotalAmount decimal [0.01,99999999.99] 订单总金额
thirdPayAmount decimal [0.01,99999999.99] 支付总金额
thirdCostAmount decimal [0.00,99999999.99] 结算总成本价
thirdDeliveryFee decimal [0.00,99999999.99] 有运费必填 运费
isThirdOrders int 1 是否有子订单 1有 2无
thirdOrders object 有子订单必填。子订单信息列表,List 请按照商家拆分子订单
goodsDetail object 无子订单必填。商品信息列表,List

注意 在返点模式下: thirdPayAmount与thirdCostAmount金额要保持一致

ThirdOrder对象:

参数名称 是否必须 参数类型 长度限制 描述
outerTradeNo String [2,50] 子订单的外部交易号,请以appid开头,不能与主订单一致
thirdSubTradeNo string [1,50] 第三方子订单编号
thirdSubDeliveryFee decimal [0.00,99999999.99] 有运费必填 运费
thirdSubTotalAmount decimal [0.01,99999999.99] 子订单原金额
thirdSubPayAmount decimal [0.01,99999999.99] 子订单原支付金额
thirdSubCostAmount decimal [0.00,99999999.99] 子订单原结算成本价
goodsDetail object 商品信息列表,List

GoodsDetail数据:

参数名称 是否必须 参数类型 长度限制 描述 示例
skuCode String [1, 50] 商品编码 100013952938
skuName String [1, 50] 商品名称 蒙牛 特仑苏脱脂纯牛奶 每100ml含3.6g乳蛋白 送礼推荐 250ml×16 礼盒装
skuCateCode String [0,100] 商品一级品类code
skuCateDesc String [0,100] 商品一级品类名称
sku2ndCateCode String [0,100] 商品二级品类code
sku2ndCateDesc String [0,100] 商品二级品类名称
sku3rdCateCode String [0,100] 商品三级品类code
sku3rdCateDesc String [0,100] 商品三级品类名称
quantity Integer 32 数量 1
price BigDecimal (10, 2) 商品单价 115.35
taxRate BigDecimal (10, 2) 税率 13
taxCode String [1, 50] 税收分类编码 1060406010000000000
taxUnit String [1, 20] 开票单位
invoiceType Integer 32 发票类型 (1:普票 2:专票) 2
amount BigDecimal (10, 2) 商品金额(price * quantity) 115.35
gatAmount BigDecimal (10, 2) 关爱通资产支付金额 115.35
costAmount BigDecimal (10, 2) 关爱通结算价 115.35
freight BigDecimal (10, 2) 运费(非单个商品的运费) 8

返回示例

{
    "code": 0,
    "msg": "OK",
    "data": {
        "outerTradeNo":"200913220230728003450944707739",
        "redirectUrl":"https://excashier.guanaitong.com/entry?reason=%E5%8F%AE%E5%92%9A%E4%B9%B0%E8%8F%9C-2307281159271857739&outer_trade_no=200913220230728003450944707739&owner_id=xxx&sign=8810E9B3888D5923763DF8C648F4FEA771D7DA74&source_appid=20091322&signtype=SHA1&notify_url=https%3A%2F%2Fopenapi.guanaitong.com%2Fseller%2Fpay%2FnotifyUrl&encoding=UTF-8&output=JSON&point_payer_id=xxx&total=44.00&issync=2&apiname=gat.account.pay&v=3.0&appid=20091322&return_url=https%3A%2F%2Fopenapi.guanaitong.com%2Fseller%2Fpay%2FreturnUrl&point_payee_id=%E5%8F%AE%E5%92%9A%E4%B9%B0%E8%8F%9C%E7%9B%B4%E8%BF%9E&timestamp=20230728112919"
    }
}
说明

合作方拿到回调地址,进行302跳转

注意:请求需要经过Urlencoded

5. 跳回商家页面

请求URL

调用支付接口时,填写的**returnUrl**

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.com/?outer_trade_no=100000010000000001&appid=10000001&
timestamp=1537253931&sign=c9a7ede47d9f40a599d76e98a8c8a039d7ae4e2d&pay_result=success

跳转说明

(1)用户支付完成后,会跳转到商家填写的return_url地址; (2)商家根据outerTradeNo进入订单支付中的页面; (3)商家服务端等待来自关爱通的notify通知,更新订单状态后,页面改为订单成功;

6.支付异步回调

请求URL

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

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.com
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
回到页面顶部