Transaction Failure and State Transition

When a transaction fails, its state will transition to FAILED. This state transition indicates that the transaction could not be completed successfully due to an error or another issue.

State Structure

The State class is used to represent the current status of the transaction. When a transaction moves to the FAILED state, the State object will have the following attributes:

  • status: This will be set to FAILED to indicate that the transaction did not succeed.
  • reason: This attribute provides additional context about why the transaction failed. It contains detailed information in the form of a Reason object.
  • createdAt: his timestamp records when the state was created, reflecting the exact moment when the transaction transitioned to the FAILED state.

Reason Attribute

The Reason object within the State class provides further details about the failure. It includes:

  • code: A string that represents a specific error code, which can be used to identify the type of failure.
  • message: A descriptive message that explains the nature of the failure, providing more context for debugging or user communication.
  • details: A map containing any additional information related to the failure, which can include specific parameters, validation errors, or other relevant data.

Example

When a transaction fails due to insufficient balance, the State object might look like this:

{
  "status": "FAILED",
  "reason": {
    "code": "INSUFFICIENT_BALANCE",
    "message": "Insufficient balance in the PSP payer's PI account.",
    "details": {}
  },
  "createdAt": "2024-08-20T12:31:46.1400Z"
}
State(  
    status = "FAILED",  
    reason = Reason(  
        code = "INSUFFICIENT_BALANCE",  
        message = "Insufficient balance in the PSP payer's PI account.",  
        details = emptyMap() 
    ),  
    createdAt = ZonedDateTime.now()  
)

In this example:

  • The status is FAILED.
  • The reason contains an error code INSUFFICIENT_BALANCE, and a message explaining the failure.

This structure allows for clear and informative error handling, making it easier to diagnose and respond to transaction failures.


Reason Codes

