Tab POC - Xamarin

Prerequisites:

  • You have set up your Judopay account.

  • You have the latest version of the Android SDK. For more details, see Integrating Android with Judopay.

  • You have the latest version of the iOS SDK. For more details, see Integrating iOS with Judopay.

 

Integrating with Judopay

For Mobile apps, it is recommended not to make a transaction from the app, as the Token and Secret could become compromised
.Use the server to make the transaction.
Create a Register Card app and enable the Register Card Transactions permission.

For examples on how to integrate the SDK, see our sample app for more information.

 

Integration Requirements:

  • Xamarin Studio 6.1 / Visual Studio 2015

  • Xamarin Forms 2.3.2.127

  • Xcode 8

  • Android 7.0 (API 24) SDK and build tools 24.0.3 installed

  • The SDK is compatible with Android Jelly Bean (4.1) and above and iOS 8 and above.

 

Integrate Judopay into your project by visiting the Xamarin component store:

  1. Search for Judopay

  2. Add the component to your Android and iOS projects

 

Setting up Xamarin

  1. Ensure all integration steps are completed.

  2. Add your app’s sandbox token and secret to your Judo instance in your Xamarin Forms page:

var judo = new Judo
{
    JudoId = "<JUDO_ID>",
    Token = "<API_TOKEN>",
    Secret = "<API_SECRET>",
    Environment = JudoEnvironment.Sandbox,
    Amount = 1.50m,
    Currency = "GBP",
    ConsumerReference = "YourUniqueReference"
};
  1. Add additional configuration depending on the project you are integrating, as follows:

Android

Due to a bug in Xamarin.Forms the page does not resize correctly when the keyboard is visible.

An additional piece of code must be added to your Android Activity:

  1. Add the code snippet after the Xamarin.Forms.Forms.Init method call inside the OnCreate method of your Activity:

Window.SetSoftInputMode(SoftInput.AdjustResize);
AndroidBugfix5497.assistActivity(this);

 

iOS

Xamarin.Forms has issues resolving dependencies using DependencyService unless they have been registered.

 

  1. Add the following in your AppDelegate.cs after the LoadApplication(new App()) method call in your FinishedLaunching method:

DependencyService.Register<ClientService>();
DependencyService.Register<HttpClientHelper>();
// Required if using Apple Pay
DependencyService.Register<ApplePayService>();

 

Going Live with Xamarin

You will need to have tested your app in the sandbox environment before going live.

 

Point to the Live Environment

  1. Within your app’s Xamarin Forms page change the line specifying the targeted environment from SANDBOX to LIVE:

    Environment = JudoEnvironment.Live,

  2. Replace your sandbox API Token and Secret for the live API Token and Secret 

    ApiToken = "<API_TOKEN>",

    ApiSecret = "<API_SECRET>",

 

Find these in JudopayPortal > Your apps > {app name} > Live Tokens

Use the live environment for testing before deploying your app.