Clone wiki

Xam.Paypal.Droid / Home

Xamarin Android PayPal binding library

This is a Xamarin.Android binding library for Paypal SDK.
Last version is available on NuGet: Xam.PayPal.Droid

Please see PayPalSdk for Android onGitHub for SDK documentation.

A simple tutorial can be found on

Quick startup

  1. Add Nuget Package (package will add necessary references)
  2. Set Java Heap Size to 1G
  3. In application node if your Manifest add:

    <service android:name="" android:exported="false" />
    <activity android:name="" />

You are ready to go!

Example of activity

    [Activity(Label = "xam.paypal.test", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
  private PayPalConfiguration config = new PayPalConfiguration()
      .ClientId("YOUR CLIENT ID HERE");

protected override void OnCreate(Bundle savedInstanceState)

    // Set our view from the "main" layout resource

    // Get our button from the layout resource,
    // and attach an event to it
    Button button = FindViewById<Button>(Resource.Id.myButton);
    button.Click += this.ButtonOnClick;

    // start paypal service
    var intent = new Intent(this, typeof(PayPalService));
    intent.PutExtra(PayPalService.ExtraPaypalConfiguration, config);

private void ButtonOnClick(object sender, EventArgs eventArgs)
    var payment = new PayPalPayment(new BigDecimal("2.45"), "USD", "the item",

    var intent = new Intent(this, typeof(PaymentActivity));
    intent.PutExtra(PayPalService.ExtraPaypalConfiguration, config);
    intent.PutExtra(PaymentActivity.ExtraPayment, payment);

    this.StartActivityForResult(intent, 0);

protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    if (resultCode == Result.Ok)
        var confirm = data.GetParcelableExtra(PaymentActivity.ExtraResultConfirmation);
        if (confirm != null)
                Log.Info("xam.paypal.test", confirm.ToString());

                // TODO: send 'confirm' to your server for verification.
                // see
                // for more details.

            catch (JSONException e)
                Log.Error("xam.paypal.test", "something wen really wrong here: ", e);
    else if (resultCode == Result.Canceled)
        Log.Info("xam.paypal.test", "Canceled.");
    else if ((int)resultCode == PaymentActivity.ResultExtrasInvalid)
        Log.Info("xam.paypal.test", "Invalid Payment or PayPalConfiguration.");

protected override void OnDestroy()
    this.StopService(new Intent(this, typeof(PayPalService)));


Note about versioning

Master branch contains the last published version on Nuget and has every previous version tagged. The version is based on PayPal sdk version:

  • First three number are PayPalSdk version.
  • Fourth number is for binding library revision.

Have fun!

Follow Me