RazCrypto RazCrypto Docs
Dashboard Get API Keys
Docs Error Handling

Error Handling

Error Response Format

JSON
{
    "status": "error",
    "message": "Invalid amount",
    "error_code": "RZ_001",
    "retry_after": null,
    "timestamp": "2024-01-15T10:30:00Z"
}

Error Codes

CodeMessageSolution
RZ_001Invalid amountAmount must be numeric and ≥ 0.01
RZ_002Invalid or inactive public_key_idCheck your public key in dashboard
RZ_005Failed to create transactionTry again or contact support
RZ_008Invalid expiry_minutesSet expiry between 1-60 minutes
RZ_020Rate limit exceededWait and retry with exponential backoff

Handle Errors in Code

try {
    const result = await RazCrypto.createPayment({ amount: 10.00 });
} catch (error) {
    switch (error.message) {
        case 'RZ_001': alert('Invalid amount — minimum 0.01 USDT'); break;
        case 'RZ_002': alert('Invalid API key — check dashboard'); break;
        case 'RZ_020': alert('Too many requests — please wait'); break;
        default:       alert('Payment failed: ' + error.message);
    }
}
<?php
$result = json_decode($response, true);
if ($result['status'] === 'error') {
    switch ($result['error_code']) {
        case 'RZ_001': throw new Exception('Invalid amount'); break;
        case 'RZ_002': throw new Exception('Invalid API key'); break;
        case 'RZ_020': sleep(2); // retry; break;
        default:       throw new Exception($result['message']);
    }
}
?>