klarna-on-demand v1.0.3
Klarna on Demand
Klarna on-demand allows you to integrate Klarna's payment solution in applications 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 Javascript SDK, as well as a sample application utilizing the SDK. While the SDK is mostly aimed at hybrid phone apps, it can be utilized in any environment where Javascript is available.
While not necessary, the simplest way to get going with both the sample application and the SDK is to use NPM and so all the following instructions will focus on that approach. For an alternative approach, see the official documentation (coming soon).
Using the SDK
Have a look at the integration guide for full details on how to use our SDK in your application.
Running the sample application
Prerequisites
The easiest way to run the application is to download the SDK's NPM module. To that end, simply install npm by following this guide. Once installed, pick a directory where you would like to install the package and run:
npm install klarna-on-demand
Running the application
In the directory where you've installed the package, simply run:
open node_modules/klarna-on-demand/example/index.html
or on Windows:
start node_modules/klarna-on-demand/example/index.html
Note: While this 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.
Contributing
You'd like to help us out? That's great! Here's what you need to do in order to contribute.
Prerequisites
As per running the application.
Setup
- Fork the project and clone your repository
- In the project folder, run
npm install
- Fire up your favorite editor and produce marvels!
Building
The SDK's codebase is in coffeescript. To turn it into javascript so that you can try it out in a browser simply run the following in the project folder:
gulp build
This will place the compiled SDK in a newly created ./lib/ folder, with all intermediary javascript available under the ./build/ folder.
You can also simply run:
gulp
which will launch a browser hosting the test application and live-watch for any changes in the code.
Tests
Pull requests must include tests for their proposed fixes/functionality. We use Jasmine to write our tests and you can find the tests themselves here.
Running the tests
From the project folder, simply run:
gulp watch-specs
to continuously run the tests as you code.
License
Klarna on Demand is available under the Apache 2.0 license. See the LICENSE file for more info.