Skip to main content

PurseHeadlessCheckoutTemporarySecondaryToken

Represents a secondary token in the Purse checkout system. Secondary tokens are saved alternative payment methods like gift cards that can be combined with primary payment methods.

Example

// Use part of the gift card balance
await secondaryToken.take(50);

// Remove it from the split if needed
await secondaryToken.removeFromSplit();

Extends

Properties

balance

balance: number;

The amount available for use on the card.

Inherited from

PurseHeadlessCheckoutSecondaryToken.balance


canBeRegistered

canBeRegistered: boolean;

This property exposes the saveToken configuration of the method. A mean of payment cannot be saved if the method is not registerable.

Inherited from

PurseHeadlessCheckoutRegisterable.canBeRegistered


cvv?

optional cvv: string;

the card cvv

Inherited from

PurseHeadlessCheckoutSecondaryToken.cvv


disabled

disabled: Readable<boolean>;

True mean that the token can't be involved in the checkout. Mainly set to true upon creation failure

Inherited from

PurseHeadlessCheckoutSecondaryToken.disabled


expiration_date

expiration_date: string;

Inherited from

PurseHeadlessCheckoutSecondaryToken.expiration_date


id

id: string;

Unique identifier of the payment method

Examples

'hipay-bancontact'
'illicado-giftcard'
'aci-creditcard'

Inherited from

PurseHeadlessCheckoutSecondaryToken.id


isSecondary

isSecondary: true;

Indicates if the payment method is a secondary mean of payment

Inherited from

PurseHeadlessCheckoutSecondaryToken.isSecondary


limit?

optional limit: number;

Inherited from

PurseHeadlessCheckoutSecondaryToken.limit


method

method: string;

Type of payment method, it can be a card, a wallet, a bank transfer, etc.

Examples

'applepay'
'googlepay'
'creditcard'

Inherited from

PurseHeadlessCheckoutSecondaryToken.method


name

name: string;

Inherited from

PurseHeadlessCheckoutSecondaryToken.name


pan

pan: string;

the card pan

Inherited from

PurseHeadlessCheckoutSecondaryToken.pan


partner

partner: string;

Partner associated with the payment method

Examples

'hipay'
'payconiq'
'paypal'

Inherited from

PurseHeadlessCheckoutSecondaryToken.partner


registration

registration: Readable<RegistrationState>;

This property exposes if the mean of payment is bound for registration upon validate.

Inherited from

PurseHeadlessCheckoutRegisterable.registration


type

type: "token";

Inherited from

PurseHeadlessCheckoutSecondaryToken.type

Methods

delete()

delete(): Promise<void>;

Delete the token from the user's wallet

Returns

Promise<void>

Example

token.delete();

Inherited from

PurseHeadlessCheckoutSecondaryToken.delete


edit()

edit(payload): Promise<void>;

Edit the token's name

Parameters

ParameterTypeDescription
payload{ name: string; }
payload.namestring-

Returns

Promise<void>

Throws

HeadlessCheckoutTokenNotRegisterable if the token is not registerable

Throws

HeadlessCheckoutTokenNotRegistered if the token is not registered

Throws

HeadlessCheckoutTokenNameExists if the token name already exists

Example

token.edit({ name: 'New Name' });

Inherited from

PurseHeadlessCheckoutSecondaryToken.edit


register()

register(value?, params?): Promise<void>;

Mark this mean of payment for registration upon validate.

Parameters

ParameterTypeDescription
value?boolean{boolean} true to register, false to unregister
params?{ name?: string; }
params.name?string-

Returns

Promise<void>

Example

item.register(true);

Inherited from

PurseHeadlessCheckoutRegisterable.register


removeFromSplit()

removeFromSplit(): Promise<void>;

Removes this token from the current payment split configuration. Any amount previously allocated from this token will be removed from the split.

Returns

Promise<void>

Throws

If the token cannot be removed from the split

Example

// Remove a gift card from the payment split
await token.removeFromSplit();

Inherited from

PurseHeadlessCheckoutSecondaryToken.removeFromSplit


take()

take(amount): Promise<void>;

Applies a specified amount from this secondary token to the current payment session. The amount will be deducted from the token's balance and added to the payment split.

Parameters

ParameterTypeDescription
amountnumberAmount to use from this token's balance

Returns

Promise<void>

Throws

If any of these conditions are not met:

  • Amount must be greater than 0
  • Amount must be less than the remaining session amount
  • Amount must be less than the token's available balance

Example

// Use 50 from a gift card balance
await token.take(50);

Inherited from

PurseHeadlessCheckoutSecondaryToken.take