Xamarin.Forms: Add Credit/Debit Card Reader to you App with PayPal.Forms
Xamarin.Forms: Add Credit/Debit Card Reader to you App with PayPal.Forms
Hello today I'll show how easily is to add a card scanner into your Xamarin.Forms(Android, iOS) app with only a few lines of code using the PayPal.Forms Library.
First at all we need to add PayPal.Forms to all of your projects(Android, iOS and PCL-Forms) by searching for "PayPal.Forms" in nuget packages manager or running next command on a nuget packages console "Install-Package PayPal.Forms"
Second on our Android app we need to add a few lines of code for permissions and features inside our "AndroidManifest.xml"
VERY IMPORTANT FOR IOS 10 IF YOU WANT TO USE THE CAMERA FEATURES
Add "NSCameraUsageDescription" into you Info.plist file.
<key>NSCameraUsageDescription</key>
<string>We will use your camera to scan the credit card</string>
After this now we're able to configure PayPal.Forms init calls inside our MainActivity.cs(Android) and AppDelegate.cs(iOS)
Call just CrossPayPalManager.Init(); just after call Forms.Init ();
***NOTE: if you plan to use only card scanner you can use init PayPal Config as follow***
If the configuration is getting fine now we can use the scan method CrossPayPalManager.Current.ScanCard();
Optional Parameter:
- CardIOLogo
-- PayPal: Display PayPal Logo in the Scanner Page
-- CardIO: Display CardIO Logo in the Scanner Page
-- None: Hide Brand Logo in the Scanner Page
Result Data:
-ScanCardResult
-- Status (Successful, Cancelled, Error)
-- Card:
--- Scaned: Returns true if card was scanned or false if the card was input by hand by user
--- RedactedCardNumber: Give you the card number with next format **** **** **** 1234.
--- PostalCode: Give you the card postal code(if is requerid).
--- ExpiryYear: Give you the card expiry year.
--- ExpiryMonth: Give you the card expiry month.
--- Cvv: Give you the card cvv.
--- CardType (Unrecognized, Ambiguous, Amex, Jcb, Visa, Mastercard, Discover)
--- CardNumber: Give you the card number.
--- CardImage: Forms ImageSource with Scanned Card Image.
Hope that this can help you to create and awesome Forms app now i invite you to play with it and also remember that this lib also can help you to implement PayPal Mobile SDK Frameworks for more information and examples take a look to my PayPal.Forms repository on Github:
https://github.com/AlejandroRuiz/PayPal.Forms
In the future we will continue with this post series to allow you monetize your Xamarin.Forms easily Happy Code Devs
hola alejandro buen dia
ResponderEliminarporque pesas tanto la dll de Xamarin.Paypal.iOs
Es por el peso de las librerías nativas de iOS pero en el ensamblado final no se ve reflejado el peso total puedes checar los pesos aquí
Eliminarhttps://github.com/paypal/PayPal-iOS-SDK/blob/master/PayPalMobile/libPayPalMobile.a
https://github.com/paypal/PayPal-iOS-SDK/blob/master/CardIO/libCardIO.a
https://github.com/paypal/PayPal-iOS-SDK/blob/master/CardIO/libopencv_core.a
https://github.com/paypal/PayPal-iOS-SDK/blob/master/CardIO/libopencv_imgproc.a
Este comentario ha sido eliminado por el autor.
Eliminaro cuando tengo habilitada la opcion de "Link SDK assemblies only" y corro la app ya sea en emulador o en dispositivo fisico me marca el siguiente error "Could not link assemblies. Reason: Object reference not set to an instance of an object", pero cuando habilito la opcion de "Dont link" la app corre perfectamente en emulador o en dispositivo fisico pero pesa demasiado la app instalada alrededor de 200mb y solo utiliso esa libreria y un viewcontroller se me hace demasiado tendras algua idea de por que pasa eso??
ResponderEliminarEste comentario ha sido eliminado por el autor.
ResponderEliminarTengo un problema al seleccionar el pago con tarjeta, me dice que la divisa no esta permitida con paypal, utilizo "MXN"
ResponderEliminar