Get Wallet Balance Step
Use the get_wallet_balance step to read a PayMongo wallet’s available and pending balances for downstream workflow decisions.
The get_wallet_balance step reads a PayMongo wallet’s available and pending balances so later workflow steps can make transfer decisions.
Use its output in a compute step to drive a sweep, top-up, or threshold check.
Parameters
| Key | Type | Required | Description |
|---|---|---|---|
wallet_account | string | Yes | Wallet account number to query. Literal or ${...}. |
Outputs
| Field | Type | Description |
|---|---|---|
wallet_id | string | The PayMongo wallet ID corresponding to the account number. |
available_balance | int64 | Available balance in centavos. Subtract any reserve before sending it. |
pending_balance | int64 | Pending balance in centavos. Incoming funds that have not yet cleared. |
Centavos. Both balance fields are integers in centavos. PHP 1,000.00 reads back as100000.
Wallet ownership
The Workflow API validates that the wallet belongs to your organization before fetching the balance. Querying a wallet that does not belong to your organization returns the standard wallet not found error and does not leak the wallet's existence.
Example
Read the balance, sweep above a reserve floor.
version: 1
name: "scheduled-sweep"
description: "Sweep funds above a 20,000 PHP reserve to the parent wallet"
steps:
- name: "balance"
get_wallet_balance:
wallet_account: "${input.source_wallet}"
- name: "calc"
compute:
outputs:
# Keep PHP 20,000 (2,000,000 centavos) on the source wallet
to_sweep: "monetary_max(steps.balance.output.available_balance - 2000000, 0)"
- send_money:
source:
type: "wallet"
account: "${input.source_wallet}"
destination:
type: "wallet"
account: "${input.parent_wallet}"
account_name: "${input.parent_wallet_name}"
bic: "PAEYPHM2XXX"
provider: "paymongo"
amount: "${steps.calc.output.to_sweep}"
currency: "PHP"
notes: "Scheduled sweep"See Also
- Compute Step: derive sweep amounts from the balance.
- Schedule-Based Triggers: typical trigger for a recurring sweep.
- Sweep Wallets on a Schedule: the production-grade sweep pattern.
Updated about 5 hours ago