Closed marioamgad9 closed 1 month ago
Hi @marioamgad9
I understand you're using CardComponent
as standalone component. Take a look into CardComponentDelegate
, there are two methods there that should help you:
/// Called with the first 6 or 8 digits typed by the shopper in the PAN field in `CardComponent`.
///
/// - Parameter value: Up to 8 first digits in entered PAN.
/// - Parameter component: The `CardComponent` instance.
func didChangeBIN(_ value: String, component: CardComponent)
and
/// Called when shopper submits the `CardComponent` form.
///
/// - Parameter lastFour: Last 4 digits of card.
/// - Parameter finalBIN: The final Card BIN.
/// - Parameter component: The `CardComponent` instance.
func didSubmit(lastFour: String, finalBIN: String, component: CardComponent)
However, we only notify on the last four digits at the submission moment. Cheers
Hi @nauaros
Thank you for the fast response.
Actually, we use the DropInComponent
, not CardComponent
. So, what we have access to is the DropInComponentDelegate
, and I don't see these function in this delegate.
Is there a way to get these same values without refactoring our entire app to use the CardComponent
?
Yes, the DropInComponent
has a property called cardComponentDelegate
.
DropInComponent.swift:113
@nauaros Perfect. This works exactly like we need. Thank you so much for your help. 🙌
Hi @nauaros!
I'm reopening this issue as I found an issue with this implementation and was hoping you can help us with it.
This works perfectly when submitting a payment with a card, but doesn't work if the card was saved. Is this behavior intentional? And if so, is there a way to get the BIN and last four digits when the user submits a payment with a saved card?
Hey @marioamgad9!
Unfortunately it is not possible. Store cards are tokenized, and only the last four digits are known after performing a call to /paymentMethods
. From within the SDK we don't know anything else besides the last four digits and the expiry date. Here's an example response of what a stored card looks like:
{
"expiryMonth" : "03",
"expiryYear" : "30",
"id" : "Q3HJSDJS44KHQQ65",
"supportedShopperInteractions" : [
"Ecommerce",
"ContAuth"
],
"lastFour" : "1111",
"brand" : "visa",
"supportedRecurringProcessingModels" : [
"CardOnFile",
"Subscription",
"UnscheduledCardOnFile"
],
"holderName" : "Checkout Shopper PlaceHolder",
"name" : "VISA",
"type" : "scheme"
}
Background
In our app, we're trying to implement a pre-auth fraud detection tool. In order to do that, we need to pass the first and last 4 digits to it to do its thing.
Problem
I've tried reading the documentation and searching everywhere for this, but couldn't find a way to do it. Is this even possible, and if so can you please refer me to documentation where this is mentioned?