TRANSACTION

Endpoints

Get transactions

GET /transaction

Description: Returns transactions based on the provided filters. If no date filter is provided, the default search returns data from the last 30 days using transaction date as reference.

cURL
JavaScript
Python
curl 'https://api.solucx.com.br/public/transaction?date_from=2024-01-01&date_to=2024-01-31&limit=500' \
  -H 'x-solucx-api-key: YOUR_API_KEY' \
  -H 'x-solucx-user-token: YOUR_USER_TOKEN'

Responses:

  • 200 OK: Returns a list of transactions.
  • 201 Created: Returns an object containing the link to the CSV file.
  • 400 Bad Request: Invalid parameters.
  • 404 Not Found: No transaction found.

Return Object:


Create transaction

POST /transaction

Description: Creates a new transaction. It is necessary to have previously registered the store and the employee.

POST /public/transaction HTTP/1.1
Host: api.solucx.com.br
x-solucx-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 261

{
  "amount": 1,
  "store_id": 1,
  "employee_id": 1,
  "customer_id": 1,
  "register_date": "text",
  "journey": "text",
  "transaction_id": "text",
  "rating_items": [
    {
      "class_id": 2312,
      "score": 10
    },
    {
      "class": "teste",
      "score": 10
    }
  ],
  "param_{key}": "text",
  "param_{key2}": "text",
  "param_{key3}": "text"
}

Responses:

  • 201 Created: Transaction successfully created.
  • 422 Unprocessable Entity: Validation error.

Get transaction by id

GET /transaction/{id}

Description: Returns a transaction based on the provided id.

GET /public/transaction/{id} HTTP/1.1
Host: api.solucx.com.br
x-solucx-api-key: YOUR_API_KEY
Accept: */*

Responses:

  • 200 OK: Returns the transaction.
  • 400 Bad Request: Invalid ID.
  • 404 Not Found: Transaction not found.

Reverse transaction by id

DELETE /transaction/{id}

Description: Reverses a transaction, removing it from reports but keeping it in the system.

DELETE /public/transaction/{id} HTTP/1.1
Host: api.solucx.com.br
x-solucx-api-key: YOUR_API_KEY
Accept: */*

Responses:

  • 200 OK: Transaction successfully reversed.
  • 400 Bad Request: Transaction not found.

Using transactionId for assertive queries:

For the current Infrastructure, queries that sum transactions over long periods are major offenders, as they overload our servers and generate slowness both in the query in question and in the next ones. Therefore, it is recommended:

  • Queries that perform a quantitative scan (count) or search within a time interval, using transactionId as a search parameter:
curl --request GET \
--url 'https://api.solucx.com.br/public/transaction?date_to=2024-04-30&date_from=2024-04-01&transactionId=123' \
-H 'x-solucx-api-key: YOUR_API_KEY' \
-H 'x-solucx-user-token: YOUR_USER_TOKEN'