Signature
Before the API integration, you need to get your APP ID and APP Secret.
Get APP ID and APP Secret
CCPayment API authenticates your requests by APP ID and APP Secret. Log in to your CCPayment account, go to Developer page, you can find your APP ID and APP Secret on this page.

Signature Guide
The body of HTTP is a json string.
Add the content in body of HTTP to the signature. Ensure the body content matches the signature content. As soon as CCPayment receives the request, the body content will be read and the signature will be verified.
If you use a tool to simulate the request, please make sure that the data in the body will not be formatted by json. Always make sure the body is a json string; for example, if you use postman, you should choose text format.
Examples
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public String getSign(String appId, String appSecret, String timestamp, String data) throws NoSuchAlgorithmException {
String originStr = String.format("%s%s%s%s", appId, appSecret, timestamp, data);
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] digestOriginData = digest.digest(originStr.getBytes(StandardCharsets.UTF_8));
BigInteger number = new BigInteger(1, digestOriginData);
StringBuilder hexString = new StringBuilder(number.toString(16));
while (hexString.length() < 64) {
hexString.insert(0, '0');
}
return hexString.toString();
}
Last updated