授权支付
预授权是一种金融交易方式,主要用于信用卡支付。在某些情况下,商家需要确保顾客的信用卡有足够的信用额度来支付即将发生的交易。这时,商家会向银行发起预授权请求,银行会暂时冻结顾客信用卡上的一定金额,直到交易完成或取消。
请求参数
POST
名称 | 类型 | 长度 | 必填 | 签名 | 描述 |
---|---|---|---|---|---|
txnType | String | 16 | Yes | Yes | 授权支付使用AUTH |
授权支付请求参数请参考收银台支付接口
json
{
// 其他参数请参考收银台支付接口
"txnType": "AUTH"
}
1
2
3
4
2
3
4
响应参数
名称 | 类型 | 描述 |
---|---|---|
respCode | String | 来自 Onerway 的响应码 |
respMsg | String | 来自 Onerway 的响应信息 |
data | Object | 响应数据。 请参阅对象 data |
data
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
transactionId | String | Yes | Onerway 创建的交易订单号,对应商户订单号 |
merchantTxnId | String | Yes | 顾客每次付款的订单号。 |
merchantNo | String | Yes | 商户号。 商户注册时, OnerWay 会为商户创建商户号 |
responseTime | String | Yes | 接口响应时间,格式为 yyyy-MM-dd HH:mm:ss |
txnTime | String | Yes | 交易完成时间,格式为 yyyy-MM-dd HH:mm:ss |
orderAmount | String | Yes | 订单金额。 |
orderCurrency | String | Yes | 交易订单币种。 请参阅 ISO 4217 货币代码 |
txnAmount | String | Yes | 订单金额转换成结算币种后的金额 |
txnCurrency | String | Yes | 结算币种。 请参阅 ISO 4217 货币代码 |
txnTimeZone | String | Yes | 交易时区。 请参阅 ISO 4217 货币代码 |
status | String | Yes | 交易处理结果。 请参阅 |
reason | String | Yes | 交易失败原因 |
redirectUrl | String | Yes | 收银台地址,商家拿到这个地址后,需要重定向打开。 |
sign | String | Yes | 签名字符串,请参阅签名接口 |
contractId | String | Yes | 订阅合同号:区分是哪笔订阅,完成订阅复购的重要参数。通常与tokenId 成对保存。订阅首购成功后返回,订阅复购中使用 |
tokenId | String | Yes | 订阅token :根据买家支付信息生成的支付token ,完成复购的重要参数。订阅首购成功后返回,订阅复购中使用 |
eci | String | Yes | 责任转移,3D Secure 所需参数 |
periodValue | String | Yes | 分期付款期数 |
lpmsType | String | Yes | 本地支付方式,请参阅对象 |
qrCode | String | Yes | 二维码值 |
subscriptionManageUrl | String | Yes | 订阅托管地址,买家可以通过此地址查看订阅订单信息 |
subscriptionsManageUrl | String | Yes | 订阅列表托管地址 |
授权支付请求示例
POST
json
{
"billingInformation": "{\"country\":\"DE\",\"email\":\"abel.wang@onerway.com\",\"firstName\":\"şş\",\"lastName\":\"café\",\"phone\":\"17700492982\",\"address\":\"Apt. 870\",\"city\":\"Akşehir\",\"postalCode\":\"66977\",\"identityNumber\":\"12345678\",\"province\":\"Akşehir\"}",
"merchantCustId": "1721788143000",
"merchantNo": "800209",
"merchantTxnId": "1721788143000",
"merchantTxnTime": "2024-07-24 10:29:03",
"merchantTxnTimeZone": "+08:00",
"orderAmount": "100",
"orderCurrency": "USD",
"productType": "CARD",
"shippingInformation": "{\"country\":\"DE\",\"email\":\"abel.wang@onerway.com\",\"firstName\":\"şş\",\"lastName\":\"café\",\"phone\":\"17700492982\",\"address\":\"Apt. 870\",\"city\":\"Akşehir\",\"postalCode\":\"66977\",\"identityNumber\":\"12345678\",\"province\":\"Akşehir\"}",
"sign": "efdca32780a8a58918c9fa333cb8aba72586a77eb87b4b0961d4556ed210928a",
"subProductType": "DIRECT",
"txnOrderMsg": "{\"returnUrl\":\"https://docs.onerway.com/\",\"products\":\"[{\\\"price\\\":\\\"110.00\\\",\\\"num\\\":\\\"1\\\",\\\"name\\\":\\\"iphone11\\\",\\\"currency\\\":\\\"USD\\\"}]\",\"transactionIp\":\"127.0.0.1\",\"appId\":\"1739545982264549376\",\"javaEnabled\":false,\"colorDepth\":\"24\",\"screenHeight\":\"1080\",\"screenWidth\":\"1920\",\"timeZoneOffset\":\"-480\",\"accept\":\"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\",\"userAgent\":\"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\",\"contentLength\":\"340\",\"language\":\"zh-CN\"}",
"txnType": "AUTH"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
json
{
"respCode": "20000",
"respMsg": "Success",
"data": {
"transactionId": "1815937211611619328",
"merchantTxnId": "1721788143000",
"merchantNo": "800209",
"responseTime": "",
"txnTime": "",
"orderAmount": "100.00",
"orderCurrency": "USD",
"txnAmount": "",
"txnCurrency": null,
"txnTimeZone": null,
"status": "U",
"reason": null,
"redirectUrl": "https://sandbox-checkout.onerway.com/checkout?key=be2093ebb79241e1b0f28296ef8f28f7",
"sign": "4b059cbfbc3a7b748f15ea0a56bdd77faf26d8cb06e3cedd99fae3ced3df8f9a",
"contractId": "",
"tokenId": null,
"eci": null,
"transactionOrderNo": null,
"periodValue": null,
"lpmsType": null,
"qrCode": null
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
若请求成功,商家需要获取响应参数中的redirectUrl,然后进行重定向打开。
授权支付成功示例
json
https://www.merchant-store-website.com/?transactionId=1815937211611619328&merchantTxnId=1721788143000&merchantNo=800209&responseTime=2024-07-10%2017:35:43&txnTime=2024-07-10%2017:35:22&txnTimeZone=+08:00&orderAmount=100.00&orderCurrency=USD&txnAmount=100.00&txnCurrency=USD&status=S&reason=Payment%20successful&eci=5
1
json
{
"notifyType": "TXN",
"transactionId": "1815937211611619328",
"txnType": "AUTH",
"merchantNo": "800209",
"merchantTxnId": "1721788143000",
"responseTime": "2024-07-10 17:35:42",
"txnTime": "2024-07-10 17:35:22",
"txnTimeZone": "+08:00",
"orderAmount": "100.00",
"orderCurrency": "USD",
"txnAmount": "",
"status": "S",
"contractId": "",
"tokenId": "",
"eci": "5",
"reason": "{\"respCode\":\"20000\",\"respMsg\":\"Success\"}",
"sign": "4b059cbfbc3a7b748f15ea0a56bdd77faf26d8cb06e3cedd99fae3ced3df8f9a",
"paymentMethod": "VISA"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
授权扣款
注意
- 商户需保存预授权流水号
transactionId
,以便在后续的扣款请求中使用 - 预授权成功后,扣款请调用扣款接口