Java
Official server-side SDK (com.wajub:wajub-java) for Java 17+ — payments, payouts, webhooks, and the full merchant API.
Java is Wajub's official server-side SDK for Spring Boot, Jakarta EE, and any Java 17+ backend. It is published as com.wajub:wajub-java on Maven Central.
Use it with your API key (pk_… / sk_… / rk_…, including test variants). Pair it with @wajub/js in the browser.
Browser vs server
@wajub/js runs in the browser with publishable keys.
wajub-java runs on the server — pass any merchant API key
(pk., sk., rk.) and use webhook verification for inbound
events. Never expose sk. keys to the client.
Install
Maven:
<dependency>
<groupId>com.wajub</groupId>
<artifactId>wajub-java</artifactId>
<version>1.1.0</version>
</dependency>Gradle:
implementation("com.wajub:wajub-java:1.1.0")Requires Java 17+, OkHttp 4.12+, and Jackson 2.18+ (pulled in automatically).
Quick start
import com.wajub.Wajub;
import com.wajub.Payment;
Wajub client = Wajub.create(System.getenv("WAJUB_SECRET_KEY"));
Payment payment = client.payments().create(java.util.Map.of(
"amount", 15000,
"currency", "XAF",
"email", "buyer@example.com",
"callback", "https://shop.example.com/order/complete"
), null);
System.out.println(payment.getAuthorizationUrl());Configuration
| Option | Description |
|---|---|
apiKey | Merchant API key (pk.… / sk.… / rk.…, test or live) |
webhookSecret | Signing secret (whsec_…) for webhooks().constructEvent() |
idempotencyKeyPrefix | Prefix for auto-generated Idempotency-Key headers |
httpClient | Custom OkHttp client (timeouts, interceptors) |
The API base URL is fixed at https://api.wajub.com. Test mode is selected by your API key (sk_test.…), not by the URL.
Pass configuration explicitly via Wajub.Config.builder():
Wajub client = Wajub.create(Wajub.Config.builder()
.apiKey(System.getenv("WAJUB_API_KEY"))
.webhookSecret(System.getenv("WAJUB_WEBHOOK_SECRET"))
.build());Resources
| Service | Methods |
|---|---|
client.global() | ping, channels, countries, currencies |
client.payments() | create, initialize, retrieve, list, cancel, process, processSplit, listRefunds |
client.customers() | CRUD + block, unblock, activate, deactivate, tax IDs |
client.refunds() | CRUD + list |
client.transfers() | CRUD + list |
client.beneficiaries() | CRUD + list |
client.links() | CRUD + list |
client.invoices() | CRUD + send, markPaid, cancel |
client.accounts() | CRUD + regenerateToken |
client.webhookEndpoints() | CRUD + rotateSecret |
client.balance() | retrieve |
client.events() | list, retrieve, resend |
client.disputes() | list, retrieve, submitEvidence, accept, close, sendMessage |
client.identity() | resolve, validate |
client.tax() | settings, rates, calculate, reports, codes, registrations |
client.shield() | settings, stats, blocklist |
client.listen() | config, auth |
client.webhooks() | constructEvent |
Webhooks (Spring Boot / Jakarta)
import java.util.Map;
Map<String, Object> event = client.webhooks().constructEvent(
body,
request.getHeader("X-Wajub-Signature"),
request.getHeader("X-Wajub-Timestamp"),
null
);
// Handle payment.succeeded, transfer.succeeded, etc.Sync (Connect)
import com.wajub.RequestOptions;
client.payments().create(params, new RequestOptions().setSync("acct_sync_ref"));Was this page helpful?