Variable: cards
The cards namespace contains all the functions related to card operations. It can be accessed like this:const
cards:object
=cardsNamespace.cards
Type declaration
displayCard()
displayCard: (Displays the UI in the calling page which allows the user to see card details.cardConfig
) =>Promise
<DisplayCardReturnObject
>
Parameters
cardConfig
CardParams
<DisplayCardSettings
>
An object with the parameters to display the card.
It requires a cardSettings
object with the cardId
property. If it was not provided when
calling the SDK’s initialize
function, an operationSettings
object has to be passed too
with the uiParentElementId
property. This has to specify the ID of the DOM element where
the UI for MFA will be displayed.
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 the cardId is not provided or if the cardId is not a string.
Throws
InvalidParametersError
If the uiParentElementId or operationSettings are not provided.
getCard()
getCard: (Fetches a card by its id.getCardParams
) =>Promise
<Card
>
Parameters
getCardParams
CardParams
<{ cardId
: string
; }>
An object containing:
cardSettings
: An object with thecardId
property (string).operationSettings
: An object with operation-level settings such asproxyRequestFunction
(preferred over using the access token flow),accessToken
,stagingToken
, and other optional parameters. See OperationSettings for more details.
Returns
Promise
<Card
>
A promise that resolves to a card.
Throws
InvalidParametersError
If the cardId is not provided or if the cardId is not a string.
Throws
AuthenticationError
If both the proxyRequestFunction
and accessToken
are invalid or missing within
operationSettings
.
Throws
EmbedApiError
If the API request fails or returns an error.
getCards()
getCards: (Fetches the list of cards for the current user.getCardsParams?
) =>Promise
<Card
[]>
Parameters
getCardsParams?
CardParams
<{ membershipId
: string
; }>
An object with optional parameters:
cardSettings
: An object that can contain the optionalmembershipId
property.operationSettings
: An object with operation-level settings such asproxyRequestFunction
(preferred over using the access token flow),accessToken
,stagingToken
, and other optional parameters. See OperationSettings for more details. If themembershipId
parameter is passed, the function will return the cards that belong to the specified membership only. If theaccessToken
is not provided, the function will use the token previously passed to the initialize function. ThestagingToken
is optional, but it has to be passed to use the SDK in staging environments (it will be ignored in production).
Returns
Promise
<Card
[]>
A promise that resolves to an array of cards.
Throws
AuthenticationError
If both the proxyRequestFunction
and accessToken
are invalid or missing within
operationSettings
.
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. 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
CardParams
<CardOrderSettings
>
An object with the parameters to order the card. If it was not provided when
calling the SDK’s initialize
function, an operationSettings
object has to be passed too
with the uiParentElementId
property. This has to specify the ID of the DOM element where
the UI for MFA will be displayed.
Returns
Promise
<Card
>
A promise that resolves to an object representing the ordered card.
Throws
InvalidParametersError
If the cardId is not provided or if the cardId is not a string.
Throws
InvalidParametersError
If the uiParentElementId or operationSettings are not provided.
Examples
unlockCard()
unlockCard: (Unlocks a locked card by showing the user the UI to perform MFA in the calling page. 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
CardParams
<UnlockCardSettings
>
An object with the parameters to unlock the card.
It requires a cardSettings
object with the cardId
property. If it was not provided when
calling the SDK’s initialize
function, an operationSettings
object has to be passed too
with the uiParentElementId
property. This has to specify the ID of the DOM element where
the UI for MFA will be displayed.
Returns
Promise
<Card
>
A promise that resolves to an object representing the unlocked card.
Throws
InvalidParametersError
If the cardId is not provided or if the cardId is not a string.
Throws
InvalidParametersError
If the uiParentElementId or operationSettings are not provided.