# Java: payment risk example

Observe a JDK HTTP service and record a synthetic payment-risk assessment.

## 1. Install the Maven dependency

Add the portal-supplied Maven repository to your approved dependency process. The core SDK supports Java 8+. This example builds with Java 11 and requires neither Servlet nor Spring.

~~~xml
<dependency>
  <groupId>io.sigillum</groupId>
  <artifactId>finans-sdk</artifactId>
  <version>0.11.0</version>
</dependency>
~~~

## 2. Start the SDK and wrap HTTP

Create one SDK per service using Sigillum.start(absolutePath). Wrap a JDK HttpServer handler with sigillum.httpHandler(nativeHandler). Use httpConnection for Java 8 outbound connections or httpClient for Java 11+. Unsupported third-party clients are not automatically observed.

## 3. Record payment-risk assessment

The **POST /payments/assess** example accepts an amount and a request reference. The local assessment runs in a child scope. Explicit calls record the applied policy, explanation, business result and original source attachment. Additional AI categories are demonstrated separately in the AI observation examples. No payment is executed.

## 4. Add data and attachments

Use convenience calls such as sigillum.ai("model", modelJson). The general interface is capture(context, family, kind, schema, rawJson, contents...). CaptureContent(id, mediaType, purpose, bytes) carries original content. SpanLink must refer to an actual trace/span relationship.

## 5. Propagate callback context

wrap(Runnable) and wrap(Callable) carry context across an actual executor boundary. activate(context) restores the previous context when the scope closes. Do not merge independent work because it shares a customer reference. The SDK does not replace the application’s global OTEL provider.

## 6. Run the project

Follow the ZIP README to install the supplied Maven artifacts, set SIGILLUM_CONFIG to the absolute configuration path and start the application. For Servlet applications, use the [Servlet adapters](https://www.sigillum.cloud/developers/sdk/servlet/) guide.