API Java Library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Simple Litego API wrapper class, in Java. Litego API documentation can be found here


Java 1.8 or later.


  • Gson Java library that can be used to convert Java Objects into their JSON representation.
  • OkHttp An HTTP & HTTP/2 client for Android and Java applications


To use litego-java as a dependency in your project, the easiest way right now is to clone and publish it locally. Simply run:

git clone
cd litego-java
mvn install

and then add to pom.xml



Creating an instance with test/live mode

Litego litego = new Litego(Mode.TEST_URL);


Litego litego = new Litego(Mode.LIVE_URL);

After registration on and getting secret key and merchant ID values try to authenticate (get auth token for other requests) Two ways how to get auth token:

  • secret key and merchant ID
  • refresh token (if exists).
AuthResponse authResponse = litego.authenticate(merchantId, secretKey);

or get new if expired

AuthTokenResponse tokenResponse = litego.refreshAuthToken(refreshToken);

You will get auth token and refresh token values. Auth token will be used then for other API requests. Refresh token should be saved for reauthentication when auth token is expired.

Create charge

ChargeResponse chargeResponse = litego.createCharge(authToken, description, amount_satoshi)

Charges list

ChargeListResponse chargeList = litego.chargesList(authToken, isPaid, page, pageSize);

Get charge

ChargeResponse charge = litego.getCharge(authToken, chargeId);

Get information about authenticated merchant

MerchantInfoResponse merchantInfo = getMerchantSummary(authToken);

Set withdrawal address

WithdrawalAddressResponse address = litego.setWithdrawalAddress(authToken, someAddress, Withdrawals.REGULAR_ADDRESS_TYPE);

Get withdrawal settings

WithdrawalSettingsResponse settingsResponse = litego.getWithdrawalSettings(authToken);

Request manual withdrawal

WithdrawalTransactionResponse transaction = litego.withdrawManually(authToken);

Withdrawals list

WithdrawalsListResponse withdrawalList = litego.getListWithdrawals(authToken);

Set webhook URL

NotificationResponse notification = litego.setNotificationUrl(authToken, "");

List responses from webhook

NotificationResponsesList responsesList = litego.getListOfNotificationResponses(authToken);

List referral payments

ReferralPaymentsResponse paymentsResponse = litego.getReferralPayments(authToken, page, pageSize);

Websocket subscriptions

You can subscribe to topics with payments of all your charges or a single charge by it's ID just registering event listeners, which are objects that implement an interface WebSocketListener.

Subscribe for payments

litego.addPaymentsEventSubscribeListener(Mode.TEST_URL, authToken, new WebSocketListener() {
    public void onMessage(WebSocket webSocket, String text) {
        System.out.println("Receive: " + text);

Subscribe for payment of single charge

litego.addPaymentsEventSubscribeListenerSingle(Mode.TEST_URL, authToken, "2f551fc0-1faa-11e9-90e2-df42b3b425c0", new WebSocketListener() {
    public void onMessage(WebSocket webSocket, String text) {
        System.out.println("Receive: " + text);