Variable: cards
The cards namespace contains all the client-side functions related to card operations. It is designed for browser environments.constcards:object
getCardsandgetCarduse proxy-based authentication and requireproxyEndpointDescriptor.displayCardsupports bothproxyEndpointDescriptor(recommended) andaccessToken.orderCardandunlockCarduse access token-based authentication via an iframe.
'@qonto/embed-sdk/server/cards'.
It can be accessed like this:
Type declaration
displayCard()
displayCard: (Displays a Cards UI in the calling page which allows the user to see card details and perform some operations (client-side only). This function is only available in client-side environments as it requires UI rendering. It supports both proxy-based and access token-based authentication.cardConfig) =>Promise<DisplayCardReturnObject>
Parameters
cardConfig
CardClientParamsWithUI<DisplayCardSettings>
An object containing:
cardSettings: An object with thecardIdproperty (string).operationSettings: Required settings to configure this operation. Must includeuiParentElementIdto specify where the UI will be rendered. Also supportsproxyEndpointDescriptor(recommended for production to avoid exposing tokens),accessToken,stagingToken, and other properties.
Returns
Promise<DisplayCardReturnObject>
A promise that resolves to an object with a destroyEmbedUI function. When calling
this function, the UI will be removed from the DOM.
Throws
InvalidParametersError If uiParentElementId is missing or if the cardId
is not provided or not a string.
Throws
AuthenticationError If both proxyEndpointDescriptor and accessToken
are invalid or missing.
Throws
EmbedApiError If the API request fails or returns an error.
getCard()
getCard: (Fetches a card by its id (client-side version). This function uses proxy-based authentication and is designed for browser environments. It requiresgetCardParams) =>Promise<Card>
proxyEndpointDescriptor in operationSettings.
Parameters
getCardParams
An object containing:cardSettings: An object with thecardIdproperty (string).operationSettings: An object withproxyEndpointDescriptor(required),stagingToken, and other optional parameters.
cardSettings
{cardId: string; }
cardSettings.cardId
string
operationSettings?
ClientOperationSettings
Returns
Promise<Card>
A promise that resolves to a card.
Throws
InvalidParametersError If the cardId is not provided, not a string, or
if proxyEndpointDescriptor is not provided.
Throws
EmbedApiError If the API request fails or returns an error.
getCards()
getCards: (Fetches the list of cards for the current user (client-side version). This function uses proxy-based authentication and is designed for browser environments. It requiresgetCardsParams?) =>Promise<Card[]>
proxyEndpointDescriptor in operationSettings.
Parameters
getCardsParams?
CardClientParams<{ membershipId: string; }>
An object with optional parameters:
cardSettings: An object that can contain the optionalmembershipIdproperty.operationSettings: An object withproxyEndpointDescriptor(required),stagingToken, and other optional parameters.
Returns
Promise<Card[]>
A promise that resolves to an array of cards.
Throws
InvalidParametersError If proxyEndpointDescriptor is not provided,
or if membershipId is invalid.
Throws
EmbedApiError If the API request fails or returns an error.
orderCard()
orderCard: (Requests the creation of a card by showing the user the UI to perform MFA in the calling page (client-side only). This function is only available in client-side environments as it requires UI rendering. It will show an element on the screen where users will be able to go through the MFA authentication process and upon successful authentication, will perform the ordering operation.cardConfig) =>Promise<Card>
Parameters
cardConfig
CardClientParamsWithUI<CardOrderSettings>
An object containing:
cardSettings: An object with the card order parameters (see examples below).operationSettings: Required settings to configure this operation. Must includeuiParentElementIdto specify where the UI will be rendered. Also supportsaccessToken,stagingToken,mfaPreference,debugMode, and other properties.
Returns
Promise<Card>
A promise that resolves to an object representing the ordered card.
Throws
InvalidParametersError If uiParentElementId is missing or if the card
settings are invalid.
Throws
AuthenticationError If the accessToken is invalid or missing.
Throws
EmbedApiError If the API request fails or returns an error.
Examples
unlockCard()
unlockCard: (Unlocks a locked card by showing the user the UI to perform MFA in the calling page (client-side only). This function is only available in client-side environments as it requires UI rendering. It will show an element on the screen where users will be able to go through the MFA authentication process and upon successful authentication, will perform the unlock operation.cardConfig) =>Promise<Card>
Parameters
cardConfig
CardClientParamsWithUI<UnlockCardSettings>
An object containing:
cardSettings: An object with thecardIdproperty (string).operationSettings: Required settings to configure this operation. Must includeuiParentElementIdto specify where the UI will be rendered. Also supportsaccessToken,stagingToken,mfaPreference,debugMode, and other properties.
Returns
Promise<Card>
A promise that resolves to an object representing the unlocked card.
Throws
InvalidParametersError If uiParentElementId is missing or if the cardId
is not provided or not a string.
Throws
AuthenticationError If the accessToken is invalid or missing.
Throws
EmbedApiError If the API request fails or returns an error.