Read the Prepaid Balance
const url = 'https://api.voltpay.space/v1/balance';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.voltpay.space/v1/balance \ --header 'Authorization: Bearer <token>'Test mode is free and has no Prepaid Balance, so a gw_test_ key reads state as not_billed.
Authorizations
Section titled “Authorizations”Responses
Section titled “Responses”The Prepaid Balance, the Available Balance and the state.
object
ok covers new Checkouts. low is below the Merchant’s threshold. empty means new live Checkouts
are refused. not_billed is Test mode, which is free and has no Prepaid Balance.
The Merchant’s credit, to one micro-USD. It can go slightly negative, and the next Recharge covers that.
The part of the Prepaid Balance set aside for open Checkouts.
The Prepaid Balance minus every Hold, so it can be negative. A new live Checkout needs enough of it.
The Available Balance below which balance.low is sent.
Example
{ "mode": "live", "state": "ok", "prepaid_balance": "120.500000", "held_amount": "0.850000", "available_balance": "119.650000", "low_balance_threshold": "20.000000"}INVALID_API_KEY: the key is missing, wrong or revoked.
object
object
The stable identifier a client branches on.
For people. May be reworded, so never branch on it.
More about the failure. For VALIDATION_ERROR, a map of field name to reason.
object
Only with CHECKOUT_LIMIT_EXCEEDED. The largest Checkout the Merchant may create now, in micro-USD.
Examples
{ "error": { "code": "INVALID_API_KEY", "message": "The API key is missing, wrong or revoked.", "request_id": "req_01J9…" }}MERCHANT_SUSPENDED: Staff have suspended the Merchant.
object
object
The stable identifier a client branches on.
For people. May be reworded, so never branch on it.
More about the failure. For VALIDATION_ERROR, a map of field name to reason.
object
Only with CHECKOUT_LIMIT_EXCEEDED. The largest Checkout the Merchant may create now, in micro-USD.
Examples
{ "error": { "code": "MERCHANT_SUSPENDED", "message": "This account is suspended. Contact support.", "request_id": "req_01J9…" }}RATE_LIMITED: back off, per Retry-After.
object
object
The stable identifier a client branches on.
For people. May be reworded, so never branch on it.
More about the failure. For VALIDATION_ERROR, a map of field name to reason.
object
Only with CHECKOUT_LIMIT_EXCEEDED. The largest Checkout the Merchant may create now, in micro-USD.
Examples
{ "error": { "code": "RATE_LIMITED", "message": "Too many requests. Wait for the time in Retry-After, then try again.", "request_id": "req_01J9…" }}Headers
Section titled “Headers”Seconds to wait before trying again.
INTERNAL: an unexpected failure. Quote request_id when reporting it.
object
object
The stable identifier a client branches on.
For people. May be reworded, so never branch on it.
More about the failure. For VALIDATION_ERROR, a map of field name to reason.
object
Only with CHECKOUT_LIMIT_EXCEEDED. The largest Checkout the Merchant may create now, in micro-USD.
Examples
{ "error": { "code": "INTERNAL", "message": "Something went wrong on our side. Quote the request id if this continues.", "request_id": "req_01J9…" }}TRY_AGAIN: a time limit cut the request short and nothing was committed.
object
object
The stable identifier a client branches on.
For people. May be reworded, so never branch on it.
More about the failure. For VALIDATION_ERROR, a map of field name to reason.
object
Only with CHECKOUT_LIMIT_EXCEEDED. The largest Checkout the Merchant may create now, in micro-USD.
Examples
{ "error": { "code": "TRY_AGAIN", "message": "Nothing was committed. Try the request again.", "request_id": "req_01J9…" }}Headers
Section titled “Headers”Seconds to wait before trying again.