Razorpay interview question

Explain the different status codes in the API response. How to avoid manual validation completely? How will you debug if the status code is in 5xx?