Balance
What your sales left in the environment: what can be paid out, what is still pending, what a dispute holds and what is on its way out.
The balance is what the paid charges left in the environment, after fees, refunds, disputes and payouts. It is never stored: it is the sum of the ledger at the moment you read it.
Operations
| Operation in the contract | What it does |
|---|---|
getBalance | Returns the four balances of the environment. Requires the balance:read scope |
The route and the fields are in the OpenAPI contract, under this name. It is the same balance the dashboard shows in Saldo.
The four balances
Every amount is an integer number of cents.
| Field | What it is |
|---|---|
available_cents | What can leave in a payout now: what was paid, minus the fees, the refunds, the payouts, what a dispute holds and what is still pending |
pending_cents | The part of the balance that cannot leave in a payout yet: what the charges paid less than the release period ago left |
blocked_cents | What the bank holds because a payer disputed the payment, until it decides: the amount of the charges in dispute |
outgoing_cents | What already left the balance and the bank has not confirmed yet: the refunds on their way to the payers and the payouts on their way to you |
The four are read at the same instant: one is never from before an entry of the ledger and another from after it.
The release period
What a paid charge leaves is yours at once, and it can be paid out only after the release period of your account.
- Every account starts with a release period of 2 days, counted from the moment each charge was paid. The period is a setting of your account.
- A paid charge enters
pending_centsfirst. When its period ends, its amount moves toavailable_centsby itself, charge by charge. No event tells you: read the balance again. available_centspluspending_centsis what you have. A refund and a dispute take from the two together, so a charge can be refunded before its period ends.- Only a charge that is still
paidcounts. Arefundedordisputedcharge is not pending, and neither is one with a refund on its way: its amount already left the balance. pending_centsis never more than what the balance has. When a refund or a dispute of an older charge takes part of it, it shrinks, andavailable_centsstays at zero until what is left is released.
What changes it
| What happens | available_cents plus pending_cents | blocked_cents | outgoing_cents |
|---|---|---|---|
A charge becomes paid | Grows by the amount, minus the fee, in pending_cents | ||
| The release period of a charge ends | Stays the same: the amount moves from pending_cents to available_cents | ||
| A refund is asked for | Shrinks by what the refund takes | Grows by the amount of the refund | |
| The refund reaches the payer | Shrinks by the amount of the refund | ||
| The bank does not make the refund | Grows back | Shrinks by the amount of the refund | |
| The payer disputes a charge | Shrinks by what the dispute takes | Grows by the amount of the charge | |
| The bank refuses the dispute | Grows back | Shrinks by the amount of the charge | |
| The bank accepts the dispute | Shrinks by the amount of the charge |
- What a refund or a dispute takes from the balance depends on the fee rule of your account. See The amount and Disputes.
- A payout, asked for in the dashboard, moves its amount from
available_centstooutgoing_centsuntil the bank confirms it. A payout never takes frompending_cents. available_centscan be negative. A dispute takes its amount even when you already withdrew it, and the next sales cover it.- Read the balance again instead of keeping it. A
refund.createdor acharge.paidwebhook tells you it changed. See Webhooks.
What a key needs
balance:read. No other scope includes it: a key that creates and reads charges does not read the balance. See What a key can do.- A key created before the balance was in the API does not have it. A scope is never added to a key that exists: create another key in the dashboard.
- Without the scope the answer is
403with theinsufficient_scopecode.
What is not in the API
The statement, with each entry that changed the balance, and the payouts are in the dashboard, under Saldo. A payout asks for your passkey, and an API key cannot ask for one.
The balance of another environment
The balance is always the one of the environment of your key. There is no parameter to read another: a test key reads the test balance, and a live key the live one.