Skip to main content

Java SDK

Java SDK

java-sdk

Installation​

The SDK is published to Maven Central. Add this dependency to your project's build file:

build.gradle
dependencies {
implementation 'com.basistheory:api-client:[version]'
}

The latest release version can be found on Maven Central.

Initialization​

Environment values: DEFAULT (api.basistheory.com), US (api.us.basistheory.com), EU (api.eu.basistheory.com), TEST (api.test.basistheory.com). Omitting environment uses DEFAULT. See Regional Endpoints.
import com.basistheory.BasisTheoryApiClient;
import com.basistheory.resources.tokens.requests.CreateTokenRequest;
import com.basistheory.types.Token;

BasisTheoryApiClient client = BasisTheoryApiClient
.builder()
.environment(Environment.TEST)
.apiKey("<API_KEY>")
.build();

Token token = client.tokens().create(CreateTokenRequest.builder()
.type("token")
.data("sensitive-data")
.build());