PaymentError
All payment-related errors are instances ofPaymentError:
Properties
| Property | Type | Description |
|---|---|---|
message | string | Human-readable error message |
code | PaymentErrorCode | Machine-readable error code |
details | object | Additional context (optional) |
Usage
Error Codes
TOKEN_MISSING
Meaning: The agent didn’t provide a token. When: Agent calls a paid tool withoutAuthorization header or AGENT_TOKEN env var.
User Message (detailed):
TOKEN_INVALID
Meaning: The token exists but is invalid. When:- Token was deleted from dashboard
- Token is malformed
- Token doesn’t exist
INSUFFICIENT_BALANCE
Meaning: Agent doesn’t have enough credits. When: Agent’scredits_balance is less than the tool’s price.
User Message (detailed):
PLATFORM_UNAVAILABLE
Meaning: Payo platform couldn’t be reached. When:- Network error
- Payo is down
- Request timeout
- With
failOpen: false(default): Tool fails - With
failOpen: true: Tool executes without charging
CHARGE_FAILED
Meaning: Charge was rejected for another reason. When:- Provider API key is invalid
- Server-side validation error
- Unexpected platform error
Error Flow
Handling Errors in Agents
Agents receive errors as tool call failures. The error message tells them what to do:- Parse the error message
- Show it to the user or log it
- Not retry immediately (except for
PLATFORM_UNAVAILABLE)