onCardBINChange Callback

The onCardBINChange( ) method invokes the callback function when the card BIN is detected. This callback is only invoked when card number passes all required validations: card type, card number length and Luhn check.

Usage

PaymentSession.onCardBINChange(function(selector, result), [scope])

Example

PaymentSession.onCardBINChange(function(selector, result) {
    // use card BIN value
    console.log(result.BIN);
});

Example for card BIN result object

{
    "BIN": "123456"
}

Arguments

<callbackFunction> Function COMPULSORY

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

  1. selector String COMPULSORY

    Identifier of the HTML element.

  2. result Object COMPULSORY

    Result object returned from the callback which sent as an argument to the function.

    1. result.BIN Number COMPULSORY

      First 6 digits of the BIN number returned as part of result object.

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

Copyright © 2023 Mastercard