Java SDK for Portugal
corp-merch-java on Maven Central — JDK 17+, async via CompletableFuture, Spring Boot starter for Portugal.
Architecture — Install and initialise for Portugal
Maven: <dependency><groupId>com.corpmerch</groupId><artifactId>corp-merch-java</artifactId><version>2.x</version></dependency>. Init: CorpMerch cm = CorpMerch.builder().apiKey(System.getenv("CM_KEY")).country("Portugal").build();. Routes through the Lisbon hub; IVA 23% computed server-side. JDK 17+, no Kotlin or Scala dependency.
How to wire it up — Quickstart with CompletableFuture
Sync: Order o = cm.orders().create(OrderCreateParams.builder().idempotencyKey(UUID.randomUUID().toString())...build());. Async: cm.orders().createAsync(params).thenAccept(o -> log.info("id={}", o.id()));. All POJOs immutable; Jackson @JsonInclude(NON_NULL). Errors as typed exceptions extending CorpMerchException.
Operations and edge cases — Spring Boot starter
corp-merch-spring-boot-starter registers CorpMerch as a bean configured from application.yml: corp-merch.api-key, corp-merch.country: Portugal. Webhook controller auto-registered at /webhooks/corpmerch with HMAC verification. Actuator health indicator exposes AT channel status. Portal das Finanças (AT) acknowledgement ids surfaced on invoice events.
FAQ
JDK versions?
JDK 17 and 21 in CI. JDK 11 works in offline mode but is not officially supported.
Kotlin / Scala?
Pure Java — usable from Kotlin and Scala. Idiomatic Kotlin extension functions ship in a companion module.
Reactor / RxJava?
Adapter modules ship for Project Reactor (Mono/Flux) and RxJava 3 (Single/Observable).
Spring Boot 3?
Yes — the starter supports Spring Boot 3.x. Spring Boot 2.7 supported on the legacy 1.x SDK.
IVA 23% and AT?
country: 'Portugal' applies IVA 23% and routes invoicing via AT. Actuator health indicator exposes AT channel availability.