Errors and Troubleshooting
MyPay API uses standard HTTP status codes to indicate the success or failure of requests.
Status Codes
200(OK): The operation was successful.400(Bad Request): The request data is invalid (check the error message).401(Unauthorized): Valid API key is missing or expired.403(Forbidden): Access denied (Token might be invalid).404(Not Found): Resource not found (e.g., wrong Transaction ID).500(Server Error): An internal server error occurred.
Error Message Structure
In case of an error, you will receive a JSON response containing details of the problem:
{
"message": {
"code": 400,
"error": ["Invalid client ID"]
},
"data": {},
"type": "error"
}
Common Errors and Solutions
1. Invalid client ID or Invalid client secret
Cause: The provided credentials are incorrect. Solution: Ensure you copy the Client ID and Secret accurately from the dashboard, and ensure you are using the correct Base URL (Sandbox vs Production).
2. Request token is expired
Cause: The Access Token has expired (valid for 10 minutes only).
Solution: Request a new Token using POST /authentication/token.
3. Access denied! Token not found
Cause: The Token was not sent in the header correctly.
Solution: Ensure the header is sent as follows: Authorization: Bearer <token>.