Overview
When a charge fails, the SDK returns an error to the agent instead of executing the tool. You can customize these messages to help agents resolve issues.Error Types
Error Verbosity
Control how detailed error messages are:Detailed Errors (default)
Concise Errors
Provider Name
SetproviderName to identify your service in error messages:
providerName, errors say “The provider has enabled…”.
Fail Open vs Fail Closed
What happens when Payo is unavailable?Fail Closed (default)
PLATFORM_UNAVAILABLE. Agents can’t use paid tools, but you don’t give away free calls.
Fail Open
Catching Errors in Your Tools
The SDK handles payment errors before your tool runs. But if your tool itself throws an error, it passes through normally:Custom Error Handling
For advanced use cases, catchPaymentError in your server:
Logging Errors
Enable debug logging to see error details:DEBUG- EverythingINFO- Charges and important eventsWARN- Warnings (missing tokens withfailOpen)ERROR- Errors onlyNONE- Silent
Example: Complete Configuration
Agent Experience
Design your error handling with agents in mind:Clear next steps
Clear next steps
Errors should tell agents exactly what to do: “Get a token at…”, “Deposit funds at…”.
Include pricing
Include pricing
Always mention the tool’s price so agents know the cost.
Support contact
Support contact
Include how to get help for persistent issues.
Don't leak internals
Don't leak internals
Error messages shouldn’t expose your implementation details or API key status.