Overview
Brief Description
- This section introduces the parameters that need to be prepared before integrating with the Brazil interface.
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 | Please contact the business development officer |
Merchant NO | A 10-digit merchant ID (Example: 0000001) |
Merchant dashboard 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://sandbox-api.paypro.tech/brz-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 returning information from the interface, first check if the first layer indicates a successful request. Only after the request is successful should you check the second layer for transaction results.
Signing Logic
- The interface must report the
sign
parameter. The signing logic is as follows:- Step 1: Combine all request parameters sorted by their names in alphabetical order into
key1=value1key2=value2...
.
- Step 1: Combine all request parameters sorted by their names in alphabetical order into
public static String signRequest(Map<String, Object> map, String secretKey) {
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);
return encrypt(request.toString(), secretKey);
}
- Step 2: Use the app secret as salt for MD5 encryption.
- SIGN_TYPE: MD5
- CHARSET_NAME: UTF-8
- salt: private key
public static String encrypt(String str, String salt) {
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 encryption exception", 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();
}
- The requested merchant number and
sign
must be included in the header submission. - An IP whitelist must be added during the request process; please contact Paypro business for this operation.
Request Parameter Retrieval
public static Long getMilliByTime(LocalDateTime time) {
return time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
}