Session onCardTypeChange

onCardTypeChange Callback

The onCardTypeChange( ) method invokes the callback function when the card type is first detected or changed.


Usage Copied to clipboard

PaymentSession.onCardTypeChange(function(selector, result), [scope]);


Example Copied to clipboard

PaymentSession.onCardTypeChange(function(selector, result) {
    //handle change event
    if (result.status === 'SUPPORTED') {
        // use card details like brand, fundingMethod, issuer and scheme
        console.log(result.brand);
        console.log(result.fundingMethod);
        console.log(result.issuer);
        console.log(result.scheme);
        console.log(result.order.amount);
        console.log(result.order.netAmount);
        console.log(result.order.surchargeAmount);
        console.log(result.capabilities);
        console.log(result.interactionConstraints);
        console.log(result.paymentPlans);
        console.log(result.localBrand);
    } else if (result.status === 'INSUFFICIENT_LENGTH') {
        // selector for invalid field is provided
        console.log('Minimum of 10 digits required to determine card type.');
    } else if (result.status === 'NOT_SUPPORTED') {
        console.log('The card type you entered is not supported.');
    }
});

Arguments Copied to clipboard

callbackFunction Copied to clipboard Function

The callback function invoked with selector and the result when an event is triggered.

selector Copied to clipboard String

Identifier of the HTML element which is card-number.

result Copied to clipboard Object

Result object which sent as an argument to the function.

brand Copied to clipboard String

The brand name used to describe the card that is recognized and accepted globally.

fundingMethod Copied to clipboard String

The method used by the payer to provide the funds for the payment.

issuer Copied to clipboard String

The issuer of the card, if known.

scheme Copied to clipboard String

The organization that owns a card brand and defines operating regulations for its use.

order Copied to clipboard Object
amount Copied to clipboard Decimal

The total amount for the order.

netAmount Copied to clipboard Decimal

The amount payable for the order before surcharging is applied.

surchargeAmount Copied to clipboard Decimal

A fee charged by you to cover the cost of accepting a payment method.

capabilities Copied to clipboard String ALWAYS PROVIDED

Value must be a member of the following list. The values are case-sensitive.

ADDRESS_VERIFICATIONIndicates if you are allowed to use the Address Verification Service (AVS) to verify address details supplied by the cardholder.
CARD_SECURITY_CODEIndicates if you are allowed to use the Card Security Check to verify the Card Security Code (CSC) supplied by the cardholder.
NO_CARD_SECURITY_CODE_PRINTED_ON_CARDIndicates if you are allowed to accept payments from credit cards without a Card Security Code (CSC) printed on the card.
interactionConstraints Copied to clipboard String

Indicates if the cardholder is required to provide additional information when using a card to pay for the order.

Value must be one or more comma separated members of the following list. The values are case-sensitive.

CREDIT_DEBIT_SELECTIONIndicates if the cardholder must be forced to select between using a credit card or a debit card, before entering their card details.
CARD_TYPE_SELECTIONIndicates if the cardholder must be forced to select the card type.This is required when the card is identified as a co-branded card and regulation stipulates that the payer must select the card type.The card type selected by the payer must subsequently be provided in field sourceOfFunds.provided.card.cardType on financial transaction requests.
CARD_SECURITY_CODE_ENTRYIndicates if the cardholder must be forced to enter the Card Security Code (CSC) when using a credit card to pay for the order.
paymentPlans Copied to clipboard String

Information on valid payment plans for this order based on the values supplied in the request parameters.

localBrand Copied to clipboard String

The brand name used to describe a card that is recognized and accepted within its country/region of origin.

scope Copied to clipboard String

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


Return Value Copied to clipboard

None