card.io
card.io copied to clipboard
Using this with ionic?
Hi,
I've tried to add the plugin into a ionic project, but it seems like it is unable to reference to CardIO
CardIO is not definedCardIO is not defined
Anyone succeed using ionic?
Thanks :)
i do, w/ Ionic 2
I got it to work! Thanks :)
@Vincenttbk Can you help me please. Its not working for me.
@Vincenttbk How did you make it work !? I am facing same error. unable to reference to CardIO. Can you help me to make it work Please !
I have not used iconic framework. However I have helped few folks who were using other frameworks having similar problem. The framework was not including the .so files that are packaged in the lib folder. Make sure your .apk file has the lib folder with .so included.
@shahfaizanali @laharshah Actually the implementation is the same, just ensure that you bind the event handler to call the CardIO.scan function properly(It should be bound after the button has been initialised).
@Vincenttbk: I have the same issue. Can you provide some example?
Thanks.
with ionic 2 add this line after imports
declare var CardIO;
Can someone show an example!?
I am trying CardIo.canScan()
and I'm getting:
Function implementation is missing or not immediately following the declaration.
Thanks for your help!
ionic1 ng-click="cardScan()" inoc2 (click)="cardScan()"
cardScan() {
var cardIOResponseFields = [
"card_type",
"redacted_card_number",
"card_number",
"expiry_month",
"expiry_year",
"cvv",
"zip"
];
var onCardIOComplete = function(response) {
for (var i = 0, len = cardIOResponseFields.length; i < len; i++) {
var field = cardIOResponseFields[i];
console.log(field + ": " + response[field]);
}
};
var onCardIOCancel = function() {
console.log("card.io scan cancelled");
};
var onCardIOCheck = function(canScan) {
console.log("card.io canScan? " + canScan);
var scanBtn = this.myElement.nativeElement;
if (!canScan) {
console.log('MANUAL')
scanBtn.innerHTML = "Manual entry";
}
};
CardIO.scan(
{
"requireExpiry": true,
"scanExpiry": true,
"requirePostalCode": true,
"restrictPostalCodeToNumericOnly": true,
"hideCardIOLogo": true,
"suppressScan": false,
"keepApplicationTheme": true
},
onCardIOComplete,
onCardIOCancel
);
CardIO.canScan(onCardIOCheck);
}