Hi,
I need to get user’s card data which i get in response after completion of transaction.
In that from Payment class there are not any method to get numberMasked,card type ,auth code also not in Transaction class.
So should i have to pass manually that json or is there any separate class for get that?
Actually i got the solution.
I just use below code for get those things.
for (Transaction t : payment.getTransactions()) {
String str = String.valueOf(t.getId());
FundingSource src = t.getFundingSource();
Card card = src.getCard();
card_number = card.getNumberMasked();
CardType crd_type = card.getType();
card_type = crd_type.toString();
}
Hi there,
Does this work for you?
for (Transaction t : payment.getTransactions()) {
if (t.getFundingSource().getCard() != null){
Card c = t.getFundingSource().getCard();
String numberMasked = c.getNumberMasked();
String approvalCode = t.getApprovalCode();
CardType cardType = c.getType();
switch (cardType){
case AMERICAN_EXPRESS:
// amex
break;
case VISA:
// visa
break;
case MASTERCARD:
// MC
break;
case DISCOVER:
// discover
break;
default:
// other
break;
}
}
}
Hi Dennis,
Yes,Its work properly.
Hi dennis,
How can we get unmasked card details in our code
Hi there, will respond over email.