在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):card-io/card.io-Android-SDK开源软件地址(OpenSource Url):https://github.com/card-io/card.io-Android-SDK开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):card.io SDK for Androidcard.io provides fast, easy credit card scanning in mobile apps. Stay up to datePlease be sure to keep your app up to date with the latest version of the SDK. All releases follow semantic versioning. The latest version is available via
You can receive updates about new versions via a few different channels:
Also be sure to check and post to the Stack Overflow card.io tag. Integration instructionsThe information in this guide is enough to get started. For additional details, see our javadoc. (Note: in the past, developers needed to sign up at the card.io site and obtain an Requirements for card scanning
A manual entry fallback mode is provided for devices that do not meet these requirements. SetupAdd the dependency in your
Sample code (See the SampleApp for an example)First, we'll assume that you're going to launch the scanner from a button,
and that you've set the button's public void onScanPress(View v) {
Intent scanIntent = new Intent(this, CardIOActivity.class);
// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
} Next, we'll override @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == MY_SCAN_REQUEST_CODE) {
String resultDisplayStr;
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
// Never log a raw card number. Avoid displaying it, but if necessary use getFormattedCardNumber()
resultDisplayStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n";
// Do something with the raw number, e.g.:
// myService.setCardNumber( scanResult.cardNumber );
if (scanResult.isExpiryValid()) {
resultDisplayStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
}
if (scanResult.cvv != null) {
// Never log or display a CVV
resultDisplayStr += "CVV has " + scanResult.cvv.length() + " digits.\n";
}
if (scanResult.postalCode != null) {
resultDisplayStr += "Postal Code: " + scanResult.postalCode + "\n";
}
}
else {
resultDisplayStr = "Scan was canceled.";
}
// do something with resultDisplayStr, maybe display it in a textView
// resultTextView.setText(resultDisplayStr);
}
// else handle other activity results
} Hints & Tips
ContributingPlease read our contributing guidelines prior to submitting a Pull Request. LicensePlease refer to this repo's license file. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论