Removed unused InvalidRequest exception. Added ServerError exception. Modified response processing to raise a ServerError on HTTP 5xx statuses since these are non-recoverable errors that do not depend on the client's input. The ServerError provides the API error code and, if available, the entity ID (for cases of new transactions being created in which the failure occurs after the PENDING status transaction is committed).