const
cards:object
=cardsNamespace.cards
The cards namespace contains all the functions related to card operations. It can be accessed like this:
Then, the cards object contains the functions to perform card operations:
displayCard: (
cardConfig
) =>Promise
<DisplayCardReturnObject
>
Displays the UI in the calling page which allows the user to see card details.
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.
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.
InvalidParametersError
If the cardId is not provided or if the cardId is not a string.
InvalidParametersError
If the uiParentElementId or operationSettings are not provided.
getCard: (
Object
) =>Promise
<Card
>
Fetches a card by its id.
An object with the cardId and the optional accessToken and stagingToken properties.
string
string
string
Promise
<Card
>
A promise that resolves to a card.
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.
getCards: (
getCardsParams
) =>Promise
<Card
[]>
Fetches the list of cards for the current user.
An object with the optional membershipId
, accessToken
,
and stagingToken
properties. If the membershipId
parameter is passed, the
function will return the cards that belong to the specified membership only.
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).
string
string
string
Promise
<Card
[]>
A promise that resolves to an array of cards.
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.
orderCard: (
cardConfig
) =>Promise
<Card
>
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.
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.
Promise
<Card
>
A promise that resolves to an object representing the ordered card.
InvalidParametersError
If the cardId is not provided or if the cardId is not a string.
InvalidParametersError
If the uiParentElementId or operationSettings are not provided.
unlockCard: (
cardConfig
) =>Promise
<Card
>
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.
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.
Promise
<Card
>
A promise that resolves to an object representing the unlocked card.
InvalidParametersError
If the cardId is not provided or if the cardId is not a string.
InvalidParametersError
If the uiParentElementId or operationSettings are not provided.