Skip to content

Plugin to scan credit card information using Pay.Cards library

License

Notifications You must be signed in to change notification settings

CrossGeeks/PayCardsPlugin

Repository files navigation

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published