Once a transaction is submitted if the transaction fails you can get some errors. The error can happen due to many reasons. For example, phone using incorrect format, invalid amount, the merchant does not have enough balance, etc..

Validation Errors

The error 422 refer to invalid submitted data. Can safely display constraint violations message to final users, the user must update the form and try submitting the transaction again.

Validation error always contains a key called constraintViolations with some details about the validation error.

{
  "errors": [
    {
      "code": 422,
      "tracking_id": "AB083135-A2B1-5D80-F6DF-456EB938",
      "message": "Unprocessable Entity",
      "category": "user",
      "constraintViolations": [
        {
          "code": "c1051bb4-d103-4f74-8988-acbcafc7fdc3",
          "message": "This value should not be blank.",
          "messageTemplate": "This value should not be blank.",
          "propertyPath": "inputs.accountNumber",
          "parameters": {
            "{{ value }}": "\"\""
          },
          "invalidValue": ""
        }
      ]
    }
  ],
  "data": {
    "transactions": {
      "submit": {
        "transaction": null
      }
    }
  }
}

Other Errors

During the transaction process can receive others errors, please refer to error codes to ensure you display the correct message or action in each case.

{
  "errors": [
    {
      "code": 1101,
      "message": "Insufficient Funds",
      "category": "user"
    }
  ],
  "data": {
      "transactions": {
        "submit": null
      }
  }
}

When a error is returned in many cases the transaction is null, because the transaction can’t be processed, but some errors may return the transaction if it has already been approved and initialized, but failed during the process.

{
  "errors": [
    {
      "code": 2102,
      "tracking_id": "2353CA4C-7582-C83A-3194-FE3D34A4",
      "message": "Invalid Provider Product",
      "category": "user"
    }
  ],
  "data": {
    "transactions": {
      "submit": {
        "transaction": {
          "number": "00831046",
          "status": "FAILED"
        }
      }
    }
  }
}

It’s recommended when the transaction is returned, in your UI displays the number and status, the final customer must have this number in case of claim.