Payment Instruments
Introduction
The Payment Instruments module exposes features for managing payment instruments such as bank accounts.
PaymentInstrumentsService
Service class for managing payment instrument related operations.
Get Payment Instruments
Use getAll
function to retrieve a list of payment instruments. PaymentInstrumentsParameters
is used to filter the response by instrument type using instrumentType
and by payment option using paymentOption
. undefined
can be passed instead of PaymentInstrumentsParameters
if there are no filters applied.
PaymentInstrumentsParameters
:
Parameter | Data type/Format | Description | Example |
---|---|---|---|
instrumentType |
InstrumentType | Optional parameter to specify the payment instrument type | US_BANK_ACCOUNT |
paymentOption |
PaymentOption | Optional parameter to specify the payment option | BANK_TRANSFER |
InstrumentType
Enum representing different types of financial instruments.
TypeScript possible values | JavaScript possible values | Description |
---|---|---|
InstrumentType.SEPA_BANK_ACCOUNT |
'SEPA_BANK_ACCOUNT' |
SEPA bank account. |
InstrumentType.UK_BANK_ACCOUNT |
'UK_BANK_ACCOUNT' |
UK bank account. |
InstrumentType.US_BANK_ACCOUNT |
'US_BANK_ACCOUNT' |
US bank account. |
InstrumentType.CARD |
'CARD' |
Payment card. |
PaymentOptionType
Enum representing different types of payment options.
TypeScript possible values | JavaScript possible values | Description |
---|---|---|
PaymentOptionType.RAPID_TRANSFER |
'RAPID_TRANSFER' |
Rapid transfer. |
PaymentOptionType.BANK_TRANSFER |
'BANK_TRANSFER' |
Bank transfer. |
PaymentOptionType.CARD |
'CARD' |
Card. |
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { PaymentInstrumentsParameters } from '@paysafe/paysafe-wallet-saas-web/payment-instruments';
import { InstrumentType, PaymentOptionType } from '@paysafe/paysafe-wallet-saas-web/common';
/**
* You can choose to provide none, one or both parameters.
*/
const paymentInstrumentsParameters: PaymentInstrumentsParameters = {
instrumentType: InstrumentType.US_BANK_ACCOUNT,
paymentOption: PaymentOptionType.BANK_TRANSFER
};
Wallet.getInstance().getPaymentInstrumentService().getAll(paymentInstrumentsParameters)
.then(response => console.log('Payment instruments', response))
.catch(error => console.error('Error fetching payment instruments', error));
Get Payment Instrument
Use get
function to retrieve a single instrument with specific type and identifier.
PaymentInstrumentParameters
Parameter | Data type/Format | Description | Example |
---|---|---|---|
instrumentId |
string | Used to filter instruments by ID | '6598347939' |
instrumentType |
InstrumentType | Used to filter instruments by payment instrument type | US_BANK_ACCOUNT |
InstrumentType
Enum representing different types of financial instruments.
TypeScript possible values | JavaScript possible values | Description |
---|---|---|
InstrumentType.SEPA_BANK_ACCOUNT |
'SEPA_BANK_ACCOUNT' |
SEPA bank account. |
InstrumentType.UK_BANK_ACCOUNT |
'UK_BANK_ACCOUNT' |
UK bank account. |
InstrumentType.US_BANK_ACCOUNT |
'US_BANK_ACCOUNT' |
US bank account. |
InstrumentType.CARD |
'CARD' |
Payment card. |
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { PaymentInstrumentParameters } from '@paysafe/paysafe-wallet-saas-web/payment-instruments';
import { InstrumentType } from '@paysafe/paysafe-wallet-saas-web/common';
const paymentInstrumentParameters: PaymentInstrumentParameters = {
instrumentId: '6598347939',
instrumentType: InstrumentType.US_BANK_ACCOUNT
};
Wallet.getInstance().getPaymentInstrumentService().get(paymentInstrumentParameters)
.then(response => console.log('Payment instrument', response))
.catch(error => console.error('Error fetching payment instrument', error));
Delete Single Payment Instrument
Use delete
function to remove specific payment instrument.
PaymentInstrumentParameters
:
Parameter | Data type/Format | Description | Example |
---|---|---|---|
instrumentId |
string | Used to filter instruments by ID | '6598347939' |
instrumentType |
InstrumentType | Used to filter instruments by payment instrument type | US_BANK_ACCOUNT |
InstrumentType
Enum representing different types of financial instruments.
TypeScript possible values | JavaScript possible values | Description |
---|---|---|
InstrumentType.SEPA_BANK_ACCOUNT |
'SEPA_BANK_ACCOUNT' |
SEPA bank account. |
InstrumentType.UK_BANK_ACCOUNT |
'UK_BANK_ACCOUNT' |
UK bank account. |
InstrumentType.US_BANK_ACCOUNT |
'US_BANK_ACCOUNT' |
US bank account. |
InstrumentType.CARD |
'CARD' |
Payment card. |
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { PaymentInstrumentParameters } from '@paysafe/paysafe-wallet-saas-web/payment-instruments';
import { InstrumentType } from '@paysafe/paysafe-wallet-saas-web/common';
const paymentInstrumentParameters: PaymentInstrumentParameters = {
instrumentId: '6598347939',
instrumentType: InstrumentType.US_BANK_ACCOUNT
};
Wallet.getInstance().getPaymentInstrumentService().delete(paymentInstrumentParameters)
.then(response => console.log('Payment instrument', response))
.catch(error => console.error('Error fetching payment instruments', error));
Start Instrument Verification
Use startVerification
function to create new instrument verification session. You should call this function first when you want to add a new payment instrument. It returns an InstrumentVerification
object that represents the session for instrument verification.
InstrumentVerificationRequest
Parameter | Data type | Description | Example |
---|---|---|---|
instrumentType | InstrumentType | Required parameter representing the instrument type | SEPA_BANK_ACCOUNT |
returnUrl | string | Required parameter. It is URL to which users must be redirected after competing the required activities in Paysafe hosted UI | "https://some-process.paysafe.com/" |
InstrumentType
Enum representing different types of financial instruments.
TypeScript possible values | JavaScript possible values | Description |
---|---|---|
InstrumentType.SEPA_BANK_ACCOUNT |
'SEPA_BANK_ACCOUNT' |
SEPA bank account. |
InstrumentType.UK_BANK_ACCOUNT |
'UK_BANK_ACCOUNT' |
UK bank account. |
InstrumentType.US_BANK_ACCOUNT |
'US_BANK_ACCOUNT' |
US bank account. |
InstrumentType.CARD |
'CARD' |
Payment card. |
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import { InstrumentVerificationRequest } from '@paysafe/paysafe-wallet-saas-web/payment-instruments';
import { InstrumentType } from '@paysafe/paysafe-wallet-saas-web/common';
const requestBody: InstrumentVerificationRequest = {
instrumentType: InstrumentType.US_BANK_ACCOUNT,
returnUrl: '<valid url>'
};
Wallet.getInstance().getPaymentInstrumentService().startVerification(requestBody)
.then(response => console.log('Created instrument verification', response))
.catch(error => console.error('Error creating instrument verification', error));
Get Single Instrument Verification Session
Use getVerification
function to verify the status and retrieve an instrument verification session.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const sessionId = '1234567890';
Wallet.getInstance().getPaymentInstrumentService().getVerification(sessionId)
.then(response => console.log('Instrument verification', response))
.catch(error => console.error('Error fetching instrument verification', error));
Get Instrument Verification Sessions
Use getAllVerifications
function to retrieve a list of instrument verification sessions. undefined
can be passed instead of InstrumentVerificationParameters
.
InstrumentVerificationParameters
Parameter | Data type/Format | Description | Example |
---|---|---|---|
offset |
number | Optional parameter to specify the starting point for fetching results, indicating the number of items to skip | 10 |
limit |
number | Optional parameter to limit the number of results | 10 |
sessionStatus |
InstrumentVerificationStatus | Used to filter verifications by status | ACTIVE |
InstrumentVerificationStatus
Enum representing the current status of the session.
TypeScript possible values | JavaScript possible values | Description |
---|---|---|
InstrumentVerificationStatus.ACTIVE |
'ACTIVE' |
The initial session status |
InstrumentVerificationStatus.ONGOING_VERIFICATION |
'ONGOING_VERIFICATION' |
Payment instrument is obtained and ongoing verification is in progress. |
InstrumentVerificationStatus.AWAITING_USER_INPUT |
'AWAITING_USER_INPUT' |
Waiting user input in order to continue the verification process. |
InstrumentVerificationStatus.COMPLETED |
'COMPLETED' |
Verification process is completed, the instrument should be in either VERIFIED or REJECTED status. |
InstrumentVerificationStatus.FAILED |
'FAILED' |
Instrument verification failed. |
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
import {
InstrumentVerificationParameters,
InstrumentVerificationStatus
} from '@paysafe/paysafe-wallet-saas-web/payment-instruments';
const verificationQueryParameters: InstrumentVerificationParameters = {
limit: 10,
offset: 0,
sessionStatus: InstrumentVerificationStatus.ACTIVE
};
Wallet.getInstance().getPaymentInstrumentService().getAllVerifications(queryParameters)
.then(response => console.log('Active instrument verifications list', response))
.catch(error => console.error('Error fetching instrument verifications list', 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=10
const verificationQueryParameters: InstrumentVerificationParameters = { limit: 10, offset: 10, sessionStatus: InstrumentVerificationStatus.ACTIVE };
- Page 2: limit=10, offset=20
const verificationQueryParameters: InstrumentVerificationParameters = { limit: 10, offset: 20, sessionStatus: InstrumentVerificationStatus.ACTIVE };
- Page 3: limit=10, offset=30
const verificationQueryParameters: InstrumentVerificationParameters = { limit: 10, offset: 30, sessionStatus: InstrumentVerificationStatus.ACTIVE };
- ...