Overview
Brief description
- This section describes the parameters that need to be prepared before docking
Trader number
- The sandbox account information is provided by the operator, please contact the operator.
- The official environment account will be opened after the sandbox environment is integrated. The following account-related information can be obtained from the dashboard.
Parameter | Description |
---|---|
Merchant dashboard | http://business.paypro.tech/admin/login |
Merchant NO | A 10-digit merchant ID (Example: 0000001) |
Merchant Bdashboard Account | Usually logs in via email |
Merchant dashboard Password | Check the designated email for the password; it is recommended to change it after logging in |
Merchant Key | Can be obtained from the homepage after logging into the system |
API Request Address
- Sandbox URL๏ผhttps://openapi-sa-test.paypro.tech/mex-pay
- Sandbox merchant number:
Please contact the business development officer
- Sandbox key:
Please contact the business development officer
- Production environment address:
Please contact the business development officer
When processing the API response, first check whether the first layer indicates a successful request.
Only if the request is successful should you proceed to examine the second layer for the transaction result.
Signature Logic
- 1๏ผThe API request must include the sign parameter, following the signing logic. Step 1: Arrange all request parameters in ascending order based on the first letter of the parameter names (a-z) and concatenate them in the format:key1=value1key2=value2......
List<String> keys = Lists.newArrayList(map.keySet());
Collections.sort(keys);
StringBuilder request = new StringBuilder();
for (String key : keys) {
String value = String.valueOf(map.get(key));
if (StrUtil.isNotEmpty(value) && !"sign".equals(key)) {
request.append(key).append("=").append(value);
}
}
log.error("encrypt string : {}", request);
Step2๏ผUse the app secret as a salt to perform MD5 encryption. SIGN_TYPE๏ผMD5 CHARSET_NAME๏ผUTF-8 salt๏ผPrivate key
try {
MessageDigest md5 = MessageDigest.getInstance(SIGN_TYPE);
md5.update((str + salt).getBytes(CHARSET_NAME));
return byte2hex(md5.digest());
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("md5 cryptographic anomaly", e);
}
}
return "";
public static String byte2hex(byte\[\] bytes) {
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes\[i\] & 0xFF);
if (hex.length() == 1) {
sign.append("0");
}
sign.append(hex.toLowerCase());
}
return sign.toString();
}
- 2๏ผThe requested merchant number is required to be added in the header submission.
- 3: IP whitelist needs to be added during the testing process, please contact paypro business for this operation.
Request Parameter Getting[timestamp]
public static Long getMilliByTime(LocalDateTime time) {
return time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
}