Development Guide

GET Config

Check the developer configuration information on the merchant side, get appId and appSecret, and download RSA public key.

API Authentication

Headers Add Z-AUTH field, the value is the obtained AccessToken. See GET Token document

Global Request Header

Headers adds the Content-Type field, the value is application/json; the specified request body is json format.

Data Encryption

Some API need to encrypt the request parameters and use encrypted strings.

Retrieve the raw data from the interface as data.

data
{
    "cardManageId": 1,
    "amount": 100
}

Add a timestamp to the data.

data
{
    "cardManageId": 1,
    "amount": 100,
    "timestamp": 1719474525339
}

Serialize the data into a string.

string
{"cardManageId":1,"amount":100,"timestamp":1719474525339}

Encrypt using the public key and encode with base64 to obtain the encrypted string.

Encrypted string
"e5EyXpem6GKbgDs4puARn0hTqUzNNV79Hn6oBbvTZQ56V5e33wUYsQ+ypY0pWIIf5UOW3RjT6L8KQNYkopXpzgLk0zfmyOXqdOAkQ1Iqr/MaxNhLmGm/cA3aZli2QqItEdxNs6hUuQeAuF6mScxdCs3tsY4TNP0UVGyNNmQwfMA="

Data encryption:

Java
PHP
string
// 1. Build parameter.
HashMap<String, Object> data = new HashMap<>(3);
data.put("cardManageId", 1);
data.put("amount", 100);
// 2. Add timestamp
data.put("timestamp", System.currentTimeMillis());
// 3. Serialize parameter.
String json = JSONUtil.toJsonStr(data);
// 4. Encrypt using the public key to obtain the encrypted string.
RSA rsa = new RSA(null, "PublicKeyStr");
byte[] encrypt = rsa.encrypt(json, KeyType.PublicKey);
String encryptStr = Base64.encode(encrypt);

The encrypted string is valid for 5 minutes; it becomes invalid after 5 minutes.

Multi-language

The API supports multilingual switching, with Chinese as the default language.

Add the Accept-Language field to the request header, and the value is zh-CN.

Supported languages:

  • Chinese: zh-CN or zh

  • English: en-US or en

Response data

In the interface return data, code is the status code, message is the prompt message, and data is the return data.

Response sample
{
    "code": 200,
    "message": "Success",
    "data": {
        "cardId": "XR181160403223456480",
        "amount": 0,
        "virtualAmt": null,
        "cardModel": "recharge",
        "cardCurrency": "USD",
        "cardCvv": "123",
        "cardNumber": "5592924341234567",
        "cardStatus": "Active",
        "openCardTime": "2024-07-12T03:30:35.044+00:00",
        "cancelCardTime": null,
        "openCardFee": 3,
        "rechargeMoney": 977.06,
        "rechargeFee": 19.94,
        "cardSingleLimit": null,
        "cardTotalLimit": null,
        "cardExpiration": "01/29"
    }
}