Create Transaction
Introduction
This article explains how to create a transaction through the REST API.
This method is used to create a transaction and also to generate the authentication link so that, after capturing the image, the necessary validations are performed. All the validation in this flow is done after the end user captures the biometrics (the validation is performed asynchronously).
This method cannot be used along with Create Pre-Approved Transaction.
This option is used:
- When you want to capture the photo of your entire flow;
- Preferably for sales recovery;
- When the informed identification (CPF for example) does not necessarily belong to the cardholder (this flow allows the user to share the validation with the real cardholder or inform a new CPF during validation);
- Others.
How to use?
Make a POST request to the /credit/transactions/link
endpoint.
With a valid access token, make a request to the (POST/credit/transactions/link) endpoint, sending the following parameters:
{
"identity": {
"key": "cpf",
"value": "USER_CPF"
},
"orderNumber": "ORDER_NUMBER",
"company": "COMPANY_ID",
"redirectUrl": "URL",
"card": {
"binDigits": "FIRST_6_OR_8_DIGITS_CARD",
"lastDigits": "LAST_4_DIGITS_CARD",
"expirationDate": "EXPIRATION_DATE_CARD",
"name": "NAME"
},
"value": PURCHASE_VALUE,
"phone": "CELL_PHONE_NOTIFICATION",
"email": "EMAIL_NOTIFICATION"
}
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 phone and email fields are not required. If the phone field is empty, the SMS is not sent. If the email field is empty, the E-mail is also not sent. There is a possibility of not completing these fields. In this case, sending can be done through whatsapp, app push, webview in app.
The other fields are mandatory.
If everything is right in the request, the response is a JSON with the capture link and the transaction ID, as follows:
{
"id": "6ab1771e-dfab-4e47-8316-2452268e5481",
"link": "https://aces.so/teste"
}
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 |
400 | 40024 | invalid name | The name is filled with invalid characters or is not a valid name |
400 | 40021 | invalid phone | The phone is invalid. The default to be followed is 55 DDD NUMBER. Example: 5543999999999 |
400 | 40022 | invalid email | The e-mail is invalid |
400 | 40027 | replicated transaction | Sent transaction already exists and cannot be recreated |
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.