Skip to content


Subversion checkout URL

You can clone with
Download ZIP
tree: 1f72eeda03
Fetching contributors…

Cannot retrieve contributors at this time

93 lines (76 sloc) 3.366 kB iOS plug-in for Phone Gap

This plug-in exposes's credit card scanning. ( also supports charging cards; that is not yet supported in this plug-in.)

Integration instructions

  • Add the library:

    • Sign up for an account at, create an app, and take note of your app_token.
    • Download the iOS SDK at
    • Follow the instructions there to add the requisite files, frameworks, and linker flags to your Xcode project.
  • Add this plug-in:

    • Add CardIOPGPlugin.[h|m] to your project (Plugins group).
    • Copy CardIOPGPlugin.js to your project's www folder using Finder or Terminal. (If you don't have a www folder yet, run in the Simulator and follow the instructions in the build warnings.)
    • Add e.g. <script type="text/javascript" charset="utf-8" src="CardIOPGPlugin.js"></script> to your html.
    • In Cordova.plist, add an entry to Plugins with key CardIOPGPlugin and value CardIOPGPlugin.
    • In Cordova.plist, add an entry to ExternalHosts with value *
    • See CardIOPGPlugin.js for detailed usage information.
    • Sample canScan usage: window.plugins.card_io.canScan(function(canScan) {console.log(" can scan: " + canScan);});
    • Sample (minimal) scan usage: window.plugins.card_io.scan("YOUR_APP_TOKEN", {}, function(response) {console.log("card number: " + response["card_number"]);}, function() {console.log("card scan cancelled");});

Sample HTML + JS

<h1>Scan Example</h1>
<p><button id='scanBtn'>Scan now</button></p>
<script type="text/javascript">

  function onDeviceReady() {

    var cardIOResponseFields = [

    var onCardIOComplete = function(response) {
      console.log(" scan complete");
      for (var i = 0, len = cardIOResponseFields.length; i < len; i++) {
        var field = cardIOResponseFields[i];
        console.log(field + ": " + response[field]);

    var onCardIOCancel = function() {
      console.log(" scan cancelled");

    var onCardIOCheck = function (canScan) {
      console.log(" canScan? " + canScan);
      var scanBtn = document.getElementById("scanBtn");
      if (!canScan) {
        scanBtn.innerHTML = "Manual entry";
      scanBtn.onclick = function (e) {
            "collect_expiry": true,
            "collect_cvv": false,
            "collect_zip": false,
            "shows_first_use_alert": true,
            "disable_manual_entry_buttons": false




Questions? Contact support@<the obvious domain>.

Jump to Line
Something went wrong with that request. Please try again.