Create a new payment
Request address
POST
https://sandbox.j-pay.net/api/v1/payment/createOrder
Test account
Merchant ID:10010
ApiKey: 7e4nicn14nhyup146dfbi8hpnpus9juz
Request parameters
Parameter Name | Type | Required | Sign(Y OR N) | Parameter Description |
Order Information | ||||
memberid | String | Y | Y | The platform assigns merchant ID |
out_trade_no | String | Y | Y | Merchant order number |
amount | String | Y | Y | Payment amount (two decimal places only) |
currency | String | Y | Y | Currency code, For example:USD,JPY,GBP,EUR,AUD,HKD,CAD,MXN |
orderType | String | Y | Y | List of order type |
notifyurl | String | Y | Y | A successful transfer will be notified at this address |
remark | String | Y | Y | The remarks cannot be empty and contain more than 4 characters |
sign | String | Y | N | Please see MD5 signature field method |
User Information | ||||
firstname | String | Y | Y | Recipient's name |
lastname | String | N | Y | Payee's last name (blank not required to sign) Required when the payment type is ach, Visa Direct or local banks in some countries |
payeecontact | String | N | Y | Payee contact information (email), Required when the payment type is Venmo or ach or local banks in some countries |
payeephone | String | N | Y | Payee contact information (phone), Required when the payment type is BANK |
payeeCountry | String | N | Y | Country of the recipient, Required when the payment type is ach,CASHAPPOUT or BANK |
province | String | N | Y | Required when the payment type is ach or local banks in some countries |
city | String | N | Y | Required when the payment type is ach or local banks in some countries |
payeeAddress | String | N | Y | Full address of payee, Required when the payment type is ach or local banks in some countries |
payeePostalCode | String | N | Y | Payee postal code, Required when the payment type is ach or local banks in some countries |
Bank Information | ||||
payeeaccount | String | Y | Y | Bank card number, Wallet account number |
bankname | String | N | Y | Bank name of payment card |
subbranch | String | N | Y | Bank branch name of payment card |
accountname | String | N | Y | Account name of settlement card |
payeeBankRouting | String | N | Y | Bank routing, This parameter is required if the payment type is ach |
bankswift | String | N | Y | SWIFT/BIC. Click here to find your SWIFT/BIC. Such as ABCDGITTXXX, This parameter is required if the payment type is Bank in some countries |
bankiban | String | N | Y | IBAN should include 30 characters.3rd and 4th characters must be digits. Such as KW74NBOK0000000000001000372151, This parameter is required if the payment type is Bank in some countries |
Return parameters
Parameter Name | Type | Parameter Description |
---|---|---|
transaction_id | String | Transaction order number |
status | string | success:SUCCESS error:failed |
msg | String | State description |
Notify parameters
Parameter Name | Type | Parameter Description |
---|---|---|
memberid | String | Merchant ID |
out_trade_no | string | Merchant order number |
transaction_id | String | Transaction order number |
amount | String | Total transaction amount |
actualamount | String | Actual amount |
original_amount | String | Original amount |
datetime | Intger | Transaction timestamp(second) |
transferMessage | String | Result message |
status | string | SUCCESS:successful FAIL:failed |
sign | String | See MD5 signature example |
Demo
Request
- 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: "O" + Date.now().valueOf(),
amount: "1.00",
currency: "USD",
orderType: "PayPal-A",
firstname: "Jack",
payeeaccount: "12345678",
notifyurl: "https://www.google.com",
remark: "This is a new payment"
};
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/createOrder",
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/createOrder';
$secretKey = '7e4nicn14nhyup146dfbi8hpnpus9juz';
$memberId = '10010';
$data = [
'memberid' => $memberId,
'out_trade_no' => 'O' . date('YmdHis', time()),
'amount' => '1.00',
'currency' => 'USD',
'orderType' => 'PayPal-A',
'firstname' => 'Jack',
'payeeaccount' => '12345678',
'notifyurl' => 'https://www.google.com',
'remark' => 'This is a new payment',
];
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);
import hashlib
import requests
import time
url = 'https://sandbox.j-pay.net/api/v1/payment/createOrder'
key = '7e4nicn14nhyup146dfbi8hpnpus9juz'
params = {
'memberid': '10010',
'out_trade_no': 'O' + time.strftime('%Y%m%d%H%M%S', time.localtime()),
'amount': '1.00',
'currency': 'USD',
'orderType': 'PayPal-A',
'firstname': 'Jack',
'payeeaccount': '12345678',
'notifyurl': 'https://www.google.com',
'remark': 'Python'
}
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)
Response
- Successful
- Fail
{ status: 'success', msg: '代付申请提交成功', transaction_id: '151398410112' }
{"msg":"签名验证失败","status":"error"}
Notify
- Successful
- Fail
{
"memberid": "10010",
"out_trade_no": "13676",
"transaction_id": "257354624363",
"amount": "10.00",
"actualamount": "9.80",
"datetime": false,
"transferMessage": "转账成功",
"status": "SUCCESS",
"sign": "6EF39FDDC82DFD5C346A020EEF477D21"
}
{
"memberid": "10010",
"out_trade_no": "13675",
"transaction_id": "100505942657",
"amount": "10.00",
"actualamount": "9.80",
"datetime": 1722318667,
"transferMessage": "转账失败",
"status": "FAIL",
"sign": "B7F75498A1158139DB28C100D14850EA"
}