Transaction History
Introduction
The Transaction history module exposes features for managing transactions.
TransactionHistoryService
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 by accountId
or merchantRefNum
.
Either accountId
or merchantRefNum
must be provided. If both are missing a WalletError
will be returned.
TransactionHistoryParameters
:
Parameter | Data type/Format | Description | Example |
---|---|---|---|
accountId |
string | Used to filter transactions by account ID | '192837465' |
merchantRefNum |
string | Used to filter transactions by merchantRefNum |
'546372819' |
limit |
number | Optional parameter to limit the number of results | 20 |
offset |
number | Optional parameter to specify the starting point for fetching results, indicating the number of items to skip | 0 |
startDate |
string YYYY-MM-DD'T'HH:mm:ss'Z' |
Optional parameter to filter transactions created after the specified date and time | 2023-10-05T14:43:33Z |
endDate |
string YYYY-MM-DD'T'HH:mm:ss'Z' |
Optional parameter to filter transactions created before the specified date and time | 2023-11-05T14:43:33Z |
slipId |
string | Optional parameter to filter transactions by slipId | 5009964049 |
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));
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
const trnHistParams: TransactionHistoryParameters = { accountId: '1234567890', limit: 10, offset: 10 };
- Page 3: limit=10, offset=20
const trnHistParams: TransactionHistoryParameters = { accountId: '1234567890', limit: 10, offset: 20 };
Was this page helpful?
On this Page