Skip to content

juanroman/openpay-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages