This page describes the authentication mechanisms used to secure the Two-Coin API. All API requests must be properly authenticated to ensure secure communication.
The Two-Coin API uses HMAC (Hash-based Message Authentication Code) for request authentication. This ensures that requests are secure and come from authorized sources.
X-MERCHANT-CODE: your_merchant_code
X-TIMESTAMP: current_timestamp_in_milliseconds
X-SIGNATURE: hmac_signature
The signature is created by combining several request elements and creating an HMAC hash using your API secret.
// JavaScript example
const crypto = require('crypto');
function generateSignature(
merchantCode,
secretKey,
uri,
payload,
timestamp
) {
const message = `${merchantCode}${timestamp}${uri}${payload}`;
const hmac = crypto.createHmac('sha256', secretKey);
hmac.update(message);
return hmac.digest('hex');
}
If you encounter any issues or have questions not addressed in this documentation, please contact our support team on Telegram at https://t.me/cs_2coin (@cs_2coin).