Official SDK

📚 GitHub Demo

You can find the official SDK and usage examples here: 🌐 Coinlocally SDK on GitHubarrow-up-right


🔐 Signature Generation Example (Java)

javaCopyEdit/**
 * Generate request signature
 */
private String toSign(String timestamp, String method, String requestPath,
                      String queryString, String body, String secretKey) throws Exception {
    String preHash = preHash(timestamp, method, requestPath, queryString, body);
    SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256");
    Mac mac = Mac.getInstance("HmacSHA256");
    mac.init(secretKeySpec);
    return Hex.encodeHexString(mac.doFinal(preHash.getBytes("UTF-8")));
}

/**
 * Construct the string to be signed
 */
private String preHash(String timestamp, String method, String requestPath,
                       String queryString, String body) {
    StringBuilder preHash = new StringBuilder()
        .append(timestamp)
        .append(method.toUpperCase())
        .append(requestPath);

    if (StringUtils.isNotEmpty(queryString)) {
        preHash.append("?").append(queryString);
    }
    if (StringUtils.isNotEmpty(body)) {
        preHash.append(body);
    }
    return preHash.toString();
}

/**
 * Extract query string from request URL
 */
private String queryString(ServerHttpRequest request) {
    String url = request.getURI().toString();
    return url.contains("?") ? url.substring(url.lastIndexOf("?") + 1) : "";
}

📦 Create Order Examples (By Language)

✅ Java (Using OkHttp)

🐍 Python

🌐 Go

📘 PHP

⚙️ Node.js

Last updated