I m using card.io for scanning credit card in my app. My problem is i can not get card image logo (even i m passing (CardIOActivity.EXTRA_USE_CARDIO_LOGO, true)). as well i m not getting key for card(for example. VISA have 4,MASTERCARD have 55 or 51).

answer will be appreciated.

Thanks in advance.

what i mean for Key is CardTypeId. we are getting CardTypeId in ios like this..

(void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)scanViewController {
// The full card number is available as info.cardNumber, but don't log that!
NSLog(@"Received card info. Number: %@, expiry: %02i/%i, cvv: %@.cardtype %u", info.cardNumber, info.expiryMonth, info.expiryYear, info.cvv,info.cardType);
//getting cardtype (like visa) from info.cardType (this is what we called as CardTypeId //an ineger value)

NSString *cardTypeString=[NSString stringWithFormat:@"%@",[CardIOCreditCardInfo     displayStringForCardType:info.cardType usingLanguageOrLocale:[[NSLocale currentLocale] localeIdentifier]]];
}

so how to get that integer number in android (info.cardType) (info is object of CardIOCreditCardInfo) FYI info.cardType returns integer like 53,52 etc.

有帮助吗?

解决方案

Jeff from card.io here.

We now allow the card type image to be retrieved in version 3.1.3 of the card.io Android SDK. To retrieve the card type image, please use

cardType.imageBitmap(context)

CardIOActivity.EXTRA_USE_CARDIO_LOGO is used for displaying the card.io logo when scanning a card, and is unrelated to retrieving the image logo.

Regarding the cardTypeId, I'm assuming you want the cardType enum and string. In Android, CreditCard.getCardType() returns the CardType enum, such as CardType.VISA or CardType.AMEX. If you want a localized name of the retrieved credit card, just call

cardType.getDisplayName(null) //optionally pass in the desired locale

The enum values are not something that should be important, because enums are meant to be consumed as enums. They should never be an undefined value (the iOS header file does not show 52 or 53 as possible values). If you think there's a bug, please file in in the card.io GitHub Android repo.

其他提示

Add this line in method 【onActivityResult】

resultStr += "Card Type: " +  scanResult.getCardType().getDisplayName(null) + "\n";
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top