跳到主要内容

入金申请

用于发起入金请求

请求地址

  • 接口地址(requestURI): /openapi/v1/deposit/request

请求参数

参数名称类型出现要求描述
trackingIdStringR商户跟踪id,各个商户的每次交易操作应保证唯一,长度限制为50个字符
businessNameStringR入金业务名称,比如商品名称/业务名称,长度限制为50个字符
assetTypeIntegerR资产类型,[0:加密货币,1:法定货币]
amountBigDecimalR金额,不能大于999999999999.99
assetNameStringR资产名称/币种,长度限制为20个字符
userSelectableIntegerR用户是否可选,[0:不可选,1:可选]。可选时:网络类型/支付类型等字段可先不填,由收银页提交时指定
netProtocolStringC网络类型/支付类型。userSelectable=0时必填,长度限制为20个字符
bankCodeStringC银行代码。某些币种的支付类型需要,userSelectable=0时校验
webhookUrlStringR通知回调地址/webhook url,长度限制为255个字符
successPageUrlStringR入金成功跳转页面地址,长度限制为255个字符
remarkStringO交易备注,不能超过255个字符。在交易中加入一些额外的数据或标识,如订单号等,接口会原样返回
activeTimeIntegerR有效时长,单位:毫秒。0表示永久有效,大于0的数值表示有限的有效时长(最大支持7天)
text1StringO文本1。仅用于收银页面显示,不参与支付,示例为"1000" ,长度限制为40个字符 ,建议20个以达到最佳显示效果
text2StringO文本2。仅用于收银页面显示,不参与支付,示例为"$1000" ,长度限制为40个字符 ,建议20个以达到最佳显示效果
text3StringO文本3。仅用于收银页面显示,不参与支付,示例为"Mfedfring" ,长度限制为40个字符 ,建议20个以达到最佳显示效果
text4StringO文本4。仅用于收银页面显示,不参与支付,示例为"1USD = 1038KRW",长度限制为40个字符 ,建议20个以达到最佳显示效果
userIdStringR用户id,长度限制为64个字符
userIpStringO用户ip地址,长度限制为64个字符
skipPageIntegerO是否跳过收银页面,[1:跳过页面,0:不跳过页面]。默认为不跳过。当选择跳过时,接口会直接返回支付所需信息,不返回收银页面地址

请求示例

{
"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
}

响应参数

参数名称类型出现要求描述
trackingIdStringR商户跟踪id
redirectPageUrlStringR重定向的支付页面地址。当请求参数中skipPage=1时,此字段的值为上游支付页面地址,否则为本系统的收银页面地址
walletAddressStringC钱包地址。当请求参数中skipPage=1时,此字段有意义,为提供给用户加密货币入金的钱包地址
expireTimestampLongR失效时间戳,精确到毫秒
remarkStringC交易备注。在交易中加入一些额外的数据或标识,如订单号等,接口会原样返回

响应示例

{
"code": 200,
"msg": "操作成功",
"data": {
"trackingId": "20220408123456789",
"redirectPageUrl": "https://yourdomain.com/pay",
"walletAddress": "0x1234567890abcdef",
"expireTimestamp": 1670505600000,
"remark": "Deposit"
}
}

示例代码

  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);
}

}