Xamarin based Cross-Platform client API for the Openpay platform.
- iOS 10+
- Android
- .NET Standard 2.0
- Available on NuGet: https://www.nuget.org/packages/Openpay.Xamarin
- Install into your .NET Standard/PCL project and Client projects.
In your App.xaml.cs call
private const string MerchantId = "mi93pk0cjumoraf08tqt";
private const string ApiKey = "pk_92e31f7c77424179b7cd451d21fbb771";
protected override OnStart()
{
base.OnStart();
// Initialize Openpay
if (CrossOpenpay.IsSupported)
{
CrossOpenpay.Current.Initialize(MerchantId, ApiKey, false);
}
}
Nothing is necessary
In your Android MainActivity.cs call
global::Xamarin.Forms.Init(); // Platform specific init
global::Openpay.Xamarin.OpenpayAndroidImpl.Init(this);
LoadApplication(new App());
Use from your shared project.
To create a token simply call CreateTokenFromCard:
if (CrossOpenpay.IsSupported)
{
Card card = new Card
{
HolderName = "Francisco Pantera",
Number = "4111111111111111",
ExpirationMonth = "12",
ExpirationYear = "21",
Cvv2 = 132
};
var token = await CrossOpenpay.Current.CreateTokenFromCard(card);
}
To create a token simply call CreateDeviceSessionId:
if (CrossOpenpay.IsSupported)
{
var deviceSessionId = await CrossOpenpay.Current.CreateDeviceSessionId();
}
The MIT License (MIT) see License file
Openpay.Xamarin is not supported by Openpay. For official client libraries see: