Java SDK
Installation
Add this dependency to your project's build file:
- Gradle
- Maven
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]'
}
pom.xml
<project>
<repositories>
<repository>
<id>basistheory</id>
<url>https://maven.pkg.github.com/Basis-Theory/java-sdk</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.basistheory</groupId>
<artifactId>api-client</artifactId>
<version>[version]</version>
</dependency>
</dependencies>
</project>
settings.xml
<settings>
<servers>
<server>
<id>basistheory</id>
<!-- 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]</username>
<password>[GITHUB PERSONAL ACCESS TOKEN (classic)]</password>
</server>
</servers>
</settings>
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());