Skip to main content

Balance Inquiry with the SDK

Follow these steps to install the SDK, authenticate, and query your balance.

1. Install the SDK

<dependency>
<groupId>com.pahappa.systems</groupId>
<artifactId>comms-sdk</artifactId>
<version>1.0.0</version>
</dependency>

2. Authenticate

Main.java
import com.pahappa.systems.commssdk.v1.CommsSDK;

// CommsSDK.useSandbox(); // Use this if you are using sandbox credentials.
String apiUsername = "api_username";
String apiKey = "api_key";
CommsSDK sdk = CommsSDK.authenticate(apiUsername, apiKey);

3. Query balance

Main.java
/* sdk.getBalance() returns a double value. */
double balance = sdk.getBalance();

/* sdk.queryBalance() returns an ApiResponse object with more fields. */
ApiResponse balanceQuery = sdk.queryBalance();
System.out.println(balanceQuery.status + " and balance: " + balanceQuery.balance);
note

For query-based methods, the returned object is of type ApiResponse. See ApiResponse.