Skip to main content

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"
}
NOTE

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 CodeCodeDescriptionReason
40040001error decoding jsonThe data sent does not match the service contract
40040002error validating jsonSome of the information is badly formatted or not filled in
40040024invalid nameThe name is filled with invalid characters or is not a valid name
40040021invalid phoneThe phone is invalid. The default to be followed is 55 DDD NUMBER. Example: 5543999999999
40040022invalid emailThe e-mail is invalid
40040027replicated transactionSent transaction already exists and cannot be recreated
40340301not allowedThe user does not have permission to perform such an action.
40440404company not foundThe company does not exist
42940001too many requestsRatelimit reached
50050001internal errorInternal 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.