Reputation: 3387
I am trying to implement Card.io
in my app, I followed the instructions on Card.io website and when I get into my app and I launch it, it locks in on my card, but after that nothing else happens. Below is my code
AndroidManifest
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<--!..........................-->
<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" android:hardwareAccelerated="true"/>
<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>
ActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == MY_SCAN_REQUEST_CODE) {
String cardNumbs, cardExp, cardCVV;
String resultStr;
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
//TODO
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
cardNumbs = scanResult.getRedactedCardNumber();
acctDebitCardNo.setText(cardNumbs);
if (scanResult.isExpiryValid()) {
cardExp = scanResult.expiryMonth + "/" + "20" + scanResult.expiryYear;
acctDebitCardExp.setText(cardExp);
} else {
acctDebitCardExp.setError("Card Has Expired");
}
if (scanResult.cvv != null) {
cardCVV = scanResult.cvv;
acctDebitCardCvv.setText(cardCVV);
}
}
}
}
Permission To Launch Camera
Intent scanIntent = new Intent(getActivity(), CardIOActivity.class);
// customize these values to suit our/there needs...LOL :).
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true);
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true);
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
// 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, true);
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
I don't know what I'm doing wrong
Upvotes: 2
Views: 1891
Reputation: 6263
In my own case, the problem was that the card was not embossed (most Nigerian cards are not). Card.io and PayCards do not cater for embossed cards. If this scenario fits your case, you might need to build the scanner by yourself using Firebase MLKit. The whole process is less complex than it sounds. You can follow this guide to help you.
I hope this helps. Merry coding!
Upvotes: 2
Reputation: 712
Is the card number embossed? See card-io/card.io-iOS-SDK#20 for a description of why non-embossed cards are not supported.
Upvotes: 0
Reputation: 61
Upvotes: 1