Description and Methodology:

An error codes framework was created for this project. An error code consists of 6 digits. The first two digits of an error code represent the HTTP method that was used to call it. The next two digits refer to the resource that was impacted. The last two digits refer to the specific error.

Error Response Format

statuswill always be “error” for an error responsestring
codesix digit error codestring
datawill be null for an error responsestring
errorerror messagestring

HTTP Response

  "status": "error",
  "code": "010207",
  "data": null,
  "error": "Invalid invoice state for refund"

HTTP Method - First two digits

00xxxxgeneric, unmapped errorstring
01xxxxPOST errorstring
02xxxxGET errorstring
03xxxxPUT errorstring
04xxxxDELETE errorstring

Resource and Error - Last four digits

Unmapped Errors xx00xx

These errors are not mapped to a specific resource

xx0000Generic server errorstring
xx0001Resource not foundstring
xx0002Invalid paramsstring
xx0003Missing paramsstring

Invoice Errors: xx01xx

These errors are mapped to the invoice resource

xx0100Generic server errorstring
xx0101Invoice not foundstring
xx0102Invalid paramsstring
xx0103Missing paramsstring
xx0107Invalid invoice state for cancelstring
xx0108Invoice is missing email or smsstring
xx0109Sms is not verifiedstring
xx0110Invoice price is below minimum thresholdstring
xx0111Invoice price is above maximum thresholdstring
xx0112Invalid sms numberstring
xx0113Error verifying smsstring

Refund Errors: xx02xx

These errors are mapped to the refund resource

xx0200Generic refund errorstring
xx0201Refund not foundstring
xx0202Invalid paramsstring
xx0203Missing paramsstring
xx0207Invalid invoice state for refundstring
xx0208Fees are greater than refund amountstring