IntegrateIntegration modesHeadless CheckoutSDK ReferenceInterfacesPurseHeadlessCheckoutLoyaltyTokenOn this pagePurseHeadlessCheckoutLoyaltyTokenRepresents 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 balanceawait secondaryToken.take(50);// Remove it from the split if neededawait secondaryToken.removeFromSplit(); Extends PurseHeadlessCheckoutTemporarySecondaryToken Properties 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 PurseHeadlessCheckoutTemporarySecondaryToken.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 PurseHeadlessCheckoutTemporarySecondaryToken.canBeRegistered cvv? optional cvv: string; the card cvv Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.cvv disabled disabled: Readable<DisabledState | null>; Indicates if the payment token is disabled with an error code and message Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.disabled expiration_date expiration_date: string | Date; Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.expiration_date id id: string; Unique identifier of the payment method Examples 'hipay-bancontact' 'illicado-giftcard' 'aci-creditcard' Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.id isSecondary isSecondary: true; Indicates if the payment method is a secondary mean of payment Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.isSecondary limit limit: number; Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.limit maxAmount maxAmount: number | null; Maximum amount to use the payment method Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.maxAmount method method: "loyaltycard"; Type of payment method, it can be a card, a wallet, a bank transfer, etc. Examples 'applepay' 'googlepay' 'creditcard' Overrides PurseHeadlessCheckoutTemporarySecondaryToken.method minAmount minAmount: number | null; Minimum amount to use the payment method Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.minAmount name name: string; Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.name pan pan: string; the card pan Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.pan partner partner: string; Partner associated with the payment method Examples 'hipay' 'paypal' Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.partner registration registration: Readable<RegistrationState>; This property exposes if the mean of payment is bound for registration upon validate. Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.registration takePolicy takePolicy: SecondaryTakePolicy; Depending on the secondary method, the takable amount is constrained. Vouchers for instance can't be partially used. methodtake policyeasy2play - vouchermaxeasy2play - giftcardnoneillicado - giftcardnoneogloba - giftcardnonebuybox - giftcardnonemaxxing - loyaltycardmax 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 PurseHeadlessCheckoutTemporarySecondaryToken.takePolicy totalBalance totalBalance: Readable<number>; The total amount on the loyalty account. 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. The amount may differ from the balance. The balance represents the usable amount by the customer. type type: "temporary_token"; Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.type Methods delete() delete(): Promise<void>; Delete the token from the user's wallet Returns Promise<void> Throws PurseHeadlessCheckoutError METHOD_NOT_IMPLEMENTED If the token is of type PurseHeadlessCheckoutTemporarySecondaryToken PurseHeadlessCheckoutError MISSING_SESSION If the session is missing PurseHeadlessCheckoutError MISSING_TOKEN If the provided token cannot be found PurseHeadlessCheckoutError MISSING_WALLET_SESSION If the wallet session is missing PurseHeadlessCheckoutError UNKNOWN_ERROR If an unknown error is caught during the deletion Example token.delete(); Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.delete edit() edit(payload): Promise<void>; Edit the token's name Parameters ParameterTypeDescriptionpayload{ name: string; }-payload.namestring- Returns Promise<void> Throws PurseHeadlessCheckoutError TOKEN_NOT_REGISTERABLE If the token is not registerable PurseHeadlessCheckoutError TOKEN_NOT_REGISTERED If the token is not registered (see PurseHeadlessCheckoutRegisterable.register) PurseHeadlessCheckoutError TOKEN_NAME_EXISTS If the token name already exists PurseHeadlessCheckoutError MISSING_TOKEN If the provided token cannot be found PurseHeadlessCheckoutError INVALID_TOKEN_NAME If the provided token name is invalid PurseHeadlessCheckoutError MISSING_WALLET_SESSION If the wallet session is missing Example token.edit({ name: 'New Name' }); Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.edit register() register(value?, params?): Promise<void>; Mark this mean of payment for registration upon validate. Parameters ParameterTypeDescriptionvalue?boolean{boolean} true to register, false to unregisterparams?{ name?: string; }-params.name?string- Returns Promise<void> Example item.register(true); Throws PurseHeadlessCheckoutError INVALID_TOKEN_NAME If the provided token name is invalid PurseHeadlessCheckoutError TOKEN_NOT_REGISTERABLE If the token is not registerable Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.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 // Remove a gift card from the payment splitawait token.removeFromSplit(); Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.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 ParameterTypeDescriptionamountnumberAmount 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 // Use 50 from a gift card balanceawait token.take(50); Inherited from PurseHeadlessCheckoutTemporarySecondaryToken.take