Skip to main content

PurseHeadlessCheckoutPrimaryMethod

Represents a primary payment method in the Purse checkout system. Primary methods are the main payment options like credit cards, digital wallets, or bank transfers.

Example

// Get payment element for a primary method
const primaryMethod: PurseHeadlessCheckoutPrimaryMethod = ...
const element = await primaryMethod.getPaymentElement({
hostedForm: {
panPlaceholder: 'Enter your card number',
cvvPlaceholder: 'Enter your CVV'
// Add more options here
}
});

// Mount the payment element to your UI
element.appendTo('#payment-container');

Extends

Properties

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


disabled

disabled: Writable<boolean>;

Indicates if the payment method is disabled (Writable to allow dynamic updates)

Inherited from

PurseHeadlessCheckoutMethod.disabled


id

id: string;

Unique identifier of the payment method

Examples

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

Inherited from

PurseHeadlessCheckoutMethod.id


isSecondary

isSecondary: false;

Indicates if the payment method is a secondary mean of payment

Overrides

PurseHeadlessCheckoutMethod.isSecondary


limit

limit: null | number;

Amount limit for the payment method (null if no limit)

Inherited from

PurseHeadlessCheckoutMethod.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

PurseHeadlessCheckoutMethod.method


partner

partner: string;

Partner associated with the payment method

Examples

'hipay'
'payconiq'
'paypal'

Inherited from

PurseHeadlessCheckoutMethod.partner


position

position: number;

Position of the payment method in the list

Inherited from

PurseHeadlessCheckoutMethod.position


registration

registration: Readable<RegistrationState>;

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

Inherited from

PurseHeadlessCheckoutRegisterable.registration


type

type: "method";

Inherited from

PurseHeadlessCheckoutMethod.type

Methods

getPaymentElement()

getPaymentElement(options?): PurseHeadlessCheckoutPaymentElement;

Creates and returns a payment element UI instance for this payment method. The instance is created only on the first call and cached for subsequent calls.

Parameters

ParameterTypeDescription
options?OptionsOptional UI customization settings for the payment element

Returns

PurseHeadlessCheckoutPaymentElement

A payment element instance for this payment method

Throws

If the payment element creation fails

Example

const paymentElement = primaryMethod.getPaymentElement({
hostedForm: {
panPlaceholder: 'Enter your card number',
cvvPlaceholder: 'Enter your CVV'
// Add more options here
}
})
await paymentElement.appendTo('#payment-container');

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


setAsPrimarySource()

setAsPrimarySource(): void;

Changes the active primary payment source in the current payment split. Use this when you have multiple primary payment elements mounted (e.g., Wallet AND installments).

Returns

void

Throws

If the method cannot be set as primary source

Example

// Switch to this payment method as the primary source
await method.setAsPrimarySource();