Deposit request
is used to initiate a deposit request
Request address
- API Address (requestURI) : /openapi/v1/deposit/request
Request parameters
Parameter name | Type | Requirement | Description |
---|---|---|---|
trackingId | String | R | Merchant tracking ID, each transaction operation of each merchant should be guaranteed to be unique, and the length is limited to 50 characters |
businessName | String | R | The name of the deposit business, such as the name of the product/business, is limited to 50 characters |
assetType | Integer | R | Asset type, [0: Cryptocurrency, 1: Fiat Currency] |
amount | BigDecimal | R | The amount cannot be greater than 999999999999.99 |
assetName | String | R | Asset name/currency, limited to 20 characters |
userSelectable | Integer | R | Whether the user is optional, [0: not optional, 1: optional]. Optional: Fields such as network type/payment type can be left blank and specified by the cashier page when submitting |
netProtocol | String | C | Network type/payment type. userSelectable=0 is required, and the length is limited to 20 characters |
bankCode | String | C | Bank code. For payment types of some currencies, userSelectable=0 is required to verify |
webhookUrl | String | R | The callback URL/webhook URL of the notification callback is limited to 255 characters |
successPageUrl | String | R | The address of the page where the deposit is successfully redirected, and the length is limited to 255 characters |
remark | String | O | Transaction remarks cannot exceed 255 characters. Add some additional data or identifiers to the transaction, such as the order number, and the interface will return |
activeTime | Integer | R | Valid duration, unit: milliseconds. A value greater than 0 indicates a permanent validity period, and a value greater than 0 indicates a limited validity period (up to 7 days). |
text1 | String | O | Text 1. It is only used for the display of the cashier page, does not participate in the payment, the example is "1000", the length is limited to 40 characters, 20 is recommended to achieve the best display effect |
text2 | String | O | Text 2. It is only used for the display of the cashier page, does not participate in the payment, the example is "$1000", the length is limited to 40 characters, 20 is recommended to achieve the best display effect |
text3 | String | O | Text 3. It is only used for the display of the cashier page, does not participate in the payment, the example is "Mfedfring", the length is limited to 40 characters, 20 is recommended to achieve the best display effect |
text4 | String | O | Text 4. It is only used for the display of the cashier page, and does not participate in the payment, the example is "1USD = 1038KRW", the length is limited to 40 characters, 20 is recommended to achieve the best display effect |
userId | String | R | The user ID is limited to 64 characters in length |
userIp | String | O | The IP address of the user, which is limited to 64 characters in length |
skipPage | Integer | O | Whether to skip the cashier page, [1: skip page, 0: do not skip page]. The default is not skipped. When skip is selected, the API will directly return the required information for payment, but not the address of the cashier page |
Sample request
{
"trackingId": "20220408123456789",
"businessName": "Deposit",
"assetType": 1,
"amount": 100,
"assetName": "USD",
"userSelectable": 1,
"netProtocol": "bank",
"webhookUrl": "https://yourdomain.com/webhook",
"successPageUrl": "https://yourdomain.com/success",
"remark": "Deposit",
"activeTime": 0,
"text1": "100",
"text2": "$100",
"text3": "Mfedfring",
"text4": "1USD = 1038KRW",
"userId": "123456",
"userIp": "127.0.0.1",
"skipPage": 0
}
Response parameters
Parameter name | Type | Requirement | description |
---|---|---|---|
trackingId | String | R | Merchant tracking ID |
redirectPageUrl | String | R | The address of the payment page to which you are redirected. When skipPage=1 is in the request parameter, the value of this field is the address of the upstream payment page, otherwise it is the address of the cashier page of the system |
walletAddress | String | C | Wallet address. This field is meaningful when skipPage=1 in the request parameter, which is the wallet address provided to the user for cryptocurrency deposits |
expireTimestamp | Long | R | Expiration timestamp, accurate to millisecond |
remark | String | C | Transaction Notes. Add some additional data or identifiers to the transaction, such as the order number, and the interface will return |
Sample response
{
"code": 200,
"msg": "success",
"data": {
"trackingId": "20220408123456789",
"redirectPageUrl": "https://yourdomain.com/pay",
"walletAddress": "0x1234567890abcdef",
"expireTimestamp": 1670505600000,
"remark": "Deposit"
}
}
Sample code
public static void main(String[] args) {
String uri = "/openapi/v1/deposit/request";
String paymentOpenapiAccessKey = "your_accessKey";
String paymentOpenapiSecretKey = "your_secretKey";
String url = "https://test-gateway.mcconnects.com/mc-payment" + uri;
String timestamp = String.valueOf(System.currentTimeMillis());
// hutool http client
// HttpRequest httpRequest = HttpUtil.createPost(url)
// .header("Content-Type", "application/json")
// .header("X-Access-Key", paymentOpenapiAccessKey)
// .header("X-Signature", AKSKUtil.calculateHMAC(paymentOpenapiAccessKey + timestamp + uri,
// paymentOpenapiSecretKey))
// .header("X-Timestamp", timestamp)
// .header("X-RequestURI", uri);
// String body = httpRequest.body("""
// {
// "bankCode": "",
// "amount": 1,
// "successPageUrl": "https://yourdomain.com/deposit/success",
// "activeTime": 1800000,
// "businessName": "Deposit",
// "remark": "Deposit",
// "userSelectable": 0,
// "userId": "userId",
// "webhookUrl": "https://yourdomain.com/webhook/deposit",
// "assetType": "0",
// "netProtocol": "ERC20",
// "skipPage": 0,
// "assetName": "ETH",
// "userIp": "192.168.1.1",
// "trackingId": "trackingId"
// }
// """).execute().body();
// System.out.println(body);
// java17 http client
try {
HttpClient client = HttpClient.newHttpClient();
java.net.http.HttpRequest request = java.net.http.HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Content-Type", "application/json")
.header("X-Access-Key", paymentOpenapiAccessKey)
.header("X-Signature", AKSKUtil.calculateHMAC(paymentOpenapiAccessKey + timestamp + uri,
paymentOpenapiSecretKey))
.header("X-Timestamp", timestamp)
.header("X-RequestURI", uri)
.POST(java.net.http.HttpRequest.BodyPublishers.ofString("""
{
"bankCode": "",
"amount": 1,
"successPageUrl": "https://yourdomain.com/deposit/success",
"activeTime": 1800000,
"businessName": "Deposit",
"remark": "Deposit",
"userSelectable": 0,
"userId": "userId",
"webhookUrl": "https://yourdomain.com/webhook/deposit",
"assetType": "0",
"netProtocol": "ERC20",
"skipPage": 0,
"assetName": "ETH",
"userIp": "192.168.1.1",
"trackingId": "trackingId"
}
""")).build();
String body2 = client.send(request, HttpResponse.BodyHandlers.ofString()).body();
System.out.println(body2);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}