BIN Lookup
Card information based on the Bank Identification Number (BIN)
Using your account Public API Key on MoneyHash
class instance you will be able to have the functionality of the following method
const moneyHash = new MoneyHash({
type: "payment",
publicApiKey: "<account_public_api_key>",
});
Bin Lookup With Full Card Data
Collect Card Data
After collecting card info as mentioned here.
const cardData = await moneyHash.cardForm.collect();
You will need to render card form fields to be able to collect customer card information.
Card Bin Lookup
try {
const binLookup = await moneyHash.cardForm.binLookup({
cardData,
// flowId: '<flow_id>' // accepts optional flowId
});
console.log(binLookup); // bin lookup data of type BinLookUpData
} catch (error) {
console.log(error);
}
Bin Lookup Without Full PAN Number
Starting from SDK v1.17.0
& v2.2.0
Dynamic Bin Lookup while Card entry is happening.
// listen to changes in the card number field
cardNumber.on("changeInput", ({ length }) => {
if (length === 8) {
moneyHash.cardForm.binLookup().then(console.log).catch(console.log);
}
});
Bin Lookup with 8 digits card number
Errors
{
"code": 404,
"message": "",
"type": "network",
"field": null,
"errors": []
}
{
"type": "cardValidation",
"card_number": "Card number must be at least 8 digits."
}
Bin Lookup with Receipts
Using receipts that is received from apple pay (refer to Apple Pay & Native Pay Methods), you can make a bin lookup using moneyhash.binLookupByReceipt
method.
try {
const binLookup = await moneyHash.binLookupByReceipt({
nativeReceiptData: applePayReceipt,
methodId: <method-id>, // the method id used for bin lookup, received from nativePayData
// flowId: '<flow_id>' // accepts optional flowId
});
console.log(binLookup); // bin lookup data of type BinLookUpData
} catch (error) {
console.log(error);
}
export type BinLookUpData = {
firstSixDigits: string;
brand: string;
cardType: string | null;
issuer: string | null;
issuerCountry: string | null;
issuerCountryCode: string | null;
};
Updated 2 days ago