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
await secondaryToken.take(50);
await secondaryToken.removeFromSplit();
Extends
Extended by
Properties
additionalAssets
additionalAssets: CardSchemeAsset[];
Additional assets associated with this payment item, primarily card scheme logos.
For credit card methods with vault support, this contains one entry per supported
card scheme (e.g. Visa, Mastercard, CB). For all other payment methods the array
is empty.
Each asset provides a CDN URL and a human-readable label suitable for display and
accessibility purposes.
Example
{method.additionalAssets.map(asset => (
<img key={asset.url} src={asset.url} alt={asset.label} />
))}
Inherited from
PurseHeadlessCheckoutSecondaryToken.additionalAssets
balance
balance: Readable<number>;
The amount available for use on the card.
This value will be at 0 until we've fetched its current value.
The fetching is done in parallel during the checkout creation to speed up the process.
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?
the card cvv
Inherited from
PurseHeadlessCheckoutSecondaryToken.cvv
disabled
disabled: Readable<DisabledState | null>;
Indicates if the payment token is disabled with an error code and message
Inherited from
PurseHeadlessCheckoutSecondaryToken.disabled
expiration_date
expiration_date: string | Date;
Inherited from
PurseHeadlessCheckoutSecondaryToken.expiration_date
iconUrl
Absolute URL of the payment method icon on the Purse CDN.
The URL is stable and environment-aware (sandbox vs production).
The icon is an SVG file that respects the brand guidelines of the
payment partner. It can be used directly in an <img> tag or as
a CSS background image without any further processing.
Example
<img src={method.iconUrl} alt={method.method} />
Inherited from
PurseHeadlessCheckoutSecondaryToken.iconUrl
Unique identifier of the payment method
Examples
Inherited from
PurseHeadlessCheckoutSecondaryToken.id
isSecondary
Indicates if the payment method is a secondary mean of payment
Inherited from
PurseHeadlessCheckoutSecondaryToken.isSecondary
limit
Inherited from
PurseHeadlessCheckoutSecondaryToken.limit
maxAmount
maxAmount: number | null;
Maximum amount to use the payment method
Inherited from
PurseHeadlessCheckoutSecondaryToken.maxAmount
method
Type of payment method, it can be a card, a wallet, a bank transfer, etc.
Examples
Inherited from
PurseHeadlessCheckoutSecondaryToken.method
minAmount
minAmount: number | null;
Minimum amount to use the payment method
Inherited from
PurseHeadlessCheckoutSecondaryToken.minAmount
name
User-friendly name for the token, provided by the user during registration or by the payment partner.
This name is used for display purposes in the UI to help users identify their saved payment methods.
Inherited from
PurseHeadlessCheckoutSecondaryToken.name
pan
the card pan
Inherited from
PurseHeadlessCheckoutSecondaryToken.pan
partner
Partner associated with the payment method
Examples
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
takePolicy
takePolicy: SecondaryTakePolicy;
Depending on the secondary method, the takable amount is constrained. Vouchers for instance can't be partially used.
| method | take policy |
|---|
| easy2play - voucher | max |
| easy2play - giftcard | none |
| illicado - giftcard | none |
| ogloba - giftcard | none |
| buybox - giftcard | none |
| maxxing - loyaltycard | max |
Max: "All or nothing" the only takable amount is the full balance.
None: The take amount is not constrained (should still be less than the token's available balance').
Inherited from
PurseHeadlessCheckoutSecondaryToken.takePolicy
totalBalance?
optional totalBalance?: Readable<number>;
This value is populated for secondaries that can be partially consumed/eligible for a session
This is the case for loyalty accounts like maxxing for instance.
Inherited from
PurseHeadlessCheckoutSecondaryToken.totalBalance
type
Overrides
PurseHeadlessCheckoutSecondaryToken.type
Methods
delete()
Delete the token from the user's wallet
Returns
Promise<void>
Throws
Example
Inherited from
PurseHeadlessCheckoutSecondaryToken.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
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
| Parameter | Type | Description |
|---|
value? | boolean | {boolean} true to register, false to unregister |
params? | { name?: string; } | - |
params.name? | string | - |
Returns
Promise<void>
Example
Throws
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
- PurseHeadlessCheckoutError
METHOD_NOT_IMPLEMENTED
If the real token could not be fetched and a placeholder object was returned instead
Example
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
| Parameter | Type | Description |
|---|
amount | number | Amount to use from this token's balance |
Returns
Promise<void>
Throws
- PurseHeadlessCheckoutError
INVALID_TAKE_AMOUNT
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
- PurseHeadlessCheckoutError
METHOD_NOT_IMPLEMENTED
If the real token could not be fetched and a placeholder object was returned instead
- PurseHeadlessCheckoutError
USAGE_LIMIT_ERROR
If the usage limit of the secondary method was reached
- PurseHeadlessCheckoutError
SECONDARY_METHOD_TAKE_POLICY_VIOLATED
If the take amount requested violates the policy of the secondary method.
Example
Inherited from
PurseHeadlessCheckoutSecondaryToken.take