Giter Site home page Giter Site logo

core_card_io's Introduction

core_card_io

CardIO plugin for flutter

A Flutter plugin for iOS and Android for scanning credit cards using the camera. This uses the CardIO library for iOS and Android

Note: This plugin is still under development, and some APIs might not be available yet. Feedback and pull requests are welcome!

Installation

First, add core_card_io as a dependency in your pubspec.yaml file.

iOS

Add the following key to your Info.plist file, located in <project root>/ios/Runner/Info.plist:

NSCameraUsageDescription - Set the value to be a string describing why your app needs to use the camera (e.g. "To scan credit cards."). This string will be displayed when the app initially requests permission to access the camera.

Run 'pod install'

Android

Add the following permission to your Android Manifest, located in `/android/app/src/main/AndroidManifest.xml:

<uses-permission android:name="android.permission.CAMERA"/>

Add card.io's open source license acknowledgments to your app's acknowledgments.

Example

Show example folder

  Map<String, dynamic> details = await FlutterCardIo.scanCard({
    "requireExpiry": true,
    "scanExpiry": true,
    "requireCVV": true,
    "requirePostalCode": true,
    "restrictPostalCodeToNumericOnly": true,
    "requireCardHolderName": true,
    "scanInstructions": "Hola! Fit the card within the box",
  });

Response

{
    "cardholderName": "John doe",
    "cardNumber": "1234 5678 9876 1236",
    "redactedCardNumber": "**** **** **** 1236",
    "expiryMonth": 12,
    "expiryYear": 2022,
    "cvv": 123,
    "postalCode": "93748"
}

core_card_io's People

Contributors

harrybui2804 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

core_card_io's Issues

iOS build problem

Hello,

I'm having this problem when tried to build to iOS:

`Launching lib/main.dart on iPhone 8 in debug mode...
Running pod install...
Running Xcode build...
Xcode build done. 15,0s
Failed to build iOS app
Error output from Xcode build:

** BUILD FAILED **

Xcode's output:

=== BUILD TARGET sqflite OF PROJECT Pods WITH CONFIGURATION Debug ===
/Users/guilhermefilippo/flutter/.pub-cache/git/core_card_io-13214839aabfdf4a2e71decec19719cdc485d14c/ios/Classes/CoreCardIoPlugin.m:41:38: warning: assigning to 'id _Nullable' from incompatible type 'CoreCardIoPlugin *const __strong'
_scanViewController.delegate = self;
^ ~~~~
1 warning generated.
=== BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
ld: warning: Could not find or use auto-linked library 'swiftCoreFoundation'
ld: warning: Could not find or use auto-linked library 'swiftCompatibility50'
ld: warning: Could not find or use auto-linked library 'swiftCore'
ld: warning: Could not find or use auto-linked library 'swiftQuartzCore'
ld: warning: Could not find or use auto-linked library 'swiftCoreGraphics'
ld: warning: Could not find or use auto-linked library 'swiftDarwin'
ld: warning: Could not find or use auto-linked library 'swiftUIKit'
ld: warning: Could not find or use auto-linked library 'swiftObjectiveC'
ld: warning: Could not find or use auto-linked library 'swiftFoundation'
ld: warning: Could not find or use auto-linked library 'swiftMetal'
ld: warning: Could not find or use auto-linked library 'swiftCoreImage'
ld: warning: Could not find or use auto-linked library 'swiftCompatibilityDynamicReplacements'
ld: warning: Could not find or use auto-linked library 'swiftDispatch'
ld: warning: Could not find or use auto-linked library 'swiftCoreMedia'
ld: warning: Could not find or use auto-linked library 'swiftCoreAudio'
ld: warning: Could not find or use auto-linked library 'swiftSwiftOnoneSupport'
Undefined symbols for architecture x86_64:
"value witness table for Builtin.UnknownObject", referenced from:
full type metadata for core_card_io.SwiftCoreCardIoPlugin in core_card_io(SwiftCoreCardIoPlugin.o)
"_swift_FORCE_LOAD$_swiftCompatibilityDynamicReplacements", referenced from:
_swift_FORCE_LOAD$swiftCompatibilityDynamicReplacements$_core_card_io in core_card_io(SwiftCoreCardIoPlugin.o)
(maybe you meant: _swift_FORCE_LOAD$swiftCompatibilityDynamicReplacements$core_card_io)
"swift_allocObject", referenced from:
@objc core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"static (extension in Foundation):Swift.String.unconditionallyBridgeFromObjectiveC(__C.NSString?) -> Swift.String", referenced from:
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"static Swift.String.+ infix(Swift.String, Swift.String) -> Swift.String", referenced from:
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"_swift_unknownObjectRelease", referenced from:
static core_card_io.SwiftCoreCardIoPlugin.register(with: __C.FlutterPluginRegistrar) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in core_card_io(SwiftCoreCardIoPlugin.o)
@objc static core_card_io.SwiftCoreCardIoPlugin.register(with: __C.FlutterPluginRegistrar) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"swift_release", referenced from:
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
__swift_destroy_boxed_opaque_existential_0 in core_card_io(SwiftCoreCardIoPlugin.o)
@objc core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"_swift_deallocObject", referenced from:
l_objectdestroy in core_card_io(SwiftCoreCardIoPlugin.o)
"swift_retain", referenced from:
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"_swift_unknownObjectRetain", referenced from:
@objc static core_card_io.SwiftCoreCardIoPlugin.register(with: __C.FlutterPluginRegistrar) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"Swift._bridgeAnythingToObjectiveC(A) -> Swift.AnyObject", referenced from:
reabstraction thunk helper from @escaping @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"(extension in Foundation):Swift.String._bridgeToObjectiveC() -> __C.NSString", referenced from:
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in core_card_io(SwiftCoreCardIoPlugin.o)
"swift_getObjCClassFromMetadata", referenced from:
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in core_card_io(SwiftCoreCardIoPlugin.o)
"type metadata for Swift.String", referenced from:
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"_swift_FORCE_LOAD$_swiftCompatibility50", referenced from:
_swift_FORCE_LOAD$swiftCompatibility50$_core_card_io in core_card_io(SwiftCoreCardIoPlugin.o)
(maybe you meant: _swift_FORCE_LOAD$swiftCompatibility50$_core_card_io)
"_swift_getObjCClassMetadata", referenced from:
type metadata accessor for __C.FlutterMethodChannel in core_card_io(SwiftCoreCardIoPlugin.o)
@objc static core_card_io.SwiftCoreCardIoPlugin.register(with: __C.FlutterPluginRegistrar) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"swift_bridgeObjectRelease", referenced from:
@nonobjc __C.FlutterMethodChannel.__allocating_init(name: Swift.String, binaryMessenger: __C.FlutterBinaryMessenger) -> __C.FlutterMethodChannel in core_card_io(SwiftCoreCardIoPlugin.o)
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"_swift_getObjectType", referenced from:
static core_card_io.SwiftCoreCardIoPlugin.register(with: __C.FlutterPluginRegistrar) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"swift_getInitializedObjCClass", referenced from:
type metadata accessor for __C.FlutterMethodChannel in core_card_io(SwiftCoreCardIoPlugin.o)
type metadata accessor for core_card_io.SwiftCoreCardIoPlugin in core_card_io(SwiftCoreCardIoPlugin.o)
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
"Swift.String.init(builtinStringLiteral: Builtin.RawPointer, utf8CodeUnitCount: Builtin.Word, isASCII: Builtin.Int1) -> Swift.String", referenced from:
static core_card_io.SwiftCoreCardIoPlugin.register(with: __C.FlutterPluginRegistrar) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
core_card_io.SwiftCoreCardIoPlugin.handle(
: __C.FlutterMethodCall, result: (Any?) -> ()) -> () in core_card_io(SwiftCoreCardIoPlugin.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Could not build the application for the simulator.
Error launching application on iPhone 8.`

Can anybody help me?

Thanks.

Release build

Hello

Can you build in release mode?
I'm trying to build, no errors, but was I tried to opened the APK on android smartphone, the app just closes.

Can you have any idea to fix?

Thanks
Guilherme

Custom styling

Will it be possible in future to style the 'Keyboard...' button?

Support for Android v2 embedding

To avoid unexpected runtime failures, or future build failures in future, this plugin needs to start supporting Android V2 embedding

Update Readme

The example given in Readme contains FlutterCardIo. Please update it to CoreCardIo

can't read Amex card

hello! does it scan Amex card by the plugin's camera?
like 3400 0000 0000 009
It can't put manually by keyboard.

Compilation error with Android X

Please remove or update Kotlin version in the build.gradle to minimum 1.3.0 otherwise the compilation fails when Flutter app is migrated to Android X

Diner's Club supported?

hello! does it scan Diner's Club card by the plugin's camera?
like 3600 000000 0000
It can't put manually by keyboard.

Scan result does not reset between calls to CoreCardIo.scanCard on iOS

Due to the way the iOS plugin is implemented, allocating the view controller upon plugin registration, the view controller does not reset on subsequent calls to CoreCardIo.scanCard.

My proposed solution is to allocate the view controller upon every call to scanCard.

Disclaimer: I have not tried this on the Android version, but from the code it seems like the activity is restarted from scratch every time you call scanCard.

EDIT: I see that there's already a fork that fixes this problem. Maybe it can be merged into this main dev branch?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.