Java lightweight client library for Incognia APIs.
Incognia API Java Client is available on Maven Central.
<dependency>
<groupId>com.incognia</groupId>
<artifactId>incognia-api-client</artifactId>
<version>1.1.0</version>
</dependency>
implementation 'com.incognia:incognia-api-client:1.1.0'
We support Java 8+.
Before calling the API methods, you need to create an instance of the IncogniaAPI
class.
// to use the BR region
IncogniaAPI api = new IncogniaAPI("your-client-id", "your-client-secret", Region.BR);
// to use the US region
IncogniaAPI api = new IncogniaAPI("your-client-id", "your-client-secret", Region.US);
The implementation is based on the Incognia API Reference.
Authentication is done transparently, so you don't need to worry about it.
This method registers a new signup for the given installation and address, returning a SignupAssessment
, containing the risk assessment and supporting evidence:
IncogniaAPI api = new IncogniaAPI("client-id", "client-secret", Region.BR);
try {
Address address = Address address =
Address.builder()
.structuredAddress(
StructuredAddress.builder()
.countryCode("US")
.countryName("United States of America")
.locale("en-US")
.state("NY")
.city("New York City")
.borough("Manhattan")
.neighborhood("Midtown")
.street("W 34th St.")
.number("20")
.complements("Floor 2")
.postalCode("10001")
.build())
.coordinates(new Coordinates(40.74836007062138, -73.98509720487937))
.build();
SignupAssessment assessment = api.registerSignup("installation id", address);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
This method allows you to query the latest assessment for a given signup event, returning a SignupAssessment
, containing the risk assessment and supporting evidence:
IncogniaAPI api = new IncogniaAPI("client-id", "client-secret", Region.BR);
try {
UUID signupId = UUID.fromString("c9ac2803-c868-4b7a-8323-8a6b96298ebe");
SignupAssessment assessment = api.getSignupAssessment(signupId);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
This method registers a new login for the given installation and account, returning a TransactionAssessment
, containing the risk assessment and supporting evidence.
This method also includes some overloads that do not require optional parameters, like externalId
.
IncogniaAPI api = new IncogniaAPI("client-id", "client-secret", Region.BR);
try {
TransactionAssessment assessment = api.registerLogin("installation-id", "account-id", "external-id");
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
This method registers a new payment for the given installation and account, returning a TransactionAssessment
, containing the risk assessment and supporting evidence.
This method also includes some overloads that do not require optional parameters, like externalId
and addresses
.
IncogniaAPI api = new IncogniaAPI("client-id", "client-secret", Region.BR);
try {
Address address = Address address =
Address.builder()
.structuredAddress(
StructuredAddress.builder()
.countryCode("US")
.countryName("United States of America")
.locale("en-US")
.state("NY")
.city("New York City")
.borough("Manhattan")
.neighborhood("Midtown")
.street("W 34th St.")
.number("20")
.complements("Floor 2")
.postalCode("10001")
.build())
.coordinates(new Coordinates(40.74836007062138, -73.98509720487937))
.build();
Map<AddressType, Address> addresses = Map.of(
AddressType.SHIPPING, address
AddressType.BILLING, address);
TransactionAssessment assessment = api.registerPayment("installation-id", "account-id", "external-id");
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
This method registers a feedback event for the given identifiers (represented in FeedbackIdentifiers
) related to a signup, login or payment.
IncogniaAPI api = new IncogniaAPI("client-id", "client-secret", Region.BR);
try {
Instant timestamp = Instant.now();
client.registerFeedback(
FeedbackEvent.ACCOUNT_TAKEOVER,
timestamp,
FeedbackIdentifiers.builder()
.installationId("installation-id")
.accountId("account-id")
.externalId("external-id")
.signupId("c9ac2803-c868-4b7a-8323-8a6b96298ebe")
.build();
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
Every assessment response (TransactionAssessment
and SignupAssessment
) includes supporting evidence in a generic Map<String, Object>
.
You can find all available evidence here.
Every method call can throw IncogniaAPIException
and IncogniaException
.
IncogniaAPIException
is thrown when the API returned an unexpected http status code. You can retrieve it by calling the getStatusCode
method in the exception,
along with the getPayload
method, which returns the api response payload, which might include additional details.
IncogniaException
represents unknown errors, like serialization/deserialization errors.
If you have found a bug or if you have a feature request, please report them at this repository issues section.
We use the Gradle Nexus publish plugin to publish artifacts to maven central.
To publish a new version to a staging repository, run:
./gradlew publishToSonatype closeSonatypeStagingRepository
If the version ends with -SNAPSHOT
, it is published to the Sonatype snapshots repository.
Incognia is a location identity platform for mobile apps that enables:
- Real-time address verification for onboarding
- Frictionless authentication
- Real-time transaction verification
- Go to Incognia and click on "Sign Up For Free"
- Create an Account
- You're ready to integrate Incognia SDK and use Incognia APIs