Error Response Format
All errors follow a consistent format:{
"success": false,
"message": "Human readable error message"
}
HTTP Status Codes
| Status Code | Meaning |
|---|---|
200 | Success |
201 | Created successfully |
400 | Bad request — missing or invalid parameters |
401 | Unauthorized — invalid or missing API key |
404 | Not found — resource does not exist |
409 | Conflict — duplicate or already processed |
410 | Gone — resource expired |
422 | Unprocessable — validation failed |
429 | Too many requests — rate limit exceeded |
500 | Internal server error |
Authentication Errors
| Status | Message | Solution |
|---|---|---|
401 | API key required | Add x-api-key header to your request |
401 | Invalid API key | Check your API key in the dashboard |
401 | Unauthorized access | Resource belongs to a different merchant |
Payment Errors
| Status | Message | Solution |
|---|---|---|
404 | Transaction not found | Check the orderId — it may be incorrect |
409 | Payment already verified | Payment is already in success state |
409 | Payment is expired | Create a new payment order |
409 | Payment is failed | Create a new payment order |
409 | UTR already used | This UTR has been used for another payment |
410 | Payment order is expired | Payment not completed within 10 minutes — create new |
422 | Currency mismatch | Wrong currency passed for this order |
422 | Amount mismatch | Paid amount does not match expected amount |
503 | Too many concurrent payments | Too many payments for same amount — retry after a moment |
Webhook Errors
| Status | Message | Solution |
|---|---|---|
404 | No webhook URL set | Set webhook URL in dashboard or pass webhookUrl in request |
401 | Invalid signature | Check your webhook secret — see Verify Signature |
Validation Errors
| Status | Message | Solution |
|---|---|---|
400 | body is required | Request body is missing or empty |
400 | amount is required | Pass amount in request body |
400 | currency is required | Pass currency in request body |
400 | orderId is required | Pass orderId in request body |
400 | email & password are required | Pass both fields |
429 | Too many attempts | Wait 15 minutes before retrying auth endpoints |
Rate Limiting
CWMPay enforces rate limits to prevent abuse:| Endpoint Type | Limit |
|---|---|
| General API | 100 requests per minute |
| Auth endpoints (login, signup) | 5 attempts per 15 minutes |
{
"success": false,
"message": "Too many requests. Please try again after some time."
}
Handling Errors
const response = await fetch('https://api.cwmpay.in/api/merchant/{payment}/create', { // ({payment} here can be either "inr" or "crypto")
method: 'POST',
headers: {
'x-api-key': process.env.CWMPAY_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({ amount: 499, currency: 'INR' })
});
const data = await response.json();
if (!data.success) {
switch (response.status) {
case 401:
console.error('Authentication failed — check your API key');
break;
case 404:
console.error('Order not found');
break;
case 410:
console.error('Payment expired — create a new order');
break;
case 422:
console.error('Validation failed:', data.message);
break;
case 429:
console.error('Rate limited — slow down requests');
break;
case 500:
console.error('CWMPay server error — try again later');
break;
default:
console.error('Error:', data.message);
}
}
Need Help?
If you encounter an error not listed here or need assistance:Email Support
Dashboard
Check your account status

