setFocusStyle()

Sets the styling for the hosted field to the supplied styling attributes when focus on the hosted field in the iFrame is gained.

This function supports the Multiple Hosted Session functionality.

Usage

PaymentSession.setFocusStyle([<HostedFieldsRole>], styles, [scope])

Example

PaymentSession.setFocusStyle(["card.number","card.securityCode"], {
  borderColor: 'red',
  borderWidth: '3px'
});

Arguments

<HostedFieldsRole> Array COMPULSORY

An array of field roles for the hosted card fields, to be styled when the focus is gained. Valid array of field roles: ['card.number', 'card.expiryMonth', 'card.expiryYear', 'card.securityCode', 'giftCard.number', 'giftCard.pin', 'ach.bankAccountNumber', 'ach.bankAccountNumberConfirmation', 'ach.bankAccountHolder', 'ach.routingNumber', 'directDebitCanada.bankAccountHolder', 'directDebitCanada.bankAccountNumber', 'directDebitCanada.bankAccountNumberConfirmation', 'directDebitCanada.financialInstitutionNumber', 'directDebitCanada.transitNumber']

styles Object COMPULSORY

An object containing JavaScript CSS properties.

scope String OPTIONAL

The optional named instance of a card payment data set within a session. See Multiple Hosted Sessions for more information.

Return Value

None

Derechos de autor © 2023 Mastercard