简体   繁体   English

Card.io获取信用卡图像和CardType密钥android

[英]Card.io get creditcard image and CardType key android

I m using card.io for scanning credit card in my app. 我正在使用card.io在我的应用程序中扫描信用卡。 My problem is i can not get card image logo (even im passing (CardIOActivity.EXTRA_USE_CARDIO_LOGO, true)). 我的问题是我无法获得名片图像徽标(即使即时通过(CardIOActivity.EXTRA_USE_CARDIO_LOGO,是)。 as well im not getting key for card(for example. VISA have 4,MASTERCARD have 55 or 51). 以及我没有得到卡的钥匙(例如,VISA有4,MASTERCARD有55或51)。

answer will be appreciated. 答案将不胜感激。

Thanks in advance. 提前致谢。

what i mean for Key is CardTypeId. 我对Key的意思是CardTypeId。 we are getting CardTypeId in ios like this.. 我们这样在iOS中获取CardTypeId。

(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. 所以如何在android中获取该整数(info.cardType)(info是CardIOCreditCardInfo的对象)FYI info.cardType返回整数,例如53,52等。

Jeff from card.io here. 来自card.io的Jeff在这里。

We now allow the card type image to be retrieved in version 3.1.3 of the card.io Android SDK . 现在,我们允许在card.io Android SDK版本3.1.3中检索卡类型图像。 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. CardIOActivity.EXTRA_USE_CARDIO_LOGO用于在扫描卡时显示card.io徽标,并且与检索图像徽标无关。

Regarding the cardTypeId, I'm assuming you want the cardType enum and string. 关于cardTypeId,我假设您想要cardType枚举和字符串。 In Android, CreditCard.getCardType() returns the CardType enum, such as CardType.VISA or CardType.AMEX. 在Android中,CreditCard.getCardType()返回CardType枚举,例如CardType.VISA或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). 它们绝不能是未定义的值( iOS头文件不会显示52或53作为可能的值)。 If you think there's a bug, please file in in the card.io GitHub Android repo . 如果您认为有错误,请在card.io GitHub Android repo中提交文件。

在方法【onActivityResult】中添加此行

resultStr += "Card Type: " +  scanResult.getCardType().getDisplayName(null) + "\n";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM