Validate card in wallet


Introduction


This article explains how to validate card in wallet through the REST API.

How to use?


Make a POST request to the endpoint /wallet/transactions/pre-approved


With a valid access token, make a request to the (POST/wallet/transactions/pre-approved) endpoint, sending the following parameters:

{
    "identity": {
        "key": "cpf",
        "value": "CPF_DO_TITULAR"
    },
    "company": "ID_DA_EMPRESA",
    "redirectUrl": "URL",
    "card": {
        "binDigits": "6_OU_8_PRIMEIROS_DIGITOS_CARTAO",
        "lastDigits": "4_ULTIMOS_DIGITOS_CARTAO",
        "expirationDate": "DATA_VALIDADE_CARTAO",
        "name": "NOME_DO_TITULAR"
    }
}

The identity.value field must belong to the credit card owner. The company é field is provided by Unico. The redirectUrl field is used to redirect the person to the desired url address. The redirection is done at the end of the flow (webview). This field is optional. The expirationDate field is also optional.

The name field must be sent with the correct name and beware of encoding problems, incorrect and/or invalid values can cause problems with approval in the flow. Since this field is used in the experience and communication with the user.

The other fields are mandatory.

If everything is right in the request, the response is a JSON with the transaction ID, transaction status, token that can be used in the iFrame and the capture link, as follows:

{
    "id": "6ab1771e-dfab-4e47-8316-2452268e5481",
    "status": "waiting",
    "link": "https://aces.so/teste",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

If the pre-approval decides that it is not necessary to capture the biometrics, the response will have a different status and a link for the capture will not be generated, as follows:

{
    "id": "6ab1771e-dfab-4e47-8316-2452268e5481",
    "status": "fast-inconclusive"
}

If an error occurs, the response is a JSON with the error and the error code:

{
    "error": {
        "code": "40004",
        "description": "transaction id is invalid"
    }
}

The following is a list of possible errors returned by the service:

HTTP Code
Code
Description
Reason

400

40001

error decoding json

The data sent does not match the service contract

400

40002

error validating json

Some of the information is badly formatted or not filled in

403

40301

not allowed

The user does not have permission to perform such an action.

404

40404

company not found

The company does not exist

429

40001

too many requests

Ratelimit reached

500

50001

internal error

Internal service failure


Still need help?

Didn't find something or still need help? If you're already a client or partner, you can reach out through our Help Center.

Last updated

Copyright © 2024 unico. All rights reserved.