Reason CodeReason Description
UNKNOWN_ERRORAn unknown error occurred.
PROCESSING_ERRORTransaction processing failed.
EXCEEDED_LIMITExceeded limit.
VALIDATION_FAILEDTransaction validation failed.
DICT_KEY_VERIFICATION_ERRORCould not verify the provided DICT key.
REJECTEDThe transaction was rejected because one or more signers did not approve it.
AMOUNT_REQUIREDTransaction amount was missing when required.
QR_CODE_AMOUNT_MISMATCHProvided amount differs from the amount specified in the QR code.
INVALID_ADDRESSInvalid address.
PAYER_ID_ERRORPayer ID error.
INVALID_ACCOUNTInvalid account.
DUPLICATE_END_TO_ENDDuplicate end-to-end.
INVALID_END_TO_ENDInvalid end-to-end.
QUERY_DICT_BLOCKEDQuery dictionary blocked.
SYSTEM_UNAVAILABLESystem unavailable.
BAD_REQUESTBad request.
UNAUTHORIZEDUnauthorized.
FORBIDDENForbidden.
NOT_FOUNDNot found.
TOO_MANY_REQUESTSToo many requests.
UNEXPECTED_ERRORAn unexpected error occurred.
BAD_GATEWAYBad gateway.
SERVICE_UNAVAILABLEService unavailable.
GATEWAY_TIMEOUTGateway timeout.
INVALID_REFUNDInvalid refund.
TRANSACTION_NOT_FOUNDTransaction not found.
REFUND_ALREADY_PROCESSEDRefund already processed.
REFUND_PROCESSINGRefund processing.
REFUND_EXPIRED_DEADLINERefund expired deadline.
NON_REFUNDABLE_TRANSACTIONNon-refundable transaction.
INVALID_SIGNATUREInvalid signature.
INSUFFICIENT_BALANCEInsufficient balance in the PSP payer's PI account.
CURRENT_ACCOUNT_STATE_NOT_ALLOW_CASH_OUTCurrent account state does not allow cash out.
CLIENT_ACCOUNT_BALANCE_BLOCKEDClient's account balance is blocked.
SAME_ORIGIN_DESTINATION_ACCOUNTSame origin and destination account.
ACCOUNT_BLOCKEDThe specified account is blocked.
TRANSACTION_INTERRUPTEDTransaction interrupted due to a PSP error on the receiver's side.
TRANSACTION_AMOUNT_LIMIT_EXCEEDEDTransaction amount limit exceeded.
TRANSACTION_LIMIT_EXCEEDEDDaily transaction limit exceeded.
PAYMENTS_NOT_ALLOWEDPayments to this institution are not allowed.
INVALID_RETURN_OPERATIONInvalid operation. It is not allowed to return a return operation.
RETURN_REQUESTER_BENEFICIARY_MISMATCHReturn requester is not the same as the beneficiary of the movement to be returned.
INSUFFICIENT_BALANCE_FOR_REFUNDInsufficient balance to process the requested refund.
ADDITIONAL_RETURN_REASON_REQUIREDAdditional information of the return reason must be provided for the 'Narrative' type.
ICOM_PACS004_PROCESSING_ERRORError processing the pacs.004 in ICOM.
RESPONSE_WAIT_TIME_EXPIREDTime limit for waiting for a response expired.
DUPLICATE_RETURN_IDDuplicate Return ID.
INVALID_RETURN_IDInvalid Return ID.
INVALID_RETURN_REASONInvalid Return Reason.
INVALID_INFORMED_VALUEInvalid informed value.
INVALID_BRANCH_CODEInvalid branch code.
PAYMENT_AUTHORIZATION_FAILEDFailed to authorize the payment.
INSTANT_PAYMENT_API_BLOCK_MESSAGEMessage returned by the instant-payment-api-ebank - POST /gi/eb/account/block.
INSTANT_PAYMENT_API_TRANSFER_MESSAGEMessage returned by the instant-payment-api-ebank - POST /gi/eb/account/internal_transfer.
RECEIVER_PSP_ERROR_INTERRUPTEDTransaction interrupted due to an error at the Receiver's PSP.
RECEIVER_PSP_ACCOUNT_NUMBER_INVALIDReceiver's PSP transactional account number does not exist or is invalid.
SPI_TIMEOUT_CONTROLSPI timeout control / Exceeding the timeout limit at the receiver's PSP.
RECEIVER_PSP_ACCOUNT_CLOSEDReceiver's PSP transactional account number closed.
RECEIVER_PSP_ACCOUNT_TYPE_INVALIDReceiver's PSP transactional account type does not exist or is invalid.
TRANSACTION_TYPE_NOT_SUPPORTEDTransaction type is not supported/authorized in this account.
RECEIVER_PSP_ACCOUNT_LIMIT_EXCEEDEDReceiver's PSP account limit exceeded.
INVALID_TRANSACTION_NUMBERInvalid number of transactions.
CPF_CNPJ_ACCOUNT_HOLDER_MISMATCHCPF/CNPJ of the receiving user is not consistent with the account holder credited.
CPF_CNPJ_RECEIVING_USER_INCORRECTCPF/CNPJ of the receiving user is incorrect.
INCORRECT_MESSAGE_ELEMENTIncorrect message element.
ORDER_REJECTED_BY_RECEIVER_PSPOrder rejected by the Receiver's PSP.
UNAUTHORIZED_PARTICIPANT_OPERATIONParticipant who signed the message is not authorized to operate the debited PI account.
DEBTOR_MEMBER_IDENTIFIER_INVALIDDebtor ClearingSystemMember Identifier invalid or non-existent.
CREDITOR_MEMBER_IDENTIFIER_INVALIDCreditor ClearingSystemMember Identifier invalid or non-existent.
PAYING_USER_ACCOUNT_INFO_MANDATORYFilling in the account information of the paying user is mandatory (except for STN).
QR_CODE_REFERENCE_ALREADY_USEDQR Code Reference has already been used previously.
INVALID_QR_CODEInvalid QR Code. Please verify the qr code and try again.
EXPIRED_QR_CODEQR Code is expired.
TRANSACTION_MAX_AMOUNT_EXCEEDEDAuthorization rejected for exceeding amount limits (per transaction or daily).
INVALID_DICT_KEYDICT Key provided is invalid.
INTERNAL_SERVER_ERRORError forwarding call to server.
CANCELED_BY_USERTransaction canceled by user request.
PAYMENT_PROCESSING_ERRORError processing the payment (generic error).
TRANSACTION_ACCUMULATED_LIMIT_EXCEEDEDThe transaction was rejected because the accumulated limit has been exceeded.
PARTNER_BANKING_ERRORAn intermittent error occurred in a banking partner.