Retrieving all merchants transactions

In this section, we are going to retrieve all the transactions made by John Doe, retrieving the transactions is quite simple, all you need is to make a GET request to the transactions endpoint, and all transactions belonging to the merchant will be returned.

Let's take a look at an example.

var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://integrations.getravenbank.com/v1/accounts/transactions',
  headers: { }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
{
    "status": "success",
    "message": "transactions retrieved successfully",
    "data": {
        "transactions": [
            {
                "id": 22835,
                "email": "johndoe@gmail.com",
                "type": "collection",
                "currency": "NGN",
                "reference": "202209041407IHIHDIG",
                "b_before": 0,
                "b_after": 100,
                "direction": "credit",
                "_value": 100,
                "_fee": 0,
                "meta_data": "{\"account_number\":\"internal\",\"first_name\":\"TRF\",\"last_name\":\"\",\"narration\":\"EMMANUEL EZEANISent from RAVEN\",\"bank\":\"NotOnBankList\",\"bank_code\":\"110002\",\"createdAt\":\"2022-9-4 13:7:9\"}",
                "created_at": "2022-09-04T13:07:10.000Z",
                "updated_at": "2022-09-04T13:07:10.000Z",
                "deleted_at": null
            }
        ],
        "pagination": {
            "perPage": 50,
            "currentPage": 1,
            "nextPage": null,
            "prevPage": null,
            "totalPages": 1,
            "total": 1
        }
    }
}

Just as you see, we got a paginated response, with the user's transaction. Another question you might ask is how we were able to retrieve the merchant transaction without parsing the merchant details like merchant_id in the request, because our system checks if you are authenticated, and if true, it fetches the needed details to process the request from the request header, this makes it a whole lot easier for you to perform simple API actions, this also means you must be authenticated to carry our this type of API action.

👍

Try it in the console

Click here to try it