To block payments from specific card numbers, integrate with Checkout.com's Fraud Detection solution and add the card numbers to a decline list.
Android
The onCardBinChanged callback:_-%3E_CallbackResult) triggers when the customer enters or changes the first eight digits of a card and returns a CardMetadata object.
Inspect the CardMetadata object's properties to determine the card's scheme and card_type and decide whether to reject the payment. Optionally, you can also display a custom error message to the customer with CallbackResult.Rejected("Custom error message"). For example:
val callback = ComponentCallback(
onCardBinChanged = { cardMetadata ->
// Reject the payment if the card scheme is Discover
if (cardMetadata.scheme == "discover") {
CallbackResult.Rejected("Discover payments are not accepted")
}
// Reject the payment if the card type is Credit
else if (cardMetadata.cardType == "credit") {
CallbackResult.Rejected("Credit cards are not accepted")
}
// Otherwise, continue with the payment
else {
CallbackResult.Accepted
}
}
)
val config = CheckoutComponentConfiguration(
componentCallback = callback
)
iOS
The onCardBinChanged callback_:_CallbackResult) triggers when the customer enters or changes the first eight digits of a card and returns a CardMetadata object.
Inspect the CardMetadata object's properties to determine the card's scheme and card_type and decide whether to reject the payment. Optionally, you can also display a custom error message to the customer with return .rejected(message: "Custom error message"). For example:
let callbacks = CheckoutComponents.Callbacks(
onCardBinChanged: { cardMetadata in
// Reject the payment if the card scheme is Discover
if cardMetadata.cardScheme == "discover" {
return .rejected(message: "Discover payments are not accepted")
}
// Reject the payment if the card type is Credit
else if cardMetadata.cardType == "credit" {
return .rejected(message: "Credit cards are not accepted")
}
// Otherwise, continue with the payment
return .accepted
}
)
let configuration = CheckoutComponents.Configuration(..., callbacks: callbacks)