The Judopay Android library lets you integrate secure in-app card payments into your Android app.
Use our UI components for a seamless user experience for card data capture. Minimise your PCI scope with a UI that can be themed or customised to match the look and feel of your app.
Android Pay has launched in the UK. You can use this SDK to process Android Pay. For more information, please have a look at our sample app.
***Due to industry-wide security updates, versions below 5.0 of this SDK will no longer be supported after 1st Oct 2016. For more information regarding these updates, please read our blog here.***
Please ensure the following requirements are met when integrating the SDK:
- Android Studio 2.3+ is installed
- Android SDK build tools 25.0.2 is installed
- The minimum SDK level of your app is Android Jelly Bean (API level 16) or higher
- Android Support Repository and Android Support Library have the latest version installed.
Installation of the Judopay Android SDK is simple using Android Studio, you don't need to clone a repository, just add the dependency to your app/build.gradle
file:
compile 'com.judopay:android-sdk:5.6.10'
In your project-level build.gradle file you will need to add the Judopay Maven repository:
allprojects {
repositories {
jcenter()
maven {
url "http://dl.bintray.com/judopay/maven"
}
}
}
At the point where you want to perform a payment or capture the user's card details, initialize the SDK with your account credentials from the Judopay portal:
Judo judo = new Judo.Builder()
.setApiToken("<TOKEN>")
.setApiSecret("<SECRET>")
.setEnvironment(Judo.SANDBOX)
.setJudoId("<JUDO_ID>")
.setAmount("1.00")
.setCurrency(Currency.GBP)
.setConsumerReference("<YOUR_REFERENCE>")
.build();
Note: Please ensure that you are using a unique consumer reference for each consumer of your app.
To show the payment screen, create an Intent for the PaymentActivity
with the Judo
instance:
Intent intent = new Intent(this, PaymentActivity.class);
intent.putExtra(Judo.JUDO_OPTIONS, judo);
startActivityForResult(intent, Judo.PAYMENT_REQUEST);
In the Activity that calls the Judopay SDK, override the onActivityResult
method to receive the payment receipt:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == Judo.PAYMENT_REQUEST) {
switch (resultCode) {
case Judo.RESULT_SUCCESS:
Receipt receipt = data.getParcelableExtra(Judo.JUDO_RECEIPT);
// success
}
}
}
The Judopay Android SDK supports a range of customization options. For more information see our wiki documentation.
See the LICENSE file for license rights and limitations (MIT).