The onCardTypeChange( ) method invokes the callback function when the card type is first detected or changed.
PaymentSession.onCardTypeChange(function(selector, result), [scope])
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.merchantCharge.type); console.log(result.order.merchantCharge.amount); console.log(result.capabilities); console.log(result.interactionConstraints); console.log(result.paymentPlans); console.log(result.localBrand); console.log(result.currencyConversion.offerText); console.log(result.currencyConversion.payerAmount); console.log(result.currencyConversion.payerCurrency); console.log(result.currencyConversion.requestId); } 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.'); } });
The callback function invoked with selector and the result when an event is triggered.
Identifier of the HTML element which is card-number.
Result object which sent as an argument to the function.
The brand name used to describe the card that is recognized and accepted globally.
The method used by the payer to provide the funds for the payment.
The issuer of the card, if known.
The organization that owns a card brand and defines operating regulations for its use.
The total amount for the order.
The amount payable for the order before surcharging is applied.
Information about additional fees that you are charging the payer for processing the payment for this order, for example, a surcharge, convenience or service fee.
The type of the additional fee that you are charging the payer.
The amount of the additional fee that you are charging the payer.
Indicates capabilities available to you for card payments.
Indicates if the cardholder is required to provide additional information when using a card to pay for the order.
Information on valid payment plans for this order based on the values supplied in the request parameters.
The brand name used to describe a card that is recognized and accepted within its country/region of origin.
This is a piece of HTML markup that can be included as part of your website to offer the payer the currency conversion quote.
It contains information necessary to comply with scheme requirements.
The total amount of the transaction in the payer's currency.
You must include this field if the payer accepted the DCC offer you presented to them.
The currency of the DCC rate quote provided by your DCC Service Provider.
The currency must be expressed as an ISO 4217 alpha code, e.g. USD and must be different to that provided for transaction currency. You must include this field if the payer accepted the DCC offer you presented to them.
fThe unique identifier for your DCC quote request as returned in the PAYMENT_OPTIONS_INQUIRY response.
The optional named instance of a card payment data set within a session. See Multiple Hosted Sessions for more information.
None