Java client
Request signing, a replaceable transport, typed checkout and payout operations, result classification, webhook verification and log redaction. Java 17 or later, with one runtime dependency: Jackson databind.
Repository: selcom-developers/selcom4j
Install
Available through JitPack . Add the repository, then the dependency.
Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.selcom-developers</groupId>
<artifactId>selcom4j</artifactId>
<version>v0.1.2</version>
</dependency>Gradle (Kotlin DSL):
repositories {
mavenCentral()
maven("https://jitpack.io")
}
dependencies {
implementation("com.github.selcom-developers:selcom4j:v0.1.2")
}Quickstart
Create an order, send the buyer to the hosted payment page, and confirm the result with order status.
import io.github.selcomdevelopers.selcom.*;
import io.github.selcomdevelopers.selcom.api.*;
import io.github.selcomdevelopers.selcom.result.*;
SelcomConfig config = SelcomConfig.builder()
.environment(Environment.SANDBOX) // required, no default
.credentials(System.getenv("SELCOM_API_KEY"), System.getenv("SELCOM_API_SECRET"))
.vendor(System.getenv("SELCOM_VENDOR"))
.pin(System.getenv("SELCOM_PIN")) // only needed for payouts
.build();
SelcomClient client = SelcomClient.create(config);
// 1. Create an order and send the buyer to the hosted page.
Result<Responses.OrderCreated> order = client.createOrder(CreateOrderRequest.builder()
.orderId("ORD-1001")
.buyerEmail("test.buyer@example.com")
.buyerName("Test Buyer")
.buyerPhone("255700000001")
.amount(Money.tzs(8000))
.paymentMethods(PaymentMethod.ALL)
.webhookUrl("https://shop.example.com/selcom/webhook/9f1c2e") // plain URL; base64-encoded for you
.billing(new Address("Test", "Buyer", "1 Test Street", null, "Dar es Salaam", "Dar es Salaam", "11101", "TZ", "255700000001"))
.noOfItems(1)
.build());
if (order.status() == Status.SUCCESS) {
String payUrl = order.first().orElseThrow().paymentGatewayUrl(); // decoded for you; the raw base64 is kept too
}
// 2. Later, confirm. Order status is the source of truth, never a webhook.
Result<Responses.OrderStatusData> status = client.orderStatus(new Requests.OrderStatus("ORD-1001"));The environment is required and has no default. Every method returns a Result with one of the typed statuses: SUCCESS, PENDING, AMBIGUOUS, FAILED or NOT_FOUND.
The README covers configuration, every operation, error handling, idempotency, webhooks and using each layer on its own.
How it behaves
The client follows the shared spec. These pages explain what it does:
Help and issues
Found a problem, or want to help? Open an issue in the repository , or read Contributing. For security problems, see Security reporting.