Skip to main content

PaymentError

All payment-related errors are instances of PaymentError:

Properties

Usage


Error Codes

TOKEN_MISSING

Meaning: The agent didn’t provide a token. When: Agent calls a paid tool without Authorization header or AGENT_TOKEN env var. User Message (detailed):
Resolution: Agent must configure their token.

TOKEN_INVALID

Meaning: The token exists but is invalid. When:
  • Token was deleted from dashboard
  • Token is malformed
  • Token doesn’t exist
User Message:
Resolution: Agent must create a new token.

INSUFFICIENT_BALANCE

Meaning: Agent doesn’t have enough credits. When: Agent’s credits_balance is less than the tool’s price. User Message (detailed):
Details:
Resolution: Agent must deposit more funds.

PLATFORM_UNAVAILABLE

Meaning: Payo platform couldn’t be reached. When:
  • Network error
  • Payo is down
  • Request timeout
User Message:
Behavior:
  • With failOpen: false (default): Tool fails
  • With failOpen: true: Tool executes without charging
Resolution: Retry later or wait for Payo status update.

CHARGE_FAILED

Meaning: Charge was rejected for another reason. When:
  • Provider API key is invalid
  • Server-side validation error
  • Unexpected platform error
User Message:
Resolution: Provider should check their API key. If persistent, contact Payo support.

Error Flow


Handling Errors in Agents

Agents receive errors as tool call failures. The error message tells them what to do:
Well-behaved agents should:
  1. Parse the error message
  2. Show it to the user or log it
  3. Not retry immediately (except for PLATFORM_UNAVAILABLE)

Logging Errors

Enable logging to see error details:
Example log output:
Note: Tokens are automatically masked in logs.