统一下单
curl --request POST \
--url https://sandbox-pay.epay123.net/api/pay/unifiedOrder \
--header 'Content-Type: application/json' \
--data '
{
"version": "1.0.1",
"signType": "MD5",
"sign": "xxxxxx",
"reqTime": "1622016572190",
"mchNo": "M1234567890",
"appId": "88808634c46ff1a7807888888",
"mchOrderNo": "mho1624005107281",
"wayCode": "QR_CASHIER",
"amount": 100,
"currency": "USD",
"subject": "商品标题",
"body": "商品描述",
"clientIp": "192.166.1.132",
"notifyUrl": "https://xxx/notify",
"returnUrl": "https://xxx/returnUrl",
"expiredTime": 3600,
"channelExtra": "{\"authCode\":\"280812820366966512\"}",
"extParam": "{}",
"divisionMode": 1,
"channelUserId": "<string>"
}
'import requests
url = "https://sandbox-pay.epay123.net/api/pay/unifiedOrder"
payload = {
"version": "1.0.1",
"signType": "MD5",
"sign": "xxxxxx",
"reqTime": "1622016572190",
"mchNo": "M1234567890",
"appId": "88808634c46ff1a7807888888",
"mchOrderNo": "mho1624005107281",
"wayCode": "QR_CASHIER",
"amount": 100,
"currency": "USD",
"subject": "商品标题",
"body": "商品描述",
"clientIp": "192.166.1.132",
"notifyUrl": "https://xxx/notify",
"returnUrl": "https://xxx/returnUrl",
"expiredTime": 3600,
"channelExtra": "{\"authCode\":\"280812820366966512\"}",
"extParam": "{}",
"divisionMode": 1,
"channelUserId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
version: '1.0.1',
signType: 'MD5',
sign: 'xxxxxx',
reqTime: '1622016572190',
mchNo: 'M1234567890',
appId: '88808634c46ff1a7807888888',
mchOrderNo: 'mho1624005107281',
wayCode: 'QR_CASHIER',
amount: 100,
currency: 'USD',
subject: '商品标题',
body: JSON.stringify('商品描述'),
clientIp: '192.166.1.132',
notifyUrl: 'https://xxx/notify',
returnUrl: 'https://xxx/returnUrl',
expiredTime: 3600,
channelExtra: '{"authCode":"280812820366966512"}',
extParam: '{}',
divisionMode: 1,
channelUserId: '<string>'
})
};
fetch('https://sandbox-pay.epay123.net/api/pay/unifiedOrder', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-pay.epay123.net/api/pay/unifiedOrder",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'version' => '1.0.1',
'signType' => 'MD5',
'sign' => 'xxxxxx',
'reqTime' => '1622016572190',
'mchNo' => 'M1234567890',
'appId' => '88808634c46ff1a7807888888',
'mchOrderNo' => 'mho1624005107281',
'wayCode' => 'QR_CASHIER',
'amount' => 100,
'currency' => 'USD',
'subject' => '商品标题',
'body' => '商品描述',
'clientIp' => '192.166.1.132',
'notifyUrl' => 'https://xxx/notify',
'returnUrl' => 'https://xxx/returnUrl',
'expiredTime' => 3600,
'channelExtra' => '{"authCode":"280812820366966512"}',
'extParam' => '{}',
'divisionMode' => 1,
'channelUserId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-pay.epay123.net/api/pay/unifiedOrder"
payload := strings.NewReader("{\n \"version\": \"1.0.1\",\n \"signType\": \"MD5\",\n \"sign\": \"xxxxxx\",\n \"reqTime\": \"1622016572190\",\n \"mchNo\": \"M1234567890\",\n \"appId\": \"88808634c46ff1a7807888888\",\n \"mchOrderNo\": \"mho1624005107281\",\n \"wayCode\": \"QR_CASHIER\",\n \"amount\": 100,\n \"currency\": \"USD\",\n \"subject\": \"商品标题\",\n \"body\": \"商品描述\",\n \"clientIp\": \"192.166.1.132\",\n \"notifyUrl\": \"https://xxx/notify\",\n \"returnUrl\": \"https://xxx/returnUrl\",\n \"expiredTime\": 3600,\n \"channelExtra\": \"{\\\"authCode\\\":\\\"280812820366966512\\\"}\",\n \"extParam\": \"{}\",\n \"divisionMode\": 1,\n \"channelUserId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-pay.epay123.net/api/pay/unifiedOrder")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"1.0.1\",\n \"signType\": \"MD5\",\n \"sign\": \"xxxxxx\",\n \"reqTime\": \"1622016572190\",\n \"mchNo\": \"M1234567890\",\n \"appId\": \"88808634c46ff1a7807888888\",\n \"mchOrderNo\": \"mho1624005107281\",\n \"wayCode\": \"QR_CASHIER\",\n \"amount\": 100,\n \"currency\": \"USD\",\n \"subject\": \"商品标题\",\n \"body\": \"商品描述\",\n \"clientIp\": \"192.166.1.132\",\n \"notifyUrl\": \"https://xxx/notify\",\n \"returnUrl\": \"https://xxx/returnUrl\",\n \"expiredTime\": 3600,\n \"channelExtra\": \"{\\\"authCode\\\":\\\"280812820366966512\\\"}\",\n \"extParam\": \"{}\",\n \"divisionMode\": 1,\n \"channelUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-pay.epay123.net/api/pay/unifiedOrder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": \"1.0.1\",\n \"signType\": \"MD5\",\n \"sign\": \"xxxxxx\",\n \"reqTime\": \"1622016572190\",\n \"mchNo\": \"M1234567890\",\n \"appId\": \"88808634c46ff1a7807888888\",\n \"mchOrderNo\": \"mho1624005107281\",\n \"wayCode\": \"QR_CASHIER\",\n \"amount\": 100,\n \"currency\": \"USD\",\n \"subject\": \"商品标题\",\n \"body\": \"商品描述\",\n \"clientIp\": \"192.166.1.132\",\n \"notifyUrl\": \"https://xxx/notify\",\n \"returnUrl\": \"https://xxx/returnUrl\",\n \"expiredTime\": 3600,\n \"channelExtra\": \"{\\\"authCode\\\":\\\"280812820366966512\\\"}\",\n \"extParam\": \"{}\",\n \"divisionMode\": 1,\n \"channelUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "成功",
"data": {
"payOrderId": "P202106181642329900002",
"mchOrderNo": "mho1624005752661",
"orderState": 3,
"payDataType": "<string>",
"payData": "<string>",
"errCode": "ACQ.PAYMENT_AUTH_CODE_INVALID",
"errMsg": "Business Failed"
},
"sign": "<string>"
}支付订单接口
统一下单
商户业务系统通过统一下单接口发起支付收款订单,支付网关会根据商户配置的支付通道路由支付通道完成支付下单。支付网关根据不同的支付方式返回对应的支付参数,业务系统使用支付参数发起收款。
POST
/
api
/
pay
/
unifiedOrder
统一下单
curl --request POST \
--url https://sandbox-pay.epay123.net/api/pay/unifiedOrder \
--header 'Content-Type: application/json' \
--data '
{
"version": "1.0.1",
"signType": "MD5",
"sign": "xxxxxx",
"reqTime": "1622016572190",
"mchNo": "M1234567890",
"appId": "88808634c46ff1a7807888888",
"mchOrderNo": "mho1624005107281",
"wayCode": "QR_CASHIER",
"amount": 100,
"currency": "USD",
"subject": "商品标题",
"body": "商品描述",
"clientIp": "192.166.1.132",
"notifyUrl": "https://xxx/notify",
"returnUrl": "https://xxx/returnUrl",
"expiredTime": 3600,
"channelExtra": "{\"authCode\":\"280812820366966512\"}",
"extParam": "{}",
"divisionMode": 1,
"channelUserId": "<string>"
}
'import requests
url = "https://sandbox-pay.epay123.net/api/pay/unifiedOrder"
payload = {
"version": "1.0.1",
"signType": "MD5",
"sign": "xxxxxx",
"reqTime": "1622016572190",
"mchNo": "M1234567890",
"appId": "88808634c46ff1a7807888888",
"mchOrderNo": "mho1624005107281",
"wayCode": "QR_CASHIER",
"amount": 100,
"currency": "USD",
"subject": "商品标题",
"body": "商品描述",
"clientIp": "192.166.1.132",
"notifyUrl": "https://xxx/notify",
"returnUrl": "https://xxx/returnUrl",
"expiredTime": 3600,
"channelExtra": "{\"authCode\":\"280812820366966512\"}",
"extParam": "{}",
"divisionMode": 1,
"channelUserId": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
version: '1.0.1',
signType: 'MD5',
sign: 'xxxxxx',
reqTime: '1622016572190',
mchNo: 'M1234567890',
appId: '88808634c46ff1a7807888888',
mchOrderNo: 'mho1624005107281',
wayCode: 'QR_CASHIER',
amount: 100,
currency: 'USD',
subject: '商品标题',
body: JSON.stringify('商品描述'),
clientIp: '192.166.1.132',
notifyUrl: 'https://xxx/notify',
returnUrl: 'https://xxx/returnUrl',
expiredTime: 3600,
channelExtra: '{"authCode":"280812820366966512"}',
extParam: '{}',
divisionMode: 1,
channelUserId: '<string>'
})
};
fetch('https://sandbox-pay.epay123.net/api/pay/unifiedOrder', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox-pay.epay123.net/api/pay/unifiedOrder",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'version' => '1.0.1',
'signType' => 'MD5',
'sign' => 'xxxxxx',
'reqTime' => '1622016572190',
'mchNo' => 'M1234567890',
'appId' => '88808634c46ff1a7807888888',
'mchOrderNo' => 'mho1624005107281',
'wayCode' => 'QR_CASHIER',
'amount' => 100,
'currency' => 'USD',
'subject' => '商品标题',
'body' => '商品描述',
'clientIp' => '192.166.1.132',
'notifyUrl' => 'https://xxx/notify',
'returnUrl' => 'https://xxx/returnUrl',
'expiredTime' => 3600,
'channelExtra' => '{"authCode":"280812820366966512"}',
'extParam' => '{}',
'divisionMode' => 1,
'channelUserId' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox-pay.epay123.net/api/pay/unifiedOrder"
payload := strings.NewReader("{\n \"version\": \"1.0.1\",\n \"signType\": \"MD5\",\n \"sign\": \"xxxxxx\",\n \"reqTime\": \"1622016572190\",\n \"mchNo\": \"M1234567890\",\n \"appId\": \"88808634c46ff1a7807888888\",\n \"mchOrderNo\": \"mho1624005107281\",\n \"wayCode\": \"QR_CASHIER\",\n \"amount\": 100,\n \"currency\": \"USD\",\n \"subject\": \"商品标题\",\n \"body\": \"商品描述\",\n \"clientIp\": \"192.166.1.132\",\n \"notifyUrl\": \"https://xxx/notify\",\n \"returnUrl\": \"https://xxx/returnUrl\",\n \"expiredTime\": 3600,\n \"channelExtra\": \"{\\\"authCode\\\":\\\"280812820366966512\\\"}\",\n \"extParam\": \"{}\",\n \"divisionMode\": 1,\n \"channelUserId\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox-pay.epay123.net/api/pay/unifiedOrder")
.header("Content-Type", "application/json")
.body("{\n \"version\": \"1.0.1\",\n \"signType\": \"MD5\",\n \"sign\": \"xxxxxx\",\n \"reqTime\": \"1622016572190\",\n \"mchNo\": \"M1234567890\",\n \"appId\": \"88808634c46ff1a7807888888\",\n \"mchOrderNo\": \"mho1624005107281\",\n \"wayCode\": \"QR_CASHIER\",\n \"amount\": 100,\n \"currency\": \"USD\",\n \"subject\": \"商品标题\",\n \"body\": \"商品描述\",\n \"clientIp\": \"192.166.1.132\",\n \"notifyUrl\": \"https://xxx/notify\",\n \"returnUrl\": \"https://xxx/returnUrl\",\n \"expiredTime\": 3600,\n \"channelExtra\": \"{\\\"authCode\\\":\\\"280812820366966512\\\"}\",\n \"extParam\": \"{}\",\n \"divisionMode\": 1,\n \"channelUserId\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox-pay.epay123.net/api/pay/unifiedOrder")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": \"1.0.1\",\n \"signType\": \"MD5\",\n \"sign\": \"xxxxxx\",\n \"reqTime\": \"1622016572190\",\n \"mchNo\": \"M1234567890\",\n \"appId\": \"88808634c46ff1a7807888888\",\n \"mchOrderNo\": \"mho1624005107281\",\n \"wayCode\": \"QR_CASHIER\",\n \"amount\": 100,\n \"currency\": \"USD\",\n \"subject\": \"商品标题\",\n \"body\": \"商品描述\",\n \"clientIp\": \"192.166.1.132\",\n \"notifyUrl\": \"https://xxx/notify\",\n \"returnUrl\": \"https://xxx/returnUrl\",\n \"expiredTime\": 3600,\n \"channelExtra\": \"{\\\"authCode\\\":\\\"280812820366966512\\\"}\",\n \"extParam\": \"{}\",\n \"divisionMode\": 1,\n \"channelUserId\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"code": 200,
"msg": "成功",
"data": {
"payOrderId": "P202106181642329900002",
"mchOrderNo": "mho1624005752661",
"orderState": 3,
"payDataType": "<string>",
"payData": "<string>",
"errCode": "ACQ.PAYMENT_AUTH_CODE_INVALID",
"errMsg": "Business Failed"
},
"sign": "<string>"
}Body
application/json
统一下单请求参数
版本号
Example:
"1.0.1"
签名类型,目前只支持MD5方式
Example:
"MD5"
签名值,详见签名算法
Example:
"xxxxxx"
时间戳,13位时间戳
Example:
"1622016572190"
商户号
Example:
"M1234567890"
商户应用ID
Example:
"88808634c46ff1a7807888888"
商户订单号
Example:
"mho1624005107281"
支付方式 如: QR_CASHIER、CB_COIN_ADDR等
Example:
"QR_CASHIER"
支付金额, 单位:分
Required range:
x >= 1Example:
100
货币代码
Example:
"USD"
商品标题
Example:
"商品标题"
商品描述信息
Example:
"商品描述"
客户端IP地址
Example:
"192.166.1.132"
异步通知地址
Example:
"https://xxx/notify"
跳转通知地址
Example:
"https://xxx/returnUrl"
订单失效时间, 单位:秒
Example:
3600
特定渠道发起额外参数
Example:
"{\"authCode\":\"280812820366966512\"}"
商户扩展参数
Example:
"{}"
分账模式: 0-该笔订单不允许分账, 1-支付成功按配置自动完成分账, 2-商户手动分账(解冻商户金额)
Example:
1
