Skip to content

Transactions

Used for getting information about User transaction history. All endpoints are read only (GET). Using the API Invoices and Statements can be generated in .pdf form.

Get all transactions

Returns all Transaction for currently active User. Transaction info can be used for the invoices. The enpoint uses auth middlewares to extract user data from the currently active session.

URL : https://api.iotaap.io/v1/transactions/list

Method : GET

Auth required : YES - auth middleware is used with this endpoint - the currently active user will be extracted from the active session - transactions are guarded so Users can only access their own transactions

URL Params

  • draw (string): value will be returned back in the response
  • type (string: TOP_UP, NEW_DEVICE, NEW_GROUP, MQTT_CLIENTS, SUBSCRIPTION): filter transaction by type; default: TOP_UP
  • offset (integer): basic pagination; default 0
  • limit (integer): basic pagination limit; default 10
  • order (string: asc|desc): basic ordering parameter; default desc

Success Response

Code : 200 OK

Response example

{
    "transactions": [
        {
            "_id": "608d3fe578453806e44a402c",
            "type": "TOP_UP",
            "tid": "TU-qvo7fMNX",
            "user": "6083df8c82478a001b18c9d7",
            "date": "2021-05-01T11:47:49.811Z",
            "coins_before": 225,
            "coins_after": 235,
            "coins_transffered": 10,
            "total": 1,
            "ex_rt": 0.1,
            "vat": 5,
            "wallet_state": 235,
            "method": "PAYPAL",
            "status": "pending",
            "payment_identifier": "19A22266L1610103R"
        },
        {
            "_id": "608aeb61456350002e661079",
            "type": "TOP_UP",
            "tid": "TU-ROFas2o3",
            "user": "6083df8c82478a001b18c9d7",
            "date": "2021-04-29T17:22:41.041Z",
            "coins_before": 225,
            "coins_after": 235,
            "coins_transffered": 10,
            "total": 1,
            "ex_rt": 0.1,
            "vat": 5,
            "wallet_state": 235,
            "method": "PAYPAL",
            "status": "pending",
            "payment_identifier": "9XH62425R2345163S"
        }
    ],
    "recordsTotal": 2,
    "recordsFiltered": 2
}
Response Params

  • transactions (array): list of transactions (filtered by type and paginated using offset/limit)
  • recordsTotal (number): total number of records (transactions)
  • recordsFiltered (number): number of filtered records (will be the same as recordsTotal)
  • draw (string): draw string from request

Transaction Status

If the a transaction is of type: TOP_UP it status is limited to one of the following: - pending - top up request was submitted and is not fully processed - processed - top up request was processed in full, coins added to User wallet - canceled - top up request was canceled;

Error Response

Condition : If case of runtime errors the API responds with the following.

Code : 500 Internal Error

Content :

{
    "message": "Error getting Transactions",
    "error": "<Error information>"
}

Get single tansaction

Get details of a single transaction.

URL : https://api.iotaap.io/v1/transactions/single

Method : GET

Auth required : YES

URL Params Filters cannot be combined, you must use one of the following: - id - tid - payment_identifier - applicable for PAYPAL TOP_UP

Success Response

Code : 200 OK

Response example

{
    "_id": "608aeb61456350002e661079",
    "type": "TOP_UP",
    "tid": "TU-ROFas2o3",
    "user": "6083df8c82478a001b18c9d7",
    "date": "2021-04-29T17:22:41.041Z",
    "coins_before": 225,
    "coins_after": 235,
    "coins_transffered": 10,
    "total": 1,
    "ex_rt": 0.1,
    "vat": 5,
    "wallet_state": 235,
    "method": "PAYPAL",
    "status": "pending",
    "payment_identifier": "9XH62425R2345163S"
}

Generating invoices

URL : https://api.iotaap.io/v1/transactions/invoice

Method : GET

Auth required : YES - auth middleware is used with this endpoint - the currently active user will be extracted from the active session - transactions are guarded so Users can only access their own transactions

URL Params

  • transaction (string): transaction ID

URL example

https://api.iotaap.io/v1/transactions/invoice?transaction=6085891b3c73f1090b7788d4

Success Response

Code : 200 OK

PDF response

System will generate invoice for the selected transaction (if there is one) and send PDF as the response

Error Response

Condition : There was an issue verifying and fetching the active User session

Code : 500 INTERNAL SERVER ERROR

Content :

{
    "message": "Error getting user"
}

Condition : The request was made for non existing User

Code : 404 NOT FOUND

Content :

{
    "message": "User not found"
}

Condition : General server error

Code : 500 INTERNAL SERVER ERROR

Content :

{
    "message": "Error getting Transaction"
}

Condition : Request was made with non existing transaction ID

Code : 404 NOT FOUND

Content :

{
    "message": "Transaction not found"
}

Generating statements

URL : https://api.iotaap.io/v1/transactions/statement

Method : GET

Auth required : YES - auth middleware is used with this endpoint - the currently active user will be extracted from the active session - transactions are guarded so Users can only access their own transactions

URL Params

  • transaction (string): transaction ID

URL example

https://api.iotaap.io/v1/transactions/statement?transaction=6085891b3c73f1090b7788d4

Success Response

Code : 200 OK

PDF response

System will generate statement for the selected transaction (if there is one) and send PDF as the response

Error Response

Condition : There was an issue verifying and fetching the active User session

Code : 500 INTERNAL SERVER ERROR

Content :

{
    "message": "Error getting user"
}

Condition : The request was made for non existing User

Code : 404 NOT FOUND

Content :

{
    "message": "User not found"
}

Condition : General server error

Code : 500 INTERNAL SERVER ERROR

Content :

{
    "message": "Error getting Transaction"
}

Condition : Request was made with non existing transaction ID

Code : 404 NOT FOUND

Content :

{
    "message": "Transaction not found"
}