@qonto/embed-sdk / 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:
import { beneficiaries } from '@qonto/embed-sdk/beneficiaries';
Then, the beneficiaries object contains the functions to perform beneficiary operations:
await beneficiaries.getBeneficiaries();
await beneficiaries.getBeneficiary(/* params here */);

Type declaration

addBeneficiary()

addBeneficiary: (addBeneficiaryParams) => Promise<Beneficiary>
Adds a new beneficiary in the current user’s account.

Parameters

addBeneficiaryParams
BeneficiaryParams<NewBeneficiary> An object containing:
  • beneficiarySettings: An object with the new beneficiary details. Requires at least the name and iban properties to be present.
  • operationSettings: An object with operation-level settings such as proxyRequestFunction (preferred over using the access token flow), accessToken, stagingToken, idempotencyKey, and other optional parameters. See BeneficiaryParams.

Returns

Promise<Beneficiary> A promise that resolves to the created beneficiary.

Throws

If any required property is missing or invalid.

Throws

If both the proxyRequestFunction and accessToken are invalid or missing within operationSettings.

Throws

If the API request fails or returns an error.

getBeneficiaries()

getBeneficiaries: (getBeneficiariesParams?) => Promise<GetBeneficiariesResponse>
Fetches the list of beneficiaries for the current user.

Parameters

getBeneficiariesParams?
BeneficiaryParams<never> An object containing:
  • operationSettings: An object with operation-level settings such as proxyRequestFunction (preferred over using the access token flow), accessToken, stagingToken, mfaPreference, and other optional parameters. This function also allows managing pagination by passing the paginationSettings property under operationSettings, which accepts an object with the page and itemsPerPage properties. See BeneficiaryParams.

Returns

Promise<GetBeneficiariesResponse> A promise that resolves to an array of beneficiaries and a meta object containing pagination state.

Throws

If any of the values provided under operationSettings is invalid.

Throws

If both the proxyRequestFunction and accessToken are invalid or missing within operationSettings.

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
BeneficiaryParams<{ beneficiaryId: string; }> An object containing:
  • beneficiarySettings: An object with the beneficiaryId property (string).
  • operationSettings: An object with operation-level settings such as proxyRequestFunction (preferred over using the access token flow), accessToken, stagingToken, mfaPreference, and other optional parameters. See BeneficiaryParams.

Returns

Promise<Beneficiary> A promise that resolves to a beneficiary.

Throws

If the beneficiaryId parameter is not a string or is missing.

Throws

If both the proxyRequestFunction and accessToken are invalid or missing within operationSettings.

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
BeneficiaryParams<{ beneficiaryIds: string[]; }> An object containing:
  • beneficiarySettings: An object with the list of beneficiary IDs to untrust (e.g., { beneficiaryIds: string[] }).
  • operationSettings: An object with operation-level settings such as proxyRequestFunction (preferred over using the access token flow), accessToken, stagingToken, and other optional parameters. See BeneficiaryParams.

Returns

Promise<Beneficiary[]> A promise that resolves to an array of untrusted beneficiaries.

Throws

If the beneficiaryIds parameter is not an array of strings or is missing.

Throws

If both the proxyRequestFunction and accessToken are invalid or missing within operationSettings.

Throws

If the API request fails or returns an error.

updateBeneficiary()

updateBeneficiary: (updateBeneficiaryParams) => Promise<Beneficiary>
Update any of the editable properites of a beneficiary in the current user’s account by ID.

Parameters

updateBeneficiaryParams
BeneficiaryParams<EditableBeneficiaryProperties> An object containing:
  • beneficiarySettings: An object that contains a mandatory beneficiary ID and any of the editable properties of a beneficiary, which are name, email and activityTag.
  • operationSettings: An object with operation-level settings such as proxyRequestFunction (preferred over using the access token flow), accessToken, stagingToken, mfaPreference, idempotencyKey, and other optional parameters. See BeneficiaryParams.

Returns

Promise<Beneficiary> A promise that resolves to the updated beneficiary.

Throws

If the beneficiary ID is missing or if none of the editable properties (name, email, activityTag) are provided or are of incorrect type.

Throws

If both the proxyRequestFunction and accessToken are invalid or missing within operationSettings.

Throws

If the API request fails or returns an error.