Class Client.PayoutsClient
- Enclosing class:
- Client
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCancels a scheduled payout before execution (POST /payouts/cancel).Disables automatic payouts and switches to manual mode (POST /payouts/disable).Disables foreign exchange conversion for payouts (POST /payouts/disable_fx).enableFX()Enables foreign exchange conversion for payouts (POST /payouts/enable_fx).lookup(LookupPayoutParams params) page(PayoutPageParams params) Retrieves a paginated list of payouts (POST /payouts/page).schedule(SchedulePayoutParams params) setDestinations(Map<String, String> destinations) Configures payout destination financial accounts per currency (POST /payouts/set_destinations).settings()Retrieves current payout settings for your application (POST /payouts/settings).
-
Constructor Details
-
PayoutsClient
-
-
Method Details
-
setDestinations
public PayoutSettings setDestinations(Map<String, String> destinations) throws IOException, InterruptedException, ApiExceptionConfigures payout destination financial accounts per currency (POST /payouts/set_destinations).Maps each currency to a financial account ID where payouts in that currency should be sent. For example, map "ghs" to a Ghana mobile money account and "usd" to a US bank account. Payouts will automatically route to the appropriate destination based on the balance currency.
- Parameters:
destinations- map of currency codes to financial account IDs (e.g., {"ghs": "fa_123", "usd": "fa_456"})- Returns:
PayoutSettingswith updated payout settings- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if invalid account IDs, unsupported currencies, or accounts not compatible with currencies
-
settings
Retrieves current payout settings for your application (POST /payouts/settings).Returns payout schedule configuration (automatic or manual), destination mappings per currency, FX conversion settings, and any schedule-specific parameters.
- Returns:
PayoutSettingswith payout configuration- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if unauthorized (401)
-
disableAutomatic
Disables automatic payouts and switches to manual mode (POST /payouts/disable).Changes the payout schedule from automatic (e.g., weekly) to manual. In manual mode, payouts only occur when explicitly triggered by you. Use this when you need full control over when funds are transferred from your balance to your bank accounts.
- Returns:
PayoutSettingswith updated settings showing manual schedule- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if unauthorized (401) or already in manual mode
-
enableAutomatic
-
enableFX
Enables foreign exchange conversion for payouts (POST /payouts/enable_fx).Allows payouts to be converted from the balance currency to the destination account currency. For example, a GHS balance can be paid out to a USD bank account with automatic conversion. Exchange rates are applied at the time of payout execution.
- Returns:
PayoutSettingswith FX enabled in settings- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if unauthorized (401) or FX not supported for your account
-
disableFX
Disables foreign exchange conversion for payouts (POST /payouts/disable_fx).Prevents currency conversion during payouts. When disabled, payouts can only be sent to destination accounts that match the balance currency. Attempting to payout to a mismatched currency account will fail.
- Returns:
PayoutSettingswith FX disabled in settings- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if unauthorized (401)
-
page
public PayoutPage page(PayoutPageParams params) throws IOException, InterruptedException, ApiException Retrieves a paginated list of payouts (POST /payouts/page).Returns recent payouts with pagination support. Use
page_indexandpage_sizeto control pagination. Payouts are returned in reverse chronological order (newest first). Each payout includes amount, destination, status, and timestamps.- Parameters:
params- pagination parameters including page index and size- Returns:
PayoutPagecontaining list of payouts and pagination details- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if invalid pagination parameters (400) or unauthorized (401)
-
lookup
-
lookup
public Payout lookup(LookupPayoutParams params) throws IOException, InterruptedException, ApiException -
schedule
public Payout schedule(SchedulePayoutParams params) throws IOException, InterruptedException, ApiException -
cancel
Cancels a scheduled payout before execution (POST /payouts/cancel).Only payouts in
scheduledstatus with future execution windows can be canceled. Once canceled, the payout is permanently stopped.- Parameters:
payoutId- scheduled payout identifier- Returns:
Payoutcontaining the canceled payout- Throws:
IOException- if network communication failsInterruptedException- if the request is interruptedApiException- if payout cannot be canceled or request is invalid
-