Tokenizing a Combo Card
In Brazil, certain cards, known as "Combo Combo" cards, function as both credit and debit cards. To offer customers a choice in how they pay, merchants can use the preferred_card_type parameter to specify if the card should be tokenized and processed as debit or credit.
This is especially useful for merchants who want to give customers the option of paying with debit for immediate settlement or with credit for installment payments. Merchants can also set a default card type during tokenization without requiring a customer's selection.
Update on form events
One of the events supported by Web SDK is updated to return card IIN. This will be useful for the merchant to look-up the card IIN details with the dedicated method on PO. Refer to Handling form events for more details on the events.
The new field is card_iin and can be accessed with on() function, as shown below.
client.setupForm(formElement, {},
processoutReadyHander,
function(err) { ... }
);
function processoutReadyHander(form) {
form.getNumberField().on("click", function(e) {
console.log(e.card_iin);
});
}Updated event structure detail
| Field | Description | Type | Example value |
|---|---|---|---|
card_number_length | Current length of the card field | Integer | 16 |
max_card_number_length | Maximum length of the card according to its BIN | Integer | 19 |
min_card_number_length | Minimum length of the card according to its BIN | Integer | 12 |
potentially_valid | true if the current value can match a valid card number once completed | Boolean | true |
valid | true when the card passes the Luhn check | Boolean | true |
schemes | List of possible schemes according to the card BIN | List<String> | ["visa", "carte bancaire"] |
card_iin | First 6 digits of the entered card number. | String | 424242 |
Get Card Information with IIN value
New method called getCardInformation is implemented on the SDK. This method takes the IIN value exposed by the event and returns the IIN details of the card. It can be used as shown below.
client.setupForm(formElement, {},
processoutReadyHander,
function(err) { ... }
);
function processoutReadyHander(form) {
form.getNumberField().on("input", function(e) {
if (e.card_number_length == 6) {
client.getCardInformation(
e.card_iin,
function(cardInfo) {
...
},
function(err) {
...
}
)
}
});
}getCardInformation Response Object
getCardInformation Response Object| Field | Description | Type | Example value |
|---|---|---|---|
bank_name | Name of the bank issuing the card | String | Payments UK Limited |
brand | Card product offered by the card scheme | String | visa classic |
category | Intended use or market segment for the card | String | consumer |
co_scheme | Other networks the card operates on | String | carte bancaire |
combo_card_types | List of card types the Combo card supports | List<String> | ["credit", "debit"] |
schemes | List of possible schemes according to the card BIN | List<String> | ["visa", "carte bancaire"] |
country | Two-letter ISO country code of the card's issuing country | String | GB |
type | This field specifies whether the card is a "credit" card, a "debit" card, or "prepaid" | String | credit |
Use combo_card_types to display options for the customer
combo_card_types to display options for the customerThe card IIN details will include the field called combo_card_types which is a list of card types that the Combo card supports. If this field is empty, it means that the card is most probably not a combo card. If the field is present, it can be used to display options for the customer to select their preferred type. The selected option later can be passed to tokenize method to tokenize and process the Combo card. The example below shows and example.
client.setupForm(formElement, {},
processoutReadyHander,
function(err) { ... }
);
function processoutReadyHander(form) {
// Default value
let preferredCardType = "credit"
form.getNumberField().on("input", function(e) {
if (e.card_number_length == 6) {
client.getCardInformation(
e.card_iin,
function(cardInfo) {
...
if (cardInfo.combo_card_types && Array.isArray(cardInfo.combo_card_types) && cardInfo.combo_card_types.length > 0) {
...
const radioButtons = radioGroup.querySelectorAll('input[name="cardType"]')
radioButtons.forEach(radio => {
radio.addEventListener('change', function() {
preferredCardType = this.value
})
})
}
},
function(err) {
...
}
)
}
});
};
form.addEventListener("submit", function (e) {
e.preventDefault()
client.tokenize(
form,
{
name: document.getElementById("card-form-name").value,
preferred_card_type: preferredCardType
},
function (token) {
console.log("Tokenization Success", token)
client.makeCardPayment(
invoiceId,
token,
...
)
}
)
})Other methods that accepts preferred_card_type
preferred_card_typeApart from tokenize method, the merchants can choose to override default value based on the requests. This is possible on makeIncrementalAuthorizationPayment, makeCardPayment and initiateThreeDS. preferred_card_type can be passed as part of the options object.
client.setupForm(formElement, {},
processoutReadyHander,
function(err) { ... }
);
...
client.makeCardPayment(
invoiceId,
token,
{
authorize_only: true,
preferred_card_type: "credit"
},
...
)Updated about 4 hours ago
