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 /wallet/transactions/pre-approved
endpoint.
With a valid access token, make a request to the (POST/wallet/transactions/pre-approved) endpoint, sending the following parameters:
{
"identity": {
"key": "cpf",
"value": "HOLDERS_CPF"
},
"company": "COMPANY_ID",
"redirectUrl": "URL",
"card": {
"binDigits": "FIRST_6_OR_8_DIGITS_CARD",
"lastDigits": "LAST_4_DIGITS_CARD",
"expirationDate": "EXPIRATION_DATE_CARD",
"name": "HOLDERS_NAME"
}
}
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 |
Any concerns?
Missing something or still need help? If you are already a customer or partner, you can contact us through the Help Center.