The official Java library for the UniBee Billing API. It provides a simple way to integrate subscriptions, invoices, payments, users, plans, and more into your Java application.
- API reference — UniBee API overview and dashboard
Add the dependency to your pom.xml:
<dependency>
<groupId>com.unibee</groupId>
<artifactId>unibee-java-client</artifactId>
<version>1.0.0</version>
</dependency>implementation 'com.unibee:unibee-java-client:1.0.0'- Java 8+ (or Java 11+ recommended)
Configure the client with your merchant credentials (from the UniBee Dashboard).
The API key is sent using the Authorization header.
import com.unibee.ApiClient;
import com.unibee.Configuration;
import com.unibee.api.*;
// Default host is https://api.unibee.top
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.unibee.top");
defaultClient.setApiKey("Authorization", "your_merchant_api_key");List subscriptions:
SubscriptionApi api = new SubscriptionApi();
var response = api.subscriptionListGet();
// response contains subscription listGet a single invoice:
InvoiceApi api = new InvoiceApi();
var invoice = api.invoiceDetailGet(invoiceId);List plans:
PlanApi api = new PlanApi();
var plans = api.planListGet();Create a checkout session:
CheckoutSetupApi api = new CheckoutSetupApi();
UnibeeApiMerchantCheckoutSetupReq req = new UnibeeApiMerchantCheckoutSetupReq()
.planId(planId)
.userId(userId)
.successUrl("https://yoursite.com/success")
.cancelUrl("https://yoursite.com/cancel");
var result = api.checkoutSetupPost(req);Use a dedicated client for a different API key or host:
ApiClient client = new ApiClient();
client.setBasePath("https://api.unibee.top");
client.setApiKey("Authorization", "another_key");
MerchantApi api = new MerchantApi(client);
var merchant = api.merchantDetailGet();try {
InvoiceApi invoiceApi = new InvoiceApi();
invoiceApi.invoiceDetailGet(invoiceId);
} catch (ApiException e) {
System.err.println("HTTP status: " + e.getCode());
System.err.println("Response: " + e.getResponseBody());
}| Option | Description | Default |
|---|---|---|
basePath / host |
API base URL | https://api.unibee.top |
apiKey |
Auth header (e.g. Authorization) |
— |
connectTimeout |
Connect timeout (ms) | — |
readTimeout |
Read timeout (ms) | — |
ApiClient client = Configuration.getDefaultApiClient();
client.setBasePath("https://api.unibee.top");
client.setApiKey("Authorization", "Bearer your_key");
client.setDebugging(false);MIT. See LICENSE for details.