card.io-Android-SDK
card.io-Android-SDK copied to clipboard
Card IO is not capturing the credit card
Required Information
- card.io Android SDK Version:
- Android Version and Device (Motorola Droid Razr Maxx with Android 4.4.2, Samsung S7 with Android 6.0, etc...):
Issue Description
I cannot scan the credit card it keeps telling me hold card here .....i have added all permission but nothing is working ..need help.why that issues ???? Here is my Main Activity
public class MainActivity extends AppCompatActivity { private Button scanButton; private TextView resultTextView;
private int MY_SCAN_REQUEST_CODE = 100; // arbitrary int
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// set the Button and text view scanButton = (Button) findViewById(R.id.scanButton); resultTextView = (TextView) findViewById(R.id.resultTextView);
scanButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("----Message---: ", "Card Click");
// This method is set up as an onClick handler in the layout xml
// e.g. android:onClick="onScanPress"
Intent scanIntent = new Intent(MainActivity.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, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_RESTRICT_POSTAL_CODE_TO_NUMERIC_ONLY, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CARDHOLDER_NAME, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_USE_CARDIO_LOGO, false);
scanIntent.putExtra(CardIOActivity.EXTRA_CAPTURED_CARD_IMAGE, true);
// hides the manual entry button
// if set, developers should provide their own manual entry mechanism in the app
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); // default: false
// matches the theme of your application
scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, false); // default: false
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
}
});
}
@Override
protected void onResume() {
super.onResume();
if (CardIOActivity.canReadCardWithCamera()){
scanButton.setText("Scan button");
}else {
scanButton.setText("Enter Credit Information");
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
String resultStr;
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()
resultStr = "Card Number: " + scanResult.getRedactedCardNumber() + "\n";
// Do something with the raw number, e.g.:
// myService.setCardNumber( scanResult.cardNumber );
if (scanResult.isExpiryValid()) {
resultStr += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
}
if (scanResult.cvv != null) {
// Never log or display a CVV
resultStr += "CVV has " + scanResult.cvv.length() + " digits.\n";
}
if (scanResult.postalCode != null) {
resultStr += "Postal Code: " + scanResult.postalCode + "\n";
}
if (scanResult.cardholderName != null) {
resultStr += "Cardholder Name : " + scanResult.cardholderName + "\n";
}
} else {
resultStr = "Scan was canceled.";
}
resultTextView.setText(resultStr);
}
}
How easily visible is your card? CardIO can be picky sometime if the numbers aren't easily visible. Also, the newer style chip cards with the card number running vertically across the card don't work.
is so visible now i have added some codes then it scan then it cancel it self without me canceling Here is my custom value : What am i doing wrong ? // customize these values to suit your needs. scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, true); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_RESTRICT_POSTAL_CODE_TO_NUMERIC_ONLY, false); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CARDHOLDER_NAME, false); // default: false scanIntent.putExtra(CardIOActivity.EXTRA_USE_CARDIO_LOGO, false); scanIntent.putExtra(CardIOActivity.EXTRA_CAPTURED_CARD_IMAGE, true); scanIntent.putExtra(CardIOActivity.EXTRA_USE_PAYPAL_ACTIONBAR_ICON, false); scanIntent.putExtra(CardIOActivity.EXTRA_HIDE_CARDIO_LOGO, true); scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_CONFIRMATION, true); scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_EXPIRY, true); // scanIntent.putExtra(CardIOActivity.EXTRA_RETURN_CARD_IMAGE, true); scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_SCAN, true); scanIntent.putExtra(CardIOActivity.EXTRA_SCAN_RESULT, true);
Wow, you provided a lot of extras. How about trying with no extras, so you get the default functionality. If your card does not scan, then it probably just won't work with that card type. If it does scan, then add each extra you want one at a time. Some of the extras you provided above are not needed for most use cases.
I m not getting D/CardScanner: detected card: {Unknown: } I using a Visa Card which is working
@kevinjam Do you found any solution?
Still there is an issue with alot of extra and with no extra. No vibration. Just stay and show green squire.
CardIOActivityTest
pass
SampleActivityTest
test fail
Using your example with card.io-5.5.1.aar Nexus 5, OS: 6.0.1
When I check "Detect Card-ish rectangle only" then it cancel immediately after catching card but return no results. How to solve this issue? Help required.
@Can any contributor will help me to fix this issue. Running this sample on my Nexus 5, OS: 6.0.1 as mention above. Not return results. Not working at all just previewing and highlighting the card.