getCardMetadata

If a card payment instrument is used then BR-DGE may be able to provide metadata about the card.

Example

This example demonstrates how to catch errors that might be thrown by a function that tries getting card metadata from BIN.

suspend fun getCardInfo(bin: String) {
try {
val brdge = BrdgeAPI(clientAPIKey = Constants.prodClientAPIKey, domain = BrdgeDomain.Production)
val cardMetadata = brdge.binLookup.getCardMetadata(bin = bin)
if (cardMetadata == null) {
errorMessage = "Card Info not found"
return
}
this.cardMetadata = cardMetadata
} catch (error: BrdgeBinValidationError.Value) {
errorMessage = "Wrong value for BIN provided"
} catch (error: BrdgeBinValidationError.Length) {
errorMessage = "Invalid BIN length. It should be 9 numeric characters."
} catch (unauthorizedError: BrdgeNetworkError.Unauthorised) {
errorMessage = "Unauthorised..."
} catch (apiError: BrdgeNetworkError.ApiError) {
errorMessage = apiError.message
} catch (urlError: BrdgeNetworkError.UrlError) {
errorMessage = "No internet connection, please try again..."
} catch (e: Exception) {
errorMessage = "Something went wrong... Please try again."
}
}

Return

Metadata about the card.

Parameters

bin

The first nine digits of the card PAN.

Throws

BR-DGE BIN-related validation errors.

This will be thrown if the BR-DGE REST API error is not a validation error.

This is an internal SDK error.