CrossGeeks / PayCardsPlugin

Plugin to scan credit card information using Pay.Cards library

Home Page:https://pay.cards

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PayCards Plugin for Xamarin iOS and Android

Build Status

Simple cross platform plugin that uses Pay.Cards library to scan credit card information.

       

Setup

Platform Support

Platform Version
Xamarin.iOS iOS 12+
Xamarin.Android API 9+

API Usage

Call CrossPayCards.Current from any project to gain access to APIs.

Getting Started

After installing the package in your shared, iOS and Android projects you should do the following setup on each platform:

Android Setup

Call PayCardsRecognizerService.Initialize in MainActivity OnCreate method

        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            PayCardsRecognizerService.Initialize(this);
            LoadApplication(new App());
        }

Override MainActivity OnActivityResult and call PayCardsRecognizerService.OnActivityResult

        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            PayCardsRecognizerService.OnActivityResult(requestCode, resultCode, data);
        }

iOS Setup

Add Camera Permission in Info.plist

	<key>NSCameraUsageDescription</key>
	<string>This application needs camera access</string>

Now you are ready to to scan credit cards!

Usage

  var cardInfo = await CrossPayCards.Current.ScanAsync();
  System.Debug.WriteLine("Result", $"{card.HolderName}\n{card.CardNumber}\n{card.ExpirationDate}","Ok");

About

Plugin to scan credit card information using Pay.Cards library

https://pay.cards

License:MIT License


Languages

Language:C# 83.6%Language:Objective-C 16.4%