Card IO plugin- scan and charge credit cards with a mobile phone

Has anyone implemented the CardIO https://github.com/card-io/card.io-iOS-SDK-PhoneGap

I could not get this to work for me

Any help greatly appreciated!

1 Like

I was able to get this working. I added plugin. Then in my controller I added function that I called scanCard which was attached to my button with id scanBtn, which was triggered using ng-click. Here is how I edited the javascript they used in phonegap example in my controller.

$scope.scanCard = function(){
    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 = angular.element($("#scanBtn")).scope();
      //var scanBtn = document.getElementById("scanBtn");
      if (!canScan) {
        scanBtn.innerHTML = "Manual entry";
      }
    };

    CardIO.scan({
      "collect_expiry": true,
      "collect_cvv": false,
      "collect_zip": false,
      "shows_first_use_alert": true,
      "disable_manual_entry_buttons": false
    },
      onCardIOComplete,
      onCardIOCancel
    );

    CardIO.canScan(onCardIOCheck);
}

thanks, this works very well

I am getting a linker error on ios

clang: error: linker command failed with exit code 1 (use -v to see invocation)

If you disable bitcode you can get it working, although this isn’t really the most desireable fix.

Hi Where can i find the plugin, you added Katmartunez

Hey…

If you get this working can you please provide some more information regarding adding cardIO module.

Do I need to include any js file in index.html after installing this plugin ?

And what module name do I need to attach and need to pass in angular controller ?

Thank you !

Hi katmartinez,

Am using the same code as you mention in this post. But am always getting the card.io scan cancelled and Could not detect whether card.io card scanning is available. Is there any missing. Please pull me out from this issue.
Thanks in advance.

I got this working for iOS. But for Android 6.1 I can see the card scanned in the debug console but it doesn’t return it to the view. Any thoughts?

Update: It work for Android all versions except unless i don’t put alert( ); the camera doesn’t activate. i am using platform ready command. Any thoughts?

Hi all , what kind of reader are you using? I algo need to implement the reading functionality in my app. Thanks to all.
Regard,
J
Note : i may buy this: https://www.aliexpress.com/item/Mobile-Credit-Debit-Card-Reader-for-Apple-Android-iOS-3-5mm-White/32352967182.html?spm=2114.01010208.3.1.hdo3nR&ws_ab_test=searchweb201556_10,searchweb201602_2_10057_10056_10065_10037_10068_10055_10054_10069_301_10059_10033_10058_10032_10073_10017_10070_10060_10061_10052_10062_10053_10050_10051,searchweb201603_3&btsid=40e34170-e6ed-4b43-a805-05e806b4f9d4

Hi @katmartinez08,

Appreciate if you can share more detail regarding to ading CardIO module.

Thanks,
Punleu

how can I do on ionic v2?

thanks

1 Like

Simply use this func when you install plugin from ionic offical website
this.cardIO.canScan()
.then(

  (res: boolean) => {
    if (res) {
      let options = {
        requireExpiry: true,
        requireCVV: false,
        requirePostalCode: false
      };
      this.cardIO.scan(options)
      
    



      alert('hi'+JSON.stringify(res)+'---'+JSON.stringify(options))
    }
  }
).catch(function (error) {
  alert(JSON.stringify(error))

})

Did you include any js file in index.html?
I have installed plugin and I’m getting an error: CardIO is not defined
Anyone get this error also?