Registered User Information

Introduction

User information must be transmitted after being processed according to the specified AES encryption rules. The user information fields differ for different fiat currencies and must be strictly followed.

User Information Encryption Method:

User information must be processed using the following encryption rules to ensure security and compatibility during cross-system transmission:

The core encryption algorithm is AES-256-ECB, and the padding method uses PKCS5Padding;

Encryption Process: First, the original user information JSON string is converted into a byte array using UTF-8 encoding, then encrypted using the AES-256-ECB algorithm, and finally the encrypted byte array is converted into a Base64 string (i.e., the value of the interface parameter userInfoEncryptStr);

Key Processing Rules: SECRET_KEY is the key provided by us for network access. It must first be generated as a 32-byte (256-bit) standard AES key using the SHA-256 hash algorithm before being used for encryption calculations. Merchants do not need to adjust the key length themselves; they only need to use the original key provided by us and process it according to the example code.

API Description

Request Method:POST

Request Path:open/api/saveUserInfo

Parameters

Request Parameters

Parameter

Sign

Mandatory

Type

Length

Description

appId

Y

Y

string

64

AppId is unique for merchant

sign

N

Y

string

512

Sign

userId

Y

Y

string

64

Email/ Phone number

currency

Y

Y

string

64

Fiat

type

N

N

string

20

Type: SCAN, TRANSFER
Default: SCAN

userInfoEncryptStr

Y

Y

string

1024

Encrypted user information

Java Encryption code example User information JSON string before encryption:

{
  "surname" : "BARRIOS",
  "legalId" : "20330624087",
  "name" : "PAOLA",
  "exchange" : "ARGENTINA"
}
public class AesEncryptClient {
    // SECRET
    private static final String SECRET_KEY = "SECRET_KEY";
    private static final String AES_ALGORITHM = "AES/ECB/PKCS5Padding";

    private static SecretKeySpec getValidAesKey() {
        try {
            MessageDigest md = MessageDigest.getInstance("SHA-256");
            byte[] keyBytes = md.digest(RAW_SECRET_KEY.getBytes(StandardCharsets.UTF_8));
            return new SecretKeySpec(keyBytes, "AES");
        } catch (Exception e) {
            throw new RuntimeException("SECRET CREATE FAIL", e);
        }
    }
    public static String encrypt(String userJson) {
        try {
            Cipher cipher = Cipher.getInstance(AES_ALGORITHM);
            cipher.init(Cipher.ENCRYPT_MODE, getValidAesKey());
            byte[] encryptBytes = cipher.doFinal(userJson.getBytes(StandardCharsets.UTF_8));
            return Base64.encodeBase64String(encryptBytes);
        } catch (Exception e) {
            throw new RuntimeException("AES Encryption FAIL", e);
        }
    }

}
import base64
from hashlib import sha256
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad

# SECRET
secret_key = "SECRET_KEY"
# SECRET PROCESSING
key = sha256(secret_key.encode('utf-8')).digest()
# Encryption
def encrypt(plain_json):
    cipher = AES.new(key, AES.MODE_ECB)
    padded_data = pad(plain_json.encode('utf-8'), AES.block_size)
    encrypt_bytes = cipher.encrypt(padded_data)
    return base64.b64encode(encrypt_bytes).decode('utf-8')

ARS userInfo Parameter:

ParameterSignMandatoryTypeLengthDescription
exchangeYYString32Country
legalIdYYString32Identity ID
nameYYString32Given name
surnameYYString32Surname

BRL userInfo Parameter:

ParameterSignMandatoryTypeLengthDescription
exchangeYYString32Country
legalIdYYString32Identity ID
nameYYString32Given name
surnameYYString32Surname

PEN userInfo Parameter:

ParameterSignMandatoryTypeLengthDescription
exchangeYYString32Country
legalIdYYString32Identity ID
nameYYString32Given name
surnameYYString32Surname
workYYString32Occupation
phoneCountryCodeYYString32Phone country code
phoneNumberYYString32Phone number
genderYYString32Gender
birthDateYYString32Date of birth (yyyy-mm-dd)
streetYYString32Address

Request Parameter Example

{
    "appId": "TEST000001",
    "sign": "B9E8C93CF203BB2123FB5D0E8E1F0B826974D29B9E3D99869BE5AABEDA1F9F7B805ADC1A263D42A44CF66BC66C9C7258A56B0AF628439CBB44B326EF63140CFA",
    "userId": "11187",
    "type":"SCAN",
    "currency": "ARS",
    "userInfoEncryptStr": "y7/ifd/BfeXMf2jMWyk53KH+EjF18yCBanT5Mop5Myrl9ch936qSYsQ2ZE5KGtUevY3cz2OZXYMOIrFWWFstUGP/gWw3rn2WwEB4OKwjPCHOEEnwt1JrPu0xvgkOoaQl"
}

Response Parameters

ParameterTypeDescription
successbooleanSuccess
errorbooleanError
codelongResponse code
msgstringResponse message
traceIdstringTrace id
modelobjectResponse content

Response Parameter Example

{
  "code": "0",
  "msg": "success",
  "model": null,
  "traceId": "68590ef3ef9bd17e8671b85313daf949",
  "success": true,
  "error": false
}