Skip to main content

Create Pre-Approved Transaction

Introduction

This article explains how to create a pre-approved transaction through the REST API.

This method is used to create a transaction. It also performs a pre-approval of the informed data. Thus, the biometric capture is not necessary in all cases.

This method cannot be used along with Create Transaction.

This option is used:

  • When the IDPay is at the top of the funnel;
  • In a 100% integrated solution with the biometric capture through Webview;
  • When the informed identification (CPF for example) belongs to the cardholder (this flow does not allow the user to share the validation with the real holder or inform a new CPF during the validation);
  • Others.

How to use?

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

With a valid access token, make a request to the (POST/credit/transactions/pre-approved) 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 transaction ID, transaction status and the capture link, as follows:

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

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 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.