Skip to main content

Authorization History

Introduction

The Authorization history module exposes features for managing authorizations.

Authorization History Service

Service class for managing authorizations related operations.

Get Single Authorization

Retrieves a specific user Authorization by ID.

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

const authorizationId = '5243cfd4-587a-4ad9-8a90-1ece9c303465';

Wallet.getInstance().getAuthorizationHistoryService().getAuthorization(authorizationId)
.then(response => console.log('Authorization info', response))
.catch(error => console.error('Error fetching authorization history', error));

Get Authorization History

Retrieves a list of user authorizations(AuthorizationList) based on AuthorizationHistoryParameters.

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

/**
* All filters are optional.
*/
const authorizationHistoryParameters: AuthorizationHistoryParameters = {
accountId: '123456789',
};

Wallet.getInstance().getAuthorizationHistoryService().getAuthorizationHistory(authorizationHistoryParameters)
.then(response => console.log('Authorization history', response))
.catch(error => console.error('Error fetching authorization 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 authHistParams: AuthorizationHistoryParameters = {
    limit: 10,
    offset: 0
    };
  • Page 2: limit=10, offset=10 ...
  • Page 3: limit=10, offset=20 ...