Xamarin
Prerequisites
You have set up your Judopay account.
You have the latest version of the Android SDK. For more details, see Android Integration with Judopay.
You have the latest version of the iOS SDK. For more details, see iOS Integration with Judopay.
Xamarin Integration with Judopay
Tip
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:
Search for Judopay
Add the component to your Android and iOS projects
![]() |
Setting Up Xamarin
Ensure all integration steps are completed.
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" };
Add additional configuration depending on the project you are integrating:
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.
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.
Add this 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
Within your app’s Xamarin Forms page change the line specifying the targeted environment from SANDBOX to LIVE:
Environment = JudoEnvironment.Live,
Replace your sandbox API Token and Secret for the live API Token and Secret
ApiToken = "<API_TOKEN>", ApiSecret = "<API_SECRET>",
Find these in Judopay Portal > Your apps > {app name} > Live Tokens
Note
Use the live environment for testing before deploying your app.