PurseHeadlessCheckoutSecondaryToken
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
await secondaryToken.take(50);
await secondaryToken.removeFromSplit();
Extends
Extended by
Properties
balance
The amount available for use on the card.
cvv?
the card 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
PurseHeadlessCheckoutToken
.disabled
expiration_date
Unique identifier of the payment method
Examples
Inherited from
PurseHeadlessCheckoutToken
.id
isSecondary
Indicates if the payment method is a secondary mean of payment
Overrides
PurseHeadlessCheckoutToken
.isSecondary
limit?
method
Type of payment method, it can be a card, a wallet, a bank transfer, etc.
Examples
Inherited from
PurseHeadlessCheckoutToken
.method
name
Inherited from
PurseHeadlessCheckoutToken
.name
pan
the card pan
partner
Partner associated with the payment method
Examples
Inherited from
PurseHeadlessCheckoutToken
.partner
type
Inherited from
PurseHeadlessCheckoutToken
.type
Methods
delete()
Delete the token from the user's wallet
Returns
Promise
<void
>
Example
Inherited from
PurseHeadlessCheckoutToken
.delete
edit()
edit(payload): Promise<void>;
Edit the token's name
Parameters
Parameter | Type | Description |
---|
payload | { name : string ; } | |
payload.name | string | - |
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
PurseHeadlessCheckoutToken
.edit
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
await token.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
Parameter | Type | Description |
---|
amount | number | Amount 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