### Micronaut Configuration for IncogniaAPI
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Example of configuring IncogniaAPI as a singleton bean in a Micronaut application, injecting client ID and secret from properties.
```java
@Factory
public class IncogniaAPIFactory {
@Singleton
//change the @Value to your property name
public IncogniaAPI incogniaAPI(@Value("${incognia.client-id}") String clientId,
@Value("${incognia.client-secret}") String clientSecret) {
return IncogniaAPI.init(clientId, clientSecret);
}
}
```
--------------------------------
### Spring Boot Configuration for IncogniaAPI
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Example of configuring IncogniaAPI as a singleton bean in a Spring Boot application using property values for client ID and secret.
```java
@Configuration
public class IncogniaAPIConfig {
@Value("${incognia.client-id}")// change this to your property name
private String clientId;
@Value("${incognia.client-secret}") //change this to your property name
private String clientSecret;
@Bean
@Scope(value = ConfigurableBeanFactory.SCOPE_SINGLETON)
public IncogniaAPI incogniaAPI() {
return IncogniaAPI.init(clientId, clientSecret);
}
}
```
--------------------------------
### Get IncogniaAPI Instance
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Retrieves an existing IncogniaAPI instance. Use `instance()` for a single instance or `instance(clientId, clientSecret)` for specific instances.
```java
// For a single instance
IncogniaAPI api = IncogniaAPI.instance();
// For a specific instance
IncogniaAPI specificApi = IncogniaAPI.instance("your-client-id", "your-client-secret");
```
--------------------------------
### Gradle Repository Configuration
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Configures Gradle to use the Incognia Maven repository for dependency management.
```gradle
repositories {
maven {
url 'https://repo.incognia.com/java'
}
}
```
--------------------------------
### Register Signup with Address
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a new signup with address details. Requires Incognia API client initialization and constructs an Address object with structured address information and coordinates. Handles Incognia API exceptions and general exceptions.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
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();
RegisterSignupRequest signupRequest = RegisterSignupRequest.builder()
.address(address)
.requestToken("request token")
.build();
SignupAssessment assessment = api.registerSignup(signupRequest);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
```
--------------------------------
### Register Web Signup
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a new web signup using a request token. Requires Incognia API client initialization. Handles Incognia API exceptions and general exceptions.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
RegisterWebSignupRequest webSignupRequest = RegisterWebSignupRequest.builder()
.requestToken("request token")
.build();
SignupAssessment assessment = api.registerWebSignup(webSignupRequest);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
```
--------------------------------
### Initialize IncogniaAPI with Custom Options
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Initializes the IncogniaAPI client with custom configurations for timeout, keep-alive, and connection pooling. Defaults are used if not specified.
```java
IncogniaAPI api = IncogniaAPI.init(
"your-client-id",
"your-client-secret",
CustomOptions.builder()
.timeoutMillis(2000L)
.keepAliveSeconds(3000)
.maxConnections(5)
.build()
);
```
--------------------------------
### Maven Repository Configuration
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Adds the Incognia Maven repository to your project's pom.xml file to access the client library.
```xml
incognia
https://repo.incognia.com/java
```
--------------------------------
### Gradle Dependency for Incognia API Client
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Adds the Incognia API client as an implementation dependency in your Gradle project.
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client:3.8.0'
}
```
--------------------------------
### Incognia API Reference
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
The Java client library is based on the Incognia API Reference. Authentication is handled transparently by the `TokenAwareNetworkingClient`.
```APIDOC
Incognia API Reference:
https://dash.incognia.com/api-reference
Authentication:
- Handled transparently by the library.
- For details, refer to the `TokenAwareNetworkingClient` class.
```
--------------------------------
### Initialize IncogniaAPI with Client ID and Secret
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Initializes the IncogniaAPI client with your credentials. This instance handles token renewal automatically and should be reused.
```java
IncogniaAPI api = IncogniaAPI.init("your-client-id", "your-client-secret");
```
--------------------------------
### Maven Dependency for Incognia API Client (Shaded)
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Includes the shaded version of the Incognia API client, which bundles all dependencies, to avoid conflicts.
```xml
com.incognia
incognia-api-client-shaded
3.8.0
```
--------------------------------
### Gradle Dependency for Incognia API Client (Shaded)
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Adds the shaded version of the Incognia API client as an implementation dependency in your Gradle project.
```gradle
dependencies {
implementation 'com.incognia:incognia-api-client-shaded:3.8.0'
}
```
--------------------------------
### Register Signup without Address
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a new signup without providing address details. Requires Incognia API client initialization and a request token. Handles Incognia API exceptions and general exceptions.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
RegisterSignupRequest signupRequest = RegisterSignupRequest.builder()
.requestToken("request token")
.build();
SignupAssessment assessment = api.registerSignup(signupRequest);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
```
--------------------------------
### Maven Dependency for Incognia API Client
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Includes the standard Incognia API client as a dependency in your Maven project.
```xml
com.incognia
incognia-api-client
3.8.0
```
--------------------------------
### Register Login
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a new login with optional account ID, external ID, and custom properties. Requires Incognia API client initialization. The `evaluateTransaction` parameter defaults to true. Handles Incognia API exceptions and general exceptions.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
RegisterLoginRequest registerLoginRequest =
RegisterLoginRequest.builder()
.requestToken("request token")
.accountId("account id")
.externalId("external id")
.evaluateTransaction(true) // can be omitted as it uses true as the default value
.customProperties(Map.of(
"custom-property-key", "custom-property-value",
"custom-double-property-key", 1.0))
.build();
TransactionAssessment assessment = api.registerLogin(registerLoginRequest);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
```
--------------------------------
### Register Web Login
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a new web login with optional account ID and external ID. Requires Incognia API client initialization. The `evaluateTransaction` parameter defaults to true. Handles Incognia API exceptions and general exceptions.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
RegisterWebLoginRequest webLoginRequest =
RegisterWebLoginRequest.builder()
.accountId("account id")
.externalId("external id")
.requestToken("request-token")
.evaluateTransaction(true) // can be omitted as it uses true as the default value
.build();
TransactionAssessment assessment = api.registerWebLogin(webLoginRequest);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
```
--------------------------------
### Incognia API Exception Handling
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Details on how to handle exceptions thrown by the Incognia API. `IncogniaAPIException` provides details on API errors like unexpected status codes and payloads, while `IncogniaException` covers unknown errors such as serialization issues.
```APIDOC
IncogniaAPIException:
- Thrown when the API returns an unexpected HTTP status code.
- Methods:
- getStatusCode(): Retrieves the HTTP status code.
- getPayload(): Retrieves the API response payload, potentially containing more details.
IncogniaException:
- Represents unknown errors, such as serialization/deserialization failures.
Usage:
```java
try {
// API call
} catch (IncogniaAPIException e) {
// Handle API-specific errors
int statusCode = e.getStatusCode();
String payload = e.getPayload();
System.err.println("API Error: " + statusCode + ", Payload: " + payload);
} catch (IncogniaException e) {
// Handle other unexpected errors
System.err.println("Unexpected Error: " + e.getMessage());
}
```
--------------------------------
### Send Feedback
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a feedback event for a signup, login, or payment using provided identifiers and a timestamp. This method helps in tracking specific events related to user actions.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
Instant timestamp = Instant.now();
client.registerFeedback(
FeedbackEvent.ACCOUNT_TAKEOVER,
timestamp,
FeedbackIdentifiers.builder()
.requestToken("request-token")
.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
}
```
--------------------------------
### Register Payment
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a new payment for a given request token and account. It returns a TransactionAssessment containing the risk assessment and supporting evidence. Overloads are available for requests without optional parameters like externalId and addresses.
```java
IncogniaAPI api = IncogniaAPI.init("client-id", "client-secret");
try {
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 addresses = Map.of(
AddressType.SHIPPING, address,
AddressType.BILLING, address);
List paymentMethods = new ArrayList<>();
paymentMethods.add(
PaymentMethod.builder()
.creditCardInfo(
CardInfo.builder()
.bin("123456")
.expiryMonth("10")
.expiryYear("2028")
.lastFourDigits("4321")
.build())
.type(PaymentType.CREDIT_CARD)
.build());
RegisterPaymentRequest registerPaymentRequest =
RegisterPaymentRequest.builder()
.requestToken( "request-token")
.accountId("account-id")
.externalId("external-id")
.addresses(addresses)
.evaluateTransaction(true) // can be omitted as it uses true as the default value
.paymentValue(PaymentValue.builder().currency("BRL").amount(10.0).build())
.paymentMethods(paymentMethods)
.build();
TransactionAssessment assessment = api.registerPayment(registerPaymentRequest);
} catch (IncogniaAPIException e) {
//Some api error happened (invalid data, invalid credentials)
} catch (IncogniaException e) {
//Something unexpected happened
}
```
--------------------------------
### Register Login or Payment without Risk Assessment
Source: https://github.com/inloco/incognia-api-java/blob/master/README.md
Registers a login or payment without evaluating its risk assessment by setting `evaluateTransaction` to false. This results in an empty TransactionAssessment response and can prevent bias in risk assessment computations.
```java
RegisterLoginRequest registerLoginRequest =
RegisterLoginRequest.builder()
.requestToken("request token")
.accountId("account id")
.externalId("external id")
.evaluateTransaction(false)
.build();
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.