Payment transactions

In this section, you will find all the technical specifications of the IDPay product REST APIs for managing payment transactions.


Before you begin


Your API requests are authenticated using an access token. Any request that does not include a valid access token will return an error.

You can learn more about how to generate an access token here.

Transaction creation


Create Transaction

post

Endpoint to create a new transaction.

Header parameters
AuthorizationstringRequired

Valid access token. The value must be sent in the format "Bearer {token}".

Body
orderNumberstringRequired

Order number associated with the transaction. This data will be used as an index in the portal and can be used as a foreign key between your system and IDPay.

Example: 123456
companystringRequired

ID of the company responsible for the transaction. This field is provided by Unico.

Example: f44f02e5-320e-497b-b346-8cf19b3ee2a4
redirectUrlstringOptional

URL to which the user will be redirected after completing the transaction. Possible values are: An https URL to redirect web pages or a URL Schema for redirection in native mobile applications.

Example: https://example.com/redirect
valuenumber Ā· floatRequired

Total purchase value.

Example: 100.5
phonestringOptional

Notification phone number. This parameter is optional, and if provided, a WhatsApp notification will be sent to the user.

Example: 5511998551010
emailstringOptional

Notification email. This parameter is optional, and if provided, an email notification will be sent to the user.

Example: user@example.com
Responses
200
Transaction successfully created.
application/json
post
POST /api/public/v1/credit/transaction HTTP/1.1
Host: transactions.transactional.uat.unico.app
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 405

{
  "identity": {
    "key": "cpf",
    "value": "USER_CPF"
  },
  "orderNumber": "123456",
  "company": "f44f02e5-320e-497b-b346-8cf19b3ee2a4",
  "redirectUrl": "https://example.com/redirect",
  "card": {
    "binDigits": "12345678",
    "lastDigits": "7890",
    "expirationDate": "12/24",
    "name": "João da Silva"
  },
  "value": 100.5,
  "phone": "5511998551010",
  "email": "user@example.com",
  "additionalInfo": {
    "seller": {
      "identity": {
        "key": "cpf",
        "value": "12345678909"
      }
    }
  }
}
{
  "id": "6ab1771e-dfab-4e47-8316-2452268e5481",
  "status": "waiting",
  "link": "https://aces.so/test",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cC[...]Ok6yJV_adQssw5c"
}

Reuse of Transactions


It is possible to configure the company to reuse transactions that have the same data, avoiding "replicated transaction" errors. The reuse will occur under the following conditions:

  • A transaction is being created with the same orderNumber, identity.key, identity.value, company, card.binDigits, card.lastDigits, and value of a previously created transaction.

  • The previous transaction has not yet exceeded the expiration time configured for the company.

If the transaction to be created and the previous transaction do not meet these conditions, a new transaction will be created. Otherwise, the following are the possible responses:

If the previous transaction is in a final status, such as approved or inconclusive:

{
    // previous transaction information
    "id": "6ab1771e-dfab-4e47-8316-2452268e5481",
    "status": "approved"
}

If the previous transaction is still in an initial status, such as waiting or shared:

{
    // previous transaction information
    "id": "6ab1771e-dfab-4e47-8316-2452268e5481",
    "status": "waiting",
    "link": "https://aces.so/teste",
    "token": "eyJhbGciOiJIUzI1NiIsIn[...]dQssw5c"
}

In this last case, the transaction still in an initial status will have its expiration date recalculated, based on the date of this request.

Transaction status query


To see all possible statuses, refer to the Enumerated section.

Obtaining the set of evidence for the transaction


Resending the transaction notification


It is also possible to configure the resending of notifications through the portal, without the need to implement it via API. To understand the possibilities, speak with the person responsible for your project.


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

Was this helpful?