Java SDK
Installation
The SDK is published to Maven Central. Add this dependency to your project's build file:
- Gradle
- Maven
build.gradle
dependencies {
implementation 'com.basistheory:api-client:[version]'
}
pom.xml
<dependency>
<groupId>com.basistheory</groupId>
<artifactId>api-client</artifactId>
<version>[version]</version>
</dependency>
The latest release version can be found on Maven Central.
Initialization
Environment values:
TEST, US, EUimport 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());