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);
    } 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 when the event is triggered.

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