Frameworks
Spring Boot — Scell.io integration
No Java SDK — HTTP fetch via WebClient or OkHttp
Scell.io does NOT publish an official Java SDK. In Spring Boot, integrate via `WebClient` (reactive, recommended) or `RestClient` (synchronous, Spring 6.1+). Wrap in a `@Service` with `@Value("${scell.api.key}")` config. `X-API-Key` header injected in the builder. Use `application.yml` for config.
Key facts
- No official Java SDK — `WebClient` or `RestClient`
- Configuration via `application.yml` + `@Value`
- Spring `@Service` autowired into controllers
- Compatible with Spring Boot 3.x, JDK 17+
- For reactive: `Mono<Invoice>` returned
Code example
@Service
public class ScellService {
private final WebClient client;
public ScellService(@Value("${scell.api.key}") String apiKey) {
this.client = WebClient.builder()
.baseUrl("https://api.scell.io/api/v1")
.defaultHeader("X-API-Key", apiKey)
.build();
}
public Mono<Map> createInvoice(String buyer, double amount) {
Map<String, Object> body = Map.of(
"format", "factur-x",
"buyer", Map.of("name", buyer, "is_individual", true),
"lines", List.of(Map.of("description", "Service", "quantity", 1, "unit_price", amount, "vat_rate", 20.0))
);
return client.post().uri("/invoices").bodyValue(body).retrieve().bodyToMono(Map.class);
}
}