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
FAILEDto 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
FAILEDstate.
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 Code | Reason Description |
|---|---|
| UNKNOWN_ERROR | An unknown error occurred. |
| PROCESSING_ERROR | Transaction processing failed. |
| EXCEEDED_LIMIT | Exceeded limit. |
| VALIDATION_FAILED | Transaction validation failed. |
| DICT_KEY_VERIFICATION_ERROR | Could not verify the provided DICT key. |
| REJECTED | The transaction was rejected because one or more signers did not approve it. |
| AMOUNT_REQUIRED | Transaction amount was missing when required. |
| QR_CODE_AMOUNT_MISMATCH | Provided amount differs from the amount specified in the QR code. |
| INVALID_ADDRESS | Invalid address. |
| PAYER_ID_ERROR | Payer ID error. |
| INVALID_ACCOUNT | Invalid account. |
| DUPLICATE_END_TO_END | Duplicate end-to-end. |
| INVALID_END_TO_END | Invalid end-to-end. |
| QUERY_DICT_BLOCKED | Query dictionary blocked. |
| SYSTEM_UNAVAILABLE | System unavailable. |
| BAD_REQUEST | Bad request. |
| UNAUTHORIZED | Unauthorized. |
| FORBIDDEN | Forbidden. |
| NOT_FOUND | Not found. |
| TOO_MANY_REQUESTS | Too many requests. |
| UNEXPECTED_ERROR | An unexpected error occurred. |
| BAD_GATEWAY | Bad gateway. |
| SERVICE_UNAVAILABLE | Service unavailable. |
| GATEWAY_TIMEOUT | Gateway timeout. |
| INVALID_REFUND | Invalid refund. |
| TRANSACTION_NOT_FOUND | Transaction not found. |
| REFUND_ALREADY_PROCESSED | Refund already processed. |
| REFUND_PROCESSING | Refund processing. |
| REFUND_EXPIRED_DEADLINE | Refund expired deadline. |
| NON_REFUNDABLE_TRANSACTION | Non-refundable transaction. |
| INVALID_SIGNATURE | Invalid signature. |
| INSUFFICIENT_BALANCE | Insufficient balance in the PSP payer's PI account. |
| CURRENT_ACCOUNT_STATE_NOT_ALLOW_CASH_OUT | Current account state does not allow cash out. |
| CLIENT_ACCOUNT_BALANCE_BLOCKED | Client's account balance is blocked. |
| SAME_ORIGIN_DESTINATION_ACCOUNT | Same origin and destination account. |
| ACCOUNT_BLOCKED | The specified account is blocked. |
| TRANSACTION_INTERRUPTED | Transaction interrupted due to a PSP error on the receiver's side. |
| TRANSACTION_AMOUNT_LIMIT_EXCEEDED | Transaction amount limit exceeded. |
| TRANSACTION_LIMIT_EXCEEDED | Daily transaction limit exceeded. |
| PAYMENTS_NOT_ALLOWED | Payments to this institution are not allowed. |
| INVALID_RETURN_OPERATION | Invalid operation. It is not allowed to return a return operation. |
| RETURN_REQUESTER_BENEFICIARY_MISMATCH | Return requester is not the same as the beneficiary of the movement to be returned. |
| INSUFFICIENT_BALANCE_FOR_REFUND | Insufficient balance to process the requested refund. |
| ADDITIONAL_RETURN_REASON_REQUIRED | Additional information of the return reason must be provided for the 'Narrative' type. |
| ICOM_PACS004_PROCESSING_ERROR | Error processing the pacs.004 in ICOM. |
| RESPONSE_WAIT_TIME_EXPIRED | Time limit for waiting for a response expired. |
| DUPLICATE_RETURN_ID | Duplicate Return ID. |
| INVALID_RETURN_ID | Invalid Return ID. |
| INVALID_RETURN_REASON | Invalid Return Reason. |
| INVALID_INFORMED_VALUE | Invalid informed value. |
| INVALID_BRANCH_CODE | Invalid branch code. |
| PAYMENT_AUTHORIZATION_FAILED | Failed to authorize the payment. |
| INSTANT_PAYMENT_API_BLOCK_MESSAGE | Message returned by the instant-payment-api-ebank - POST /gi/eb/account/block. |
| INSTANT_PAYMENT_API_TRANSFER_MESSAGE | Message returned by the instant-payment-api-ebank - POST /gi/eb/account/internal_transfer. |
| RECEIVER_PSP_ERROR_INTERRUPTED | Transaction interrupted due to an error at the Receiver's PSP. |
| RECEIVER_PSP_ACCOUNT_NUMBER_INVALID | Receiver's PSP transactional account number does not exist or is invalid. |
| SPI_TIMEOUT_CONTROL | SPI timeout control / Exceeding the timeout limit at the receiver's PSP. |
| RECEIVER_PSP_ACCOUNT_CLOSED | Receiver's PSP transactional account number closed. |
| RECEIVER_PSP_ACCOUNT_TYPE_INVALID | Receiver's PSP transactional account type does not exist or is invalid. |
| TRANSACTION_TYPE_NOT_SUPPORTED | Transaction type is not supported/authorized in this account. |
| RECEIVER_PSP_ACCOUNT_LIMIT_EXCEEDED | Receiver's PSP account limit exceeded. |
| INVALID_TRANSACTION_NUMBER | Invalid number of transactions. |
| CPF_CNPJ_ACCOUNT_HOLDER_MISMATCH | CPF/CNPJ of the receiving user is not consistent with the account holder credited. |
| CPF_CNPJ_RECEIVING_USER_INCORRECT | CPF/CNPJ of the receiving user is incorrect. |
| INCORRECT_MESSAGE_ELEMENT | Incorrect message element. |
| ORDER_REJECTED_BY_RECEIVER_PSP | Order rejected by the Receiver's PSP. |
| UNAUTHORIZED_PARTICIPANT_OPERATION | Participant who signed the message is not authorized to operate the debited PI account. |
| DEBTOR_MEMBER_IDENTIFIER_INVALID | Debtor ClearingSystemMember Identifier invalid or non-existent. |
| CREDITOR_MEMBER_IDENTIFIER_INVALID | Creditor ClearingSystemMember Identifier invalid or non-existent. |
| PAYING_USER_ACCOUNT_INFO_MANDATORY | Filling in the account information of the paying user is mandatory (except for STN). |
| QR_CODE_REFERENCE_ALREADY_USED | QR Code Reference has already been used previously. |
| INVALID_QR_CODE | Invalid QR Code. Please verify the qr code and try again. |
| EXPIRED_QR_CODE | QR Code is expired. |
| TRANSACTION_MAX_AMOUNT_EXCEEDED | Authorization rejected for exceeding amount limits (per transaction or daily). |
| INVALID_DICT_KEY | DICT Key provided is invalid. |
| INTERNAL_SERVER_ERROR | Error forwarding call to server. |
| CANCELED_BY_USER | Transaction canceled by user request. |
| PAYMENT_PROCESSING_ERROR | Error processing the payment (generic error). |
| TRANSACTION_ACCUMULATED_LIMIT_EXCEEDED | The transaction was rejected because the accumulated limit has been exceeded. |
| PARTNER_BANKING_ERROR | An intermittent error occurred in a banking partner. |
Updated 12 days ago
What’s Next
