Dashboard

QR Code Validations

When creating a Dynamic QR code, you have the option to include a set of validations that will be applied once the QR code is paid and a corresponding credit transaction is generated. If any of the validations fail, the credit transaction will be marked as FAILED and will automatically be fully refunded, changing the transaction status to REFUNDED.

Validation Structure

The validation structure for a dynamic QR code follows the same key-value format as other transaction validations:

{
  "key": "KEY_NAME",
  "value": "VALUE"
}

  • Key: Specifies the type of validation.
  • Value: Defines the criteria or data to be validated.

Example Scenario

If a dynamic QR code is created with validations and the corresponding payment leads to a credit transaction, the transaction will be subject to the validations that were defined during the QR code creation.

In the event that a validation fails, the following sequence will occur:

  1. The credit transaction status will change to FAILED.
  2. The transaction will then be fully refunded, and its status will update to REFUNDED.

Here is an example of how a failed credit transaction state due to validation failure would look:

{
  "status": "FAILED",
  "reason": {
    "code": "VALIDATION_FAILED",
    "message": "Transaction failed due to validations failure.",
    "details": {
      "validations": [
        {
          "key": "TAX_ID_MUST_MATCH"
        }
      ]
    }
  },
  "createdAt": "2024-09-06T23:32:08.824+0000"
}


Available Validations

The following validations can be applied during the transaction process:

KeyValue TypeDescription
TAX_ID_MUST_BE_ACTIVEBooleanVerify if the origin's tax ID (the person or institution that made the QR Code payment) is active. If it is not, the transaction will fail.
TAX_ID_MUST_MATCHString (Tax ID)Verify if the origin's tax ID (the person or institution that made the QR Code payment) matches the tax ID provided in the value. If they do not match, the transaction will fail.

Priority Mechanism

As with other validations, the dynamic QR code validations follow a priority mechanism. This means that if one validation fails, subsequent validations will not be executed. This ensures that the system avoids unnecessary costs and processing time.

Important Notes

  • Validations are optional: If no validations are provided during the QR code creation, the transaction will proceed without validation checks.
  • If any validation fails, the credit transaction will transition to FAILED and will be fully refunded, taking its final state to be REFUNDED.
  • The value type for each validation key must match the expected type (e.g., Boolean, String).

By ensuring that your QR code transactions adhere to these validation rules, you can safeguard the integrity of your credit transactions and automatically handle failed validations with a refund process.