IDR Cash Api
# Code Example
- The code example is for reference only, please refer to request parameter description for specific parameter description
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import java.util.Map;
import java.util.TreeMap;
public class TopPayDemo {
private static final String MCH_ID = "S820211021094748000001"; // merchant code
private static final String PLAT_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC2JoMfFqLsSJjAiCahEnlP3aRj8yCT+WHzR+VvPBTw9S1i7iYWb+MY09CG/HYuHF4+IxshXDJygmndxKf/esuwPybS8mAd//yubHpmZsmBqg1FffT8VH1APa6ZRWASUp4U01ZrbCCp35QA8FuWrJGMJxGx4xk7KUtV2yujxC8noQIDAQAB"; // platform public key
private static final String MCH_PRIVATE_KEY = "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAJU8gKFKD0luIYx7X8+JRdCIE0UDBctS6LjXxWLEv/EO7jDBTid6zYP1KmNgpd2DAWWtBFBSQ+gcNwVZZSBHJiSDqVvvJVs2FEbeBvfdv4X93+IYRAXksBasSW5Tpdshbo82pVL4V7wuKCuFLk9UxBHbpQjWAbfyF66RmwIbZD71AgMBAAECgYBjPe7UU2nDDSfmQg0++CyjNjqKRC5QPfxhH6w1uF1kMueXKJWOj42n2RutJpJmsj31nY8m0u4xpsG4HvCu/GGSFhhKZCHLvzp41oY2ubYj9nuFNU//81LycQjulWo2y0UUBY0k2piEt+SwPaiUNbT6nMxNMjlnjRe2okp/3rw+KQJBANG3YlZWoVbCEqzy64bJJLxiPsCA5ErGB0NzRGitq44xkhqGtR8ZZQyVz40pruNa58d73O2xyJSy5+fmZGn4E+sCQQC2LBnguj0CSCKub0mPDcunTTz9V79VXBBZdlB1/YGmRUx2s4sQrJNZS7rL4EqBQ3maIRnG+s+AXCSTfsYrV6CfAkEAxugnVfpelhoGepEAgNuggyivmgfl/2Gpm/jk5l/qOjib+ZrQiQmeBPzGWX4yiSM8eMDrP2sC8r5pJFMp5DRONwJBAJ4n4XuSFJ9jgwCPy3vvzSv9SYLk6E6yM9uHdUlKgoGYzk6Lh6M9QFuY/J49plFdBDiEnj16yCU3WeXXfTJpzB8CQQDMNMR/rIOTE9xGybS3mlQbt22AUnO6XhupWcckEKW4nPGxATwYBQzCY3i/9FTGN0vA+9ZPC2cwHtNxI2kXf3Vp"; // merchant private key
private static final String cashUrl = "https://id-openapi.toppay.asia/gateway/cash";
private static final String cashNotify = "http://host:port/notify";
public static void main(String[] args) throws Exception {
cash();
}
private static void cash() throws Exception {
Map<String, String> requestParams = new TreeMap<>();
requestParams.put("merchantCode", MCH_ID);
requestParams.put("orderNum", "186888188666");
requestParams.put("method", "Transfer");
requestParams.put("orderType", "0");
requestParams.put("money", "125");
requestParams.put("feeType", "0");
requestParams.put("dateTime", "20200101235959");
requestParams.put("number", "2021071209403321313122");
requestParams.put("bankCode", "014");
requestParams.put("name", "test cash name");
requestParams.put("mobile", "082122965511");
requestParams.put("email", "[email protected]");
requestParams.put("description", "test cash");
requestParams.put("notifyUrl", cashNotify);
StringBuilder stringBuilder = new StringBuilder();
for (String key : requestParams.keySet()) {
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);
String postJson = new Gson().toJson(requestParams);
System.out.println("Post Json Params:" + postJson);
String responseJson = TopPayRequestUtil.doPost(cashUrl, postJson);
System.out.println("Response Msg:" + responseJson);
boolean pass = TopPayRequestUtil.verifySign(new Gson().fromJson(responseJson, JsonObject.class), PLAT_PUBLIC_KEY);
if (pass) {
// ... do something
} else {
// ... do something
}
}
}
# Request Address
- Request method: POST
- Request address: https://id-openapi.toppay.asia/gateway/cash
# Request parameters
Note: Do not fill in Chinese in all parameters! ! !
Param | Type | Required | Remark | Example |
---|---|---|---|---|
merchantCode | String | Y | merchant ID,Get it in Merchant Platform-Personal Center-Personal Information | S820211021094748000001 |
orderType | string(10) | Y | order type | 0-Fiat Currency (Indonesian Rupiah) Transaction |
method | string(10) | Y | payment method | Transfer |
orderNum | String | Y | merchant orer number | 10000001 |
money | String | Y | amount (Decimal point is not supported, please do not pass decimals) | 150000 |
feeType | String | Y | fee type 0:deduction in order 1:deduction out order | 0 |
bankCode | String | Y | bank code | View supported bank codes |
number | String | Y | bank number | 12312431241 |
name | String | Y | name | Jack |
mobile | String | Y | mobile(Beginning with 08) | 081234567890 |
String | Y | [email protected] | ||
notifyUrl | String | Y | notify url | https://123123.com |
dateTime | String | N | Timestamp (format:yyyyMMddHHmmss) | 20200101235959 |
description | String | N | description | 代付下单 |
sign | String | Y | sign | Yg+ePvTFhiRrARcZKBcRG0l89rqisPIuZQStYqBIwSMPaqvqbc3dFevgS9jt |
# Request example
{
"merchantCode": "S820211021094748000001",
"orderType": "0",
"method": "Transfer",
"orderNum": "186888188666",
"money": "50000",
"feeType": "1",
"bankCode": "014",
"number": "2021071209403321313122",
"name": "test cash name",
"mobile": "081234567890",
"email": "[email protected]",
"notifyUrl": "your notify url",
"dateTime": "2021-07-12 09:41:00",
"description": "test cash",
"sign": "Yg+ePvTFhiRrARcZKBcRG0l89rqisPIuZQStYqBIwSMPaqwH77qRXI1J+jElOBpa"
}
# Response parameters
Parameters | Type | Required | Description | Example |
---|---|---|---|---|
platRespCode | String | Y | response code | FAIL\SUCCESS |
platRespMessage | String | Y | response message | FAIL\SUCCESS |
platOrderNum | String | Y | platform order number | PI1453242857400963072 |
orderNum | String | Y | merchant order number | 23645782 |
status | int | Y | order status | View order status description |
statusMsg | String | Y | order status info | Apply |
money | String | Y | amount | 150000 |
fee | String | Y | fee | 12 |
feeType | String | Y | fee type 0:deduction in order 1:deduction out order | 1 |
bankCode | String | N | bank code | View supported bank codes |
number | String | Y | bank number | 12312431241 |
name | String | Y | name | Jack |
description | String | Y | description | cash |
platSign | String | Y | sign | PI1453242857400963072 |
# Response example
{
"platRespCode": "SUCCESS",
"platRespMessage": "Request success",
"platOrderNum": "W0620220119174331000001",
"orderNum": "186888188666",
"status": 0,
"statusMsg": "Apply",
"money": "50000",
"fee": "7",
"feeType": "0",
"bankCode": "014",
"number": "2021071209403321313122",
"name": "test cash name",
"description": "test cash",
"platSign": "E5uNF7B9NXyhtlRo2I7/KVHN4Sbz0c3VbwCLpH3vjUpv6Cai+bmJA/Q8dVE2RJRe1+dsbzg=="
}
# Cash api callback notify
- When performing signature verification, you must use the platform public key provided in Merchant Backstage-Receipt and Payment Configuration-API Configuration to decrypt! ! !
- When verifying the signature, the actual callback parameters shall prevail. Do not verify the fixed parameters.
- The final status of the order is subject to the status of the notification! ! !
- After TopPay results are notified asynchronously, the SUCCESS string must be responded to, without quotation marks, and not in Json format. Otherwise TopPay will continue to initiate 5 notifications to the downstream.
# Notify Params
Parameters | Description | Example |
---|---|---|
platOrderNum | platform order number | BK_1563278763273 |
orderNum | merchant order number | T1231511321515 |
money | amount | 100000 |
feeType | fee type 0:deduction in order 1:deduction out order | 1 |
fee | fee | 500 |
name | name | Neo |
number | bank number | 45649849659456 |
bankCode | bank code | View supported bank codes |
status | order status | View order status description |
statusMsg | order status message | Payout Success |
description | description | description |
platSign | sign | ja6R8eukQY9jc8... |
# Cash api callback notify example
{
"platOrderNum": "W0620220119174331000001",
"orderNum": "186888188666",
"money": "50000",
"fee": "7",
"feeType": "0",
"name": "test cash name",
"number": "2021071209403321313122",
"bankCode": "014",
"status": "2",
"statusMsg": "SUCCESS",
"description": "test cash",
"platSign": "LGEpz2LjbZ6Iyvn+zLc/+t26AaH0aEhHVD62lSCdo6XIkAg86AUncCvmym62wVoE3r2+dHnv27qi/01UQDcqFK8DYioRCcydYSjB4QRVezG3fcZlhWrACmWGacnXkE7p5zChL7pK5h0HuBhbo1zKt4FunQR6QMmcBVfv7YfB3W0"
}