Deposits
Introduction
Deposit module exposes features for managing deposits.
Deposit Service
The DepositService
can be used for managing deposit related operations.
Get Deposit Options
Retrieves a list of deposit options. The deposit options are all the available deposit options for the user.
Payment options refer to the methods of transferring funds(e.g., CARD
, BANK_TRANSFER
),
while instrument types pertain to the specific financial tools or mechanisms used in these transactions (
e.g., SEPA_BANK_ACCOUNT
, CARD
).
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
Wallet.getInstance().getDepositService().getOptions()
.then(response => console.log('Deposit options', response))
.catch(error => console.error('Error getting deposit options', error));
Preview deposit
Use preview
method to create a deposit for the current customer. Deposits are created in PREVIEW
state.
Deposits are created in a PREVIEW
state.
The operation allows to check deposit parameters and display the fees.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { DepositRequest } from '@paysafe/paysafe-wallet-saas-web/deposits';
import { PaymentInstrumentReference } from '@paysafe/paysafe-wallet-saas-web/payment-instruments';
import { InstrumentType } from '@paysafe/paysafe-wallet-saas-web/common';
const depositRequest: DepositRequest = {
amount: 1000,
currencyCode: 'USD',
paymentOption: PaymentOption.BANK_TRANSFER,
paymentInstrumentReference: {
instrumentType: InstrumentType.US_BANK_ACCOUNT,
id: '1234567890'
}
}
Wallet.getInstance().getDepositService().preview(depositRequest)
.then(response => console.log('Create deposit preview', response))
.catch(error => console.error('Error create deposit preview', error));
Create Deposit
Use create
method to perform the required validations and move the deposit in PENDING
state.
Pass the id
from the Deposit
object returned by the preview
method.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { DepositCreate } from '@paysafe/paysafe-wallet-saas-web/deposits';
const requestBody: DepositCreate = {
id: '1234567890'
}
Wallet.getInstance().getDepositService().create(requestBody)
.then(response => console.log('Create deposit', response))
.catch(error => console.error('Error create deposit', error));
Confirm Deposit
Use confirm
method to confirm the deposit. Pass the id
from the Deposit
object returned by the create
method.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { DepositConfirm } from '@paysafe/paysafe-wallet-saas-web/deposits';
const requestBody: DepositConfirm = {
id: '1234567890'
}
Wallet.getInstance().getDepositService().create(requestBody)
.then(response => console.log('Confirm deposit', response))
.catch(error => console.error('Error confirm deposit', error));
Get Deposits
Use getAll
method to retrieve a list of deposits by passing the GetDepositParameters
.
If no parameters are passed, it will return the last 10 deposits by default.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { GetDepositParameters } from '@paysafe/paysafe-wallet-saas-web/deposits';
const getDepositsParameters: GetDepositParameters = {
offset: 10,
limit: 10,
merchantRefNum: '1234567890',
slipId: '1234567890',
}
Wallet.getInstance().getDepositService().getAll(getDepositsParameters)
.then(response => console.log('Get all deposits', response))
.catch(error => console.error('Error get all deposit', error));
Get Deposit
Retrieves the deposit by passing the id of the deposit.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const depositId = '1234567890';
Wallet.getInstance().getDepositService().get(depositId)
.then(response => console.log('Get deposit', response))
.catch(error => console.error('Error get deposit', error));