Beneficiaries
Variable: beneficiaries
const
beneficiaries:object
=beneficiariesNamespace.beneficiaries
The beneficiaries namespace contains all the functions related to beneficiary operations. It can be accessed like this:
Then, the beneficiaries object contains the functions to perform beneficiary operations:
Type declaration
addBeneficiary()
addBeneficiary: (
addBeneficiaryParams
) =>Promise
<Beneficiary
>
Adds a new beneficiary in the current user’s account.
Parameters
addBeneficiaryParams
An object containing the new beneficiary’s details and optional
accessToken
and stagingToken
parameters . The beneficiary
parameter
object requires at least the name
and iban
properties to be present. The
rest of the properties of the beneficiary
object are optional. If the
accessToken
is not provided, the function will use the token previously
passed to the initialize function. The stagingToken
is optional but it has
to be passed to use the SDK in staging environments (it will be ignored in
production).
accessToken?
string
beneficiary
stagingToken?
string
Returns
Promise
<Beneficiary
>
Throws
If the access token is invalid or missing. Ensure initialize has been called before using this function if you are not passing the access token.
Throws
If the beneficiary
parameter is not an
object or if it does not contain the required properties.
getBeneficiaries()
getBeneficiaries: (
getBeneficiariesParams?
) =>Promise
<GetBeneficiariesResponse
>
Fetches the list of beneficiaries for the current user.
Parameters
getBeneficiariesParams?
An optional object with the accessToken property. If not passed, the function only works if initialize has been previously called. Also, this function allows managing pagination by passing the paginationSettings property, which accepts an object with the page and itemsPerPage properties.
accessToken?
string
paginationSettings?
stagingToken?
string
Returns
Promise
<GetBeneficiariesResponse
>
A promise that resolves to an array of beneficiaries and a meta
object containing pagination state.
Throws
If the access token is invalid or missing. Ensure initialize has been called before using this function if you are not passing the access token.
Throws
If the API request fails or returns an error.
getBeneficiary()
getBeneficiary: (
getBeneficiaryParams
) =>Promise
<Beneficiary
>
Fetches a single beneficiary of the current user by ID.
Parameters
getBeneficiaryParams
An object containing the beneficiaryId and
optional accessToken
and stagingToken
parameters. If the accessToken
is
not provided, the function will use the token previously passed to the
initialize function. The stagingToken
is optional but it has to be passed to
use the SDK in staging environments (it will be ignored in production).
accessToken?
string
beneficiaryId
string
stagingToken?
string
Returns
Promise
<Beneficiary
>
A promise that resolves to a beneficiary.
Throws
If the access token is invalid or missing. Ensure initialize has been called before using this function if you are not passing the access token.
Throws
If the beneficiaryId
parameter is not a
string or is missing.
Throws
If the API request fails or returns an error.
untrustBeneficiaries()
untrustBeneficiaries: (
untrustBeneficiariesParams
) =>Promise
<Beneficiary
[]>
Untrusts a list of beneficiaries in the current user’s account.
Parameters
untrustBeneficiariesParams
An object containing the list of beneficiary
IDs and optional accessToken
and stagingToken
parameters. If the accessToken
is not provided, the function will use the token previously passed to the initialize
function. The stagingToken
is optional but it has to be passed to use the
SDK in staging environments (it will be ignored in production).
accessToken?
string
beneficiaryIds
string
[]
stagingToken?
string
Returns
Promise
<Beneficiary
[]>
A promise that resolves to an array of untrusted beneficiaries.
Throws
If the access token is invalid or missing. Ensure initialize has been called before using this function if you are not passing the access token.
Throws
If the beneficiaryIds
parameter is not
an array of strings or is missing.
Throws
If the API request fails or returns an error.