card.io icon indicating copy to clipboard operation
card.io copied to clipboard

Using this with ionic?

Open Vincenttbk opened this issue 9 years ago • 10 comments

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 :)

Vincenttbk avatar Feb 24 '16 07:02 Vincenttbk

i do, w/ Ionic 2

ba0f3 avatar Feb 24 '16 10:02 ba0f3

I got it to work! Thanks :)

Vincenttbk avatar Mar 08 '16 07:03 Vincenttbk

@Vincenttbk Can you help me please. Its not working for me.

shahfaizanali avatar Apr 13 '16 08:04 shahfaizanali

@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 !

laharshah avatar Apr 18 '16 21:04 laharshah

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.

vkeepe avatar Apr 18 '16 22:04 vkeepe

@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 avatar Apr 19 '16 02:04 Vincenttbk

@Vincenttbk: I have the same issue. Can you provide some example?

Thanks.

CHOMNANP avatar Nov 17 '16 04:11 CHOMNANP

with ionic 2 add this line after imports

declare var CardIO;

sergebruni avatar Dec 01 '16 20:12 sergebruni

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!

psoaresbj avatar Dec 01 '16 20:12 psoaresbj

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);

  }

sergebruni avatar Dec 01 '16 21:12 sergebruni