Profile Information
Introduction
The profile information module contains features that allow you to manage customer-related details.
Profile Service
The ProfileService
gives access to information related to customer profile and balance.
Get Profile
Retrieves customer information. By default, limited information is returned. Use ProfileInclude array parameter to add additional information into the response:
Get default profile information
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
Wallet.getInstance().getProfileService().getProfile()
.then((customerInfo) => console.log('Customer info', customerInfo))
.catch((error) => console.error(error));
Get detailed profile information
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
Wallet.getInstance().getProfileService().getProfile([ProfileInclude.ACCOUNTS, ProfileInclude.RESTRICTIONS, ProfileInclude.ADDRESS, ProfileInclude.CONTACTINFO])
.then((customerInfo) => console.log('Customer info', customerInfo))
.catch((error) => console.error(error));
Both methods return CustomerInfo instance.
Get Customer Accounts
Retrieves customer Account[]
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
Wallet.getInstance().getProfileService().getAccounts()
.then((accounts) => console.log('Accounts', accounts))
.catch((error) => console.error(error));
Get Customer Account
Retrieves customer Account by account ID
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const accountId = '1234567890';
Wallet.getInstance().getProfileService().getSingleAccount(accountId)
.then((account) => console.log('Account', account))
.catch((error) => console.error(error));
Account object has as a field instruments
of type PaymentInstrument[]
These payment instruments can be of the following types:.
The discriminator by which can be determined the type of the PaymentInstrument is the instrumentType
field of the object.
Add Customer Account
Adds a new customer account.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const addAccountRequest: AddAccountRequest = {
currencyCode: 'EUR'
};
Wallet.getInstance().getProfileService().addAccount(addAccountRequest)
.then((account) => console.log('Account', account))
.catch((error) => console.error(error));