Balances and transactions

The Accounts endpoint can be used to get details on all the payment accounts you have access to. Also, the Transactions endpoint can be used to look at the transactions of payment account(s) you have access to.

Payment account details

These code examples illustrate two options for accessing payment accounts: First, you can gather all accounts a user has access to across various merchants. Alternatively, by including a specific merchant ID in the request, you can narrow down the results to accounts associated with that particular merchant, useful in cases where a user has access to multiple merchants. To access accounts endpoint, a OAuth access token is required.

using System.Net.Http.Json;

string merchantID = "<YOUR_MERCHANT_ID>";

string url = $"https://api-sandbox.nofrixion.com/api/v1/accounts?merchantID={merchantID}";

var jwtToken = "<ACCESS_TOKEN>";

var client = new HttpClient();
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {jwtToken}");

try
{
    var response = await client.GetAsync(url);
    response.EnsureSuccessStatusCode();

    // response body contains JSON array of merchant accounts
    var accounts = await response.Content.ReadFromJsonAsync<IEnumerable<PaymentAccount>>();
    if (response.IsSuccessStatusCode)
    {
        if (accounts != null)
        {
            foreach (var account in accounts)
            {
                Console.WriteLine(account);
            }
        }
        else
        {
            Console.WriteLine(($"You do not have any accounts."));
        }
    }
    else
    {
        // HTTP error codes will return a MoneyMoov API problem object
        Console.WriteLine(await response.Content.ReadFromJsonAsync<ApiProblem>());
    }
}
catch (Exception e)
{
    Console.WriteLine($"Error: {e.Message}");
}
record AccountIdentifier(string type, string currency, string iban, string bic, string sortCode, string accountNumber, string bitcoinAddress);
record PaymentAccount(string id, string merchantID, decimal balance, decimal submittedPayoutsBalance, string currency, AccountIdentifier identifier, decimal availableBalance, string summary);
record ApiProblem(string type, string title, int status, string detail);
const axios = require('axios');

const merchantID = "<YOUR_MERCHANT_ID>";
const url = `https://api-sandbox.nofrixion.com/api/v1/accounts?merchantID=${merchantID}`;
const jwtToken = "<ACCESS_TOKEN>";

axios.get(url, {
    headers: {
        'Accept': 'application/json',
        'Authorization': `Bearer ${jwtToken}`
    }
})
.then(response => {
    // response body contains JSON array of merchant accounts
    const accounts = response.data;
    if (response.status === 200) {
        if (accounts.length > 0) {
            accounts.forEach(account => {
                console.log(account);
            });
        } else {
            console.log('You do not have any accounts.');
        }
    } else {
        // HTTP error codes will return a MoneyMoov API problem object
        console.log('Error: ', response.data);
    }
})
.catch(error => {
    // This will handle any other errors, including network issues
    console.log(`Error: ${error.message}`);
});

import requests

# Set the merchant ID and the API URL
merchant_id = "<YOUR_MERCHANT_ID>"
url = f"https://api-sandbox.nofrixion.com/api/v1/accounts?merchantID={merchant_id}"

# Set the JWT token for authorization
jwt_token = "<ACCESS_TOKEN>"
headers = {
    'Accept': 'application/json',
    'Authorization': f'Bearer {jwt_token}'
}

try:
    # Sending a GET request to the API
    response = requests.get(url, headers=headers)
    
    # Ensuring the response status is successful
    response.raise_for_status()

    # Response body contains JSON array of merchant accounts
    accounts = response.json()
    if accounts:
        for account in accounts:
            print(account)
    else:
        print("You do not have any accounts.")

except requests.exceptions.HTTPError as http_err:
    # HTTP error codes will return a MoneyMoov API problem object
    print(f'HTTP error occurred: {http_err}')
    print(response.json())
except Exception as e:
    # Handle other exceptions such as network errors
    print(f'Error: {e}')

Transactions History

The account transactions endpoint returns a JSON object containing:

  • an array containing the number of transactions specified (default = 20).
  • some metadata about the transaction history, including the total number of transactions the number of pages
using System.Net.Http.Json;

// Id of account to get transaction history from 
string paymentAccountID = "<YOUR_PAYMENT_ACCOUNT_ID>";

int pageSize = 10;

int pageNumber = 1;

string baseUrl = $"https://api-sanbox.nofrixion.com/api/v1/transactions?accountID={paymentAccountID}&pageNumber={pageNumber}&pageSize={pageSize}";

var jwtToken = "<ACCESS_TOKEN>";

var client = new HttpClient();
client.DefaultRequestHeaders.Add("Accept", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {jwtToken}");

try
{
    var response = await client.GetAsync(baseUrl);
    if (response.IsSuccessStatusCode)
    {
        // response body contains some transaction page metadata JSON array of transactions
        var page = await response.Content.ReadFromJsonAsync<TransactionPage>();
        if (page != null)
        {
            // User some of the page metadata
            Console.WriteLine($"Showing page {page.pageNumber} of {page.totalPages} ({page.pageSize} of {page.totalSize} transactions)");
            // Show the returned transactions
            foreach (Transaction trans in page.content)
            {
                Console.WriteLine(trans);
            }
        }
        else
        {
            Console.WriteLine($"No transactions returned.");
        }
    }
    else
    {
        // HTTP error codes will return a MoneyMoov API problem object
        Console.WriteLine(await response.Content.ReadFromJsonAsync<ApiProblem>());
    }
}
catch (Exception e)
{
    Console.WriteLine($"Error: {e.Message}");
}

record Transaction(string id, string accountID, string accountName, string type, decimal amount, string currency, string description, string transactionDate, string yourReference, string theirReference, Counterparty counterParty, decimal balance);
record TransactionPage(List<Transaction> content, int pageNumber, int pageSize, int totalPages, long totalSize);
record AccountIdentifier(string type, string currency, string iban, string bic, string sortCode, string accountNumber, string bitcoinAddress);

record Counterparty(string name, AccountIdentifier Identifier);
record ApiProblem(string type, string title, int status, string detail);
const axios = require('axios');

// Id of the account to get transaction history from
const paymentAccountID = "<YOUR_PAYMENT_ACCOUNT_ID>";

const pageSize = 10;
const pageNumber = 1;

const baseUrl = `https://api-sanbox.nofrixion.com/api/v1/transactions?accountID=${paymentAccountID}&pageNumber=${pageNumber}&pageSize=${pageSize}`;

const jwtToken = "<ACCESS_TOKEN>";

const config = {
    headers: {
        'Accept': 'application/json',
        'Authorization': `Bearer ${jwtToken}`
    }
};

async function getTransactionHistory() {
    try {
        // Sending a GET request to the API
        const response = await axios.get(baseUrl, config);

        if (response.status === 200) {
            // response body contains some transaction page metadata JSON array of transactions
            const page = response.data;
            if (page) {
                // Use some of the page metadata
                console.log(`Showing page ${page.pageNumber} of ${page.totalPages} (${page.pageSize} of ${page.totalSize} transactions)`);
                // Show the returned transactions
                page.content.forEach(trans => {
                    console.log(trans);
                });
            } else {
                console.log("No transactions returned.");
            }
        } else {
            // HTTP error codes will return a MoneyMoov API problem object
            console.log('Error: ', response.data);
        }
    } catch (error) {
        // This will handle any other errors, including network issues
        console.log(`Error: ${error.message}`);
    }
}

getTransactionHistory();

import requests

# Id of the account to get transaction history from
payment_account_id = "<YOUR_PAYMENT_ACCOUNT_ID>"

page_size = 10
page_number = 1

base_url = f"https://api-sanbox.nofrixion.com/api/v1/transactions?accountID={payment_account_id}&pageNumber={page_number}&pageSize={page_size}"

jwt_token = "<ACCESS_TOKEN>"
headers = {
    'Accept': 'application/json',
    'Authorization': f'Bearer {jwt_token}'
}

def get_transaction_history():
    try:
        # Sending a GET request to the API
        response = requests.get(base_url, headers=headers)

        if response.status_code == 200:
            # response body contains some transaction page metadata JSON array of transactions
            page = response.json()
            if page:
                # Use some of the page metadata
                print(f"Showing page {page['pageNumber']} of {page['totalPages']} "
                      f"({page['pageSize']} of {page['totalSize']} transactions)")
                # Show the returned transactions
                for trans in page['content']:
                    print(trans)
            else:
                print("No transactions returned.")
        else:
            # HTTP error codes will return a MoneyMoov API problem object
            print('Error: ', response.json())

    except Exception as e:
        # This will handle any other errors, including network issues
        print(f'Error: {e}')

get_transaction_history()