Upload credentials
# Code example
import com.google.gson.JsonObject;
public class demo {
private static final String PLAT_PUBLIC_KEY = "MIGfMA0GCSqG***AQAB"; // Plat public Key
private static final String MCH_PRIVATE_KEY = "MIICeAI******IBIuhihgi"; // Mch private key
private static final String URL = "https://tl-openapi.toppay.asia/gateway/order/upload";
public static void main(String[] args) throws Exception {
query();
}
private static void query() throws Exception {
Map<String, String> requestParams = new TreeMap<>();
requestParams.put("platOrderNum", "O123123123123123");
List<String> paramNameList = new ArrayList<>();
for (String key : maps.keySet()) {
paramNameList.add(key);
}
Collections.sort(paramNameList);
StringBuilder stringBuilder = new StringBuilder();
for (String key : paramNameList) {
stringBuilder.append(requestParams.get(key));
}
String keyStr = stringBuilder.toString();
System.out.println("keyStr:" + keyStr);
String signedStr = TopPayRequestUtil.privateEncrypt(keyStr, TopPayRequestUtil.getPrivateKey(MCH_PRIVATE_KEY));
requestParams.put("sign", signedStr);
requestParams.put("imgStr", "0000030123012031203120312030120210.00ybTRjhcf");
String postJson = new Gson().toJson(requestParams);
System.out.println("Post Json Params:" + postJson);
String responseJson = TopPayRequestUtil.doPost(URL, postJson);
System.out.println("Response Msg:" + responseJson);
}
}
# Request address
- Request type:
POST - Request address: `https://tl-openapi.toppay.asia/gateway/order/upload
# Request Param
Image size cannot exceed 1MB — Image type must be jpg or png
| params | required | Participate in signing | description | example |
|---|---|---|---|---|
| platOrderNum | Y | Y | Plat Order Num | P1782634y712354t67321 |
| imgStr | Y | N | Image content (qrCode or base64), qrCode should be uploaded first. | qrCode:00000000024123478234834132435.90HGUIbbvs data:image..... |
| sign | Y | Y | sign | ja6R8eukQ... |
# Request example
{
"platOrderNum": "P019208391823491823",
"imgStr": "00000000024123478234834132435.90HGUIbbvs",
"sign": "X/o+IQUzLJqYe9Feid9Uww72mJGOvhJSJEIfo1EUChrZyVZnzGHtd61QhOqRmXCtAwk7V7k="
}
# Response param
| param | Type | Required | Description | Example |
|---|---|---|---|---|
| success | BOOLEAN | Y | response status | true/false |
| code | int | Y | response code | 1000 means success, others are failure |
| message | String | Y | response message | return specific response information |
| data | Json | Y | data | The following parameters are all returned in data, or null if failed |
# Response example
{
"success": true,
"code": 1000,
"message": "SUCCESS",
"data": null
}