Skip to main content

Java SDK

Java SDK

java-sdk

Installation

Add this dependency to your project's build file:

repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/Basis-Theory/java-sdk")
credentials {
// Review this link for more details on authentication
// https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages#authenticating-to-github-packages
username = 'GITHUB USERNAME'
password = 'GITHUB PERSONAL ACCESS TOKEN (classic)'
}
}
}

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

The latest release version can be found in GitHub.

Initialization

import com.basistheory.BasisTheoryApiClient;
import com.basistheory.resources.tokens.requests.CreateTokenRequest;
import com.basistheory.types.Token;

BasisTheoryApiClient client = BasisTheoryApiClient
.builder()
.url("https://api.basistheory.com")
.apiKey("<API_KEY>")
.build();

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