Openpay.Xamarin

Openpay (https://openpay.mx) client API built for Xamarin. Ensure you have proper permissions set by reading the README.


Keywords
xamarin, pcl, xam.pcl, openpay, xamarin.android, xamarin.ios, android, xamarin.forms, ios, credit, card, xamarin-android, xamarin-forms, xamarin-ios
License
MIT
Install
Install-Package Openpay.Xamarin -Version 1.0.25.3

Documentation

Openpay Client API built for Xamarin

Xamarin based Cross-Platform client API for the Openpay platform.

NuGet: NuGet

Build Status: Build Status

Supported Platforms

  • iOS 10+
  • Android
  • .NET Standard 2.0

Setup

Initialize

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);
    }
}

iOS

Nothing is necessary

Android

In your Android MainActivity.cs call

global::Xamarin.Forms.Init(); // Platform specific init
global::Openpay.Xamarin.OpenpayAndroidImpl.Init(this);

LoadApplication(new App());

Usage

Use from your shared project.

Creating tokens

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);
}

Fraud detection using device data

To create a token simply call CreateDeviceSessionId:

if (CrossOpenpay.IsSupported)
{
    var deviceSessionId = await CrossOpenpay.Current.CreateDeviceSessionId();
}

License

The MIT License (MIT) see License file

Disclaimer

Openpay.Xamarin is not supported by Openpay. For official client libraries see: