申请代付查询
请求地址
POST
https://sandbox.j-pay.net/api/v1/payment/getOrder
测试账号
Merchant ID:10010
ApiKey: 7e4nicn14nhyup146dfbi8hpnpus9juz
请求参数
参数名称 | 类型 | 是否必填 | 参与签名 | 参数说明 |
---|---|---|---|---|
memberid | String | 是 | 是 | 平台分配商户号 |
out_trade_no | String(100) | 是 | 是 | 上送订单号唯一, 字符长度100 |
transaction_id | String | 是 | 是 | 平台流水号 |
sign | String | 是 | 否 | 请看MD5签名处理 |
返回参数
参数名称 | 类型 | 参数说明 |
---|---|---|
memberid | String | 商户号 |
tradetype | String | 交易类型 |
transaction_id | String | 平台流水号 |
out_trade_no | String | 商户订单号 |
amount | String | 总金额 |
actualamount | String | 实际金额 |
fees | String | 手续费 |
currency | String | 币种 |
payeeaccount | String | 收款账号 |
create_time | String | 订单创建时间 |
trans_time | String | 订单交易时间 |
status | String | 订单状态 SUCCESS: 成功 FAIL: 失败 TRANSFERING: 转账中 ERROR: 审核失败,提交信息有误 |
msg | String | 订单状态为ERROR返回 |
sign | String | 请看MD5签名处理 |
示例
请求
- Javascript
- Php
- Python
import { md5 } from "js-md5";
import axios from "axios";
const KEY = "7e4nicn14nhyup146dfbi8hpnpus9juz";
const MEMBER_ID = "10010";
let query = {
memberid: MEMBER_ID,
out_trade_no: "O1722050251979",
transaction_id: "151398410112",
};
let signData = [];
Object.keys(query)
.sort()
.forEach((key) => signData.push(`${key}=${query[key]}`));
signData.push(`key=${KEY}`);
query.sign = md5(signData.join("&")).toUpperCase()
axios
.request({
url: "https://sandbox.j-pay.net/api/v1/payment/getOrder",
method: "post",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
data: query,
})
.then(({ data }) => {
console.log("success", data);
})
.catch((error) => {
console.log("error", error);
});
$url = 'https://sandbox.j-pay.net/api/v1/payment/getOrder';
$secretKey = '7e4nicn14nhyup146dfbi8hpnpus9juz';
$memberId = '10010';
$data = [
'memberid' => $memberId,
'out_trade_no' => 'O1722050251979',
'transaction_id' => '151398410112',
];
ksort($data);
$md5str = "";
foreach ($data as $key => $val) {
if (!empty($val)) {
$md5str .= $key . "=" . $val . "&";
}
}
$sign_str = $md5str . 'key=' . $secretKey;
$sign = strtoupper(md5($sign_str));
$data['sign'] = $sign;
$header = [
'Content-Type: application/x-www-form-urlencoded',
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
$data = curl_exec($ch);
if (curl_error($ch)) {
echo 'Curl error: ' . curl_error($ch); exit;
}
curl_close($ch);
var_dump($data);
import hashlib
import requests
url = 'https://sandbox.j-pay.net/api/v1/payment/getOrder'
key = '7e4nicn14nhyup146dfbi8hpnpus9juz'
params = {
'memberid': '10010',
'out_trade_no': 'O1722050251979',
'transaction_id': '151398410112',
}
strParam = ''
for p in sorted(params):
strParam = strParam + str(p) + "=" + str(params[p]) + '&'
strParam = strParam + 'key' + '=' + key
parmStr = strParam.encode("utf-8")
m = hashlib.md5()
m.update(parmStr)
params['sign'] = m.hexdigest().upper()
res = requests.post(url = url, data = params)
print('Response:' + res.text)
返回
{
memberid: '10010',
tradetype: 'PayPal-A',
transaction_id: '151398410112',
out_trade_no: 'O1722050251979',
amount: null,
actualamount: '0.98',
fees: '0.02',
currency: 'USD',
payeeaccount: '12345678',
create_time: '2024年07月27日 11:17:33',
trans_time: '2024年07月27日 11:17:33',
status: 'Unreviewed',
msg: '未审核',
sign: '997C230B70F56411F1081BF6230AB37F'
}