Skip to main content

Transaction History

Introduction

The Transaction History Service provides operations to retrieve customer’s past transactions. It supports flexible filtering, pagination, and reports generation.

Key Features

  • Retrieve all transactions associated for a customer.
  • Apply filters (date, status, type) and paginate results.
  • Generate and download detailed transaction history reports.

Prerequisites

Before integrating the Transaction History Service, ensure you have:

  • A valid Paysafe account with appropriate permissions.
  • Set up instructions for Paysafe SDK Android or iOS.

To get started, initialize the TransactionHistoryService instance in your app as shown below:

import com.paysafe.wallet.android.core.wallet.Wallet

val transactionHistory = Wallet.getInstance().getTransactionHistoryService()

Get Transaction History

Use getTransactionHistory method to retrieve a list of customer's transactions for an account or specific merchantRefNum ordered by creationTime descending. Configure the filtering and pagination by providing a TransactionHistoryParameters object. Either accountId or merchantRefNum must be provided. If both are missing a WalletException will be thrown.

The result is a TransactionList, containing a list of Transaction objects and a PagingResultMeta, used for pagination implementation.

val parameters = TransactionHistoryParameters(
accountId = "1234567890",
merchantRefNum = null,
slipId = null,
limit = null,
offset = null,
startDate = null,
endDate = null,
status = null,
type = null,
cardId = null
)

try {
val transactionList = transactionHistory.getTransactionHistory(parameters)
Log.d(TAG, transactionList.transactions.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

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
  • Page 2: limit=10, offset=10
  • Page 3: limit=10, offset=20
val parameters = TransactionHistoryParameters(
accountId = "1234567890",
merchantRefNum = null,
slipId = null,
limit = 10,
offset = 20, // change the offset for the corresponding page
startDate = null,
endDate = null,
status = null,
type = null,
cardId = null
)

Get Single Transaction

Use getTransaction method to retrieve a specific customer transaction by ID. The result is a Transaction object, containing transaction amount, currency code, creation time, etc.

note

Transactions of type PREPAID_CARD_AUTHORIZATION should be retrieved from Authorization history service

try {
val transaction = transactionHistory.getTransaction("1234567890")
Log.d(TAG, transaction.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Transaction History Report

The Transaction History Report feature allows you to generate and download detailed reports of customer transactions. It supports various formats and can be customized to include specific transaction type, making it easy to analyze and share transaction history.

Steps to generate a transaction history report:

  1. Request a Transaction History Report: Use the requestTransactionHistoryReport method to initiate the generation of a transaction report.
  2. Get Transaction History Report Status: Use the getTransactionHistoryReportStatus method to check the status of the report generation.
  3. Get Transaction History Report: Use the getTransactionHistoryReport method to download the report once it is ready.

Request Transaction History Report

Use the requestTransactionHistoryReport method to request transaction report generation. You can apply filters such as startDate, endDate, format, and transactionType to customize the report.

The result is a TransactionHistoryReportStatusResponse object, containing report identifier and status.

try {
var reportRequest = TransactionHistoryReportRequest(
format = TransactionHistoryReportFormat.PDF,
accountId = "4632535"
)
val reportStatus = transactionHistory.requestTransactionHistoryReport(reportRequest)
Log.d(TAG, reportStatus.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}

Get Transaction History Report Status

Use the getTransactionHistoryReportStatus method to check the status of a previously requested transaction report. Poll this status periodically until it returns either COMPLETED or FAILED.

The result is a TransactionHistoryReportStatusResponse object, containing report identifier, status, format, etc.

try {
val reportId = reportStatus.reportId
val reportStatus = transactionHistory.getTransactionHistoryReportStatus(reportId)
Log.d(TAG, reportStatus.toString())
} catch (exception: Exception) {
Log.d(TAG, reportStatus.toString())
}

Get Transaction History Report

Use getTransactionHistoryReport method to download the transaction report once you receive a COMPLETED status from the previous step.

The result is a TransactionHistoryReport object, containing report file path and type.

try {
val reportId = reportStatus.reportId
val report = transactionHistory.requestTransactionHistoryReport(reportId)
Log.d(TAG, report.toString())
} catch (exception: Exception) {
Log.d(TAG, exception.toString())
}
note

The report is stored as temporary file and can be accessed using the path property of the TransactionHistoryReport object.