Skip to main content

Transaction History

Introduction

The Transaction history module exposes features for managing transactions.

Transaction History Service

Service class for managing transactions related operations.

Get Single Transaction

Retrieves a specific user Transaction by ID.

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 ...