Guides
Add Payments to Your Dify Workflows
Connect Wallgent to Dify as a custom tool using the OpenAPI specification.
Prerequisites
- A Wallgent account and API key (get one here)
- A Dify workspace (cloud or self-hosted)
1. Add Wallgent as a Custom Tool
In the Dify dashboard:
- Go to Tools in the left sidebar
- Click Custom > Create Custom Tool
- Set the name to
Wallgent - Import the OpenAPI spec by pasting this URL:
https://api.wallgent.com/v1/openapi.json- Click Import to load all available operations
2. Configure Authentication
In the tool's Authentication settings:
- Auth Type: API Key
- Header Name:
Authorization - API Key:
Bearer wg_test_your_key_here
Click Save.
3. Use in an Agent
- Create a new Agent app in Dify
- Under Tools, enable the Wallgent custom tool
- Select the operations your agent should access (e.g.,
POST /v1/wallets,POST /v1/payments,GET /v1/wallets/{id}/balance) - Set the agent's system prompt:
You are a financial agent. Use the Wallgent tools to create wallets,
check balances, and send payments when asked.- Test in the preview panel: ask "Create a wallet called demo-agent and fund it with $100"
4. Use in a Workflow
For deterministic flows, add Wallgent as a Tool node in any Dify workflow:
- Create a new Workflow app
- Add a Tool node and select a Wallgent operation (e.g.,
send_payment) - Map the input variables from upstream nodes (e.g., wallet IDs and amount from a form input)
- Connect the output to downstream nodes for processing or display
Next Steps
- Explore spending policies to control agent budgets
- Set up webhooks so Dify can react to payment events
- See the full REST API Reference for all available endpoints