Klarna on-demand allows you to integrate Klarna's payment solution in mobile apps that offer on demand services. It's a perfect fit for apps selling concert tickets, taxi rides, food pick-ups, etc.
This project contains Klarna's on-demand payment solution SDK for Android 4+, as well as a sample application utilizing the SDK.
Note: This project is still a work in progress, and as such the documentation may be behind (or ahead) what is currently implemented.
While not necessary, the simplest way to get going with both the sample application and the SDK is to use Gradle and so all the following instructions will focus on that approach. For an alternative approach, see the official documentation (coming soon).
Have a look at the integration guide for full details on how to use our SDK in your application.
For a short overview of the recent changes, please check out the project's changelog.
To run the application, you must first compile it. To that end, you will require the following:
- The Java Runtime Environment (or the Java Development Kit, also through the link)
- The Android SDK
- Android SDK packages
Simply clone the project repository and follow these steps:
- Open a terminal and navigate to the repository.
- Connect an android device to run the application on (see below).
- Type
./gradlew installDebug
into your terminal (if you work on Windows, typegradlew.bat installDebug
). - The application is now installed on all connected devices. Run it.
While the instructions above will get the application up and running, you will not be able to successfully perform purchases without a backend for the application to interact with. You should go here and follow the instructions provided to get a sample backend running on your local machine.
Since the sample application expects the server to be running on the same "machine", you will not be able to see a fully functional application running on a physical device. We recommend running the sample application on an emulator, such as Genymotion.
There are quite a few things that could break along the way and prevent you from successfully running the application. Gradle will usually output very helpful error messages, but do let us know if you have an issue and we will do our best to help.
You'd like to help us out? That's great! Here's what you need to do in order to contribute.
As per running the application.
- Fork the project and clone your repository
- Import the project into a Gradle-friendly work environment such as Android Studio or Eclipse with Gradle tooling support
Note! When using Android Studio, please make sure its version is 1.0 and JDK's version is lower or equal to 1.7. - Get busy!
Pull requests must include tests for their proposed fixes/functionality. We use JUnit to write our tests and you can find the tests themselves here.
Use the following guide in order to setup a JUnit4 testing environment.
Klarna on Demand is available under the Apache 2.0 license. See the LICENSE file for more info.