The wallee Java SDK allows an easy integration of the wallee payment hub into Java applications.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
.travis.yml
LICENSE
README.md
before_deploy.sh
build.gradle
codesigning.asc.enc
deploy.sh
gradlew
gradlew.bat
mvn_settings.xml
pom.xml
settings.gradle

README.md

Build Status Maven Central

wallee Java SDK

This project provides a SDK to simplify the usage of the wallee services.

Documentation

For detailed information about wallee API please see wallee documentation.

Getting Started

If you don't have an account with wallee you can singup here for free.

To start using wallee API you will first have to add a dependency to your project.

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>com.wallee</groupId>
    <artifactId>wallee-java-sdk</artifactId>
    <version>1.0.1</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.wallee:wallee-java-sdk:1.0.1"

Example

The following code snippet is simple example on how to use the wallee-java-sdk to create a transaction token.

package com.wallee.sdk.example;

import java.math.BigDecimal;
import java.util.Arrays;

import com.wallee.sdk.ApiClient;
import com.wallee.sdk.ApiException;
import com.wallee.sdk.model.LineItemCreate;
import com.wallee.sdk.model.LineItemType;
import com.wallee.sdk.model.Transaction;
import com.wallee.sdk.model.TransactionCreate;
import com.wallee.sdk.service.TransactionService;

public class WalleeExample {

    public static void main(String[] args) {

	// API Configuration.
	long spaceId = 405;
	long userId = 512;
	String secret = "FKrO76r5VwJtBrqZawBspljbBNOxp5veKQQkOnZxucQ=";
	ApiClient apiClient = new ApiClient(userId, secret);

	// Create API service instance.
	TransactionService transactionService = new TransactionService(apiClient);

	// Create transaction.
	LineItemCreate lineItem = new LineItemCreate();
	lineItem.setType(LineItemType.PRODUCT);
	lineItem.setAmountIncludingTax(new BigDecimal(23.78));
	lineItem.setQuantity(BigDecimal.ONE);
	lineItem.setName("Red T-Shirt");
	lineItem.setSku("red-t-shirt-4");
	lineItem.setUniqueId("4216");

	TransactionCreate transactionCreate = new TransactionCreate();
	transactionCreate.setLineItems(Arrays.asList(lineItem));
	transactionCreate.setAutoConfirmationEnabled(true);
	transactionCreate.setCurrency("EUR");

	try {
	    // Send create transaction request.
	    Transaction transaction = transactionService.create(spaceId, transactionCreate);

	    // Build payment URL.
	    String redirectionUrl = transactionService.buildPaymentPageUrl(spaceId, transaction.getId());
	    System.out.println("Payment URL: " + redirectionUrl);

	} catch (ApiException e) {
	    throw new RuntimeException("Failed to create transaction.", e);
	}
    }
}

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.