Skip to main content

Transaction History

Introduction

The Transaction history module exposes features for managing transactions.

Transaction History Service

The TransactionHistoryService can be used for managing transactions related operations.

Get Single Transaction

Retrieves a specific user Transaction by ID.

note

Transactions of type PREPAID_CARD_AUTHORIZATION should be retrieved from Authorization history service

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';

const transactionId = '1234567890';

Wallet.getInstance().getTransactionHistoryService().getTransaction(transactionId)
.then(response => console.log('Transaction info', response))
.catch(error => console.error('Error fetching transaction history', error));

Get Transaction History

Retrieves a list of user transactions(TransactionList) based on TransactionHistoryParameters. Either accountId or merchantRefNum must be provided. If both are missing a WalletError will be returned.

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { TransactionHistoryParameters } from '@paysafe/paysafe-wallet-saas-web/transaction-history';

/**
* You can choose to provide only one of these or both.
* The rest of the filters are optional.
*/
const transactionHistoryParameters: TransactionHistoryParameters = {
accountId: '1234567890',
merchantRefNum: '0987654321'
};

Wallet.getInstance().getTransactionHistoryService().getTransactionHistory(transactionHistoryParameters)
.then(response => console.log('Transaction history', response))
.catch(error => console.error('Error fetching transaction history', error));

Pagination

tip

You can achieve pagination by combining the limit and offset filters. For instance, implementing pagination with a page size of 10 results per page would involve configuring:

  • Page 1: limit=10, offset=0
    const trnHistParams: TransactionHistoryParameters = {
    accountId: '1234567890',
    limit: 10,
    offset: 0
    };
  • Page 2: limit=10, offset=10 ...
  • Page 3: limit=10, offset=20 ...

Request Transaction History Report

Creates a Transaction history report.

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { TransactionHistoryReportRequest } from '@paysafe/paysafe-wallet-saas-web/transaction-history';

const reportRequest: TransactionHistoryReportRequest = {
accountId: '5014567344',
format: TransactionHistoryReportFormat.CSV,
startDate: '2024-01-01T00:00:00.000Z',
endDate: '2024-12-31T23:59:59.999Z'
};

Wallet.getInstance().getTransactionHistoryService().createTransactionsReport(reportRequest)
.then(response => console.log('Transaction history report', response))
.catch(error => console.error('Error creating transaction history report', error));

Get Transaction History Report Status

Retrieves a Transaction history report status.

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';

const reportId = 1234567890;

Wallet.getInstance().getTransactionHistoryService().getTransactionsReportStatus(reportId)
.then(response => console.log('Transaction history report status', response))
.catch(error => console.error('Error getting transaction history report status', error));

Get Transaction History Report

Retrieves a Transaction history report

import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';

const reportId = 1234567890;

Wallet.getInstance().getTransactionHistoryService().downloadTransactionsReport(reportId)
.then(response => console.log('Transaction history report', response))
.catch(error => console.error('Error getting transaction history report', error));