Finance & Payments
Profy uses a credit-based virtual currency system for all platform transactions. Users recharge credits through real-money payment channels and consume them for tasks, agent usage, and premium features.Overview
Credit System
Credits are the universal unit of value on the platform. All billable operations deduct from the user’s credit balance.Balance API
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/finance/balance | JWT | Get current credit balance |
POST | /api/finance/consume | JWT | Consume credits for a service |
POST | /api/finance/preCheck | JWT | Validate balance before consumption |
POST | /api/finance/records | JWT | Query consumption history |
Consumption Types
| Type | Use Case | Billing Model |
|---|---|---|
TOKEN | AI agent token usage | Per-token rate |
DURATION | Time-based services | Per-minute rate |
FIXED | One-time operations | Fixed credit amount |
Idempotent Consumption
Every consumption request includes an idempotency key to prevent duplicate charges. The system checks Redis before processing:Recharge Flow
Users top up their credit balance by purchasing recharge plans through payment channels.Recharge API
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/finance/recharge/plans | JWT | List available recharge plans |
GET | /api/finance/recharge/preview | JWT | Preview order before payment |
POST | /api/finance/recharge/create | JWT | Create a recharge order |
GET | /api/finance/recharge/status/:orderNo | JWT | Check order status |
POST | /api/finance/recharge/summary | JWT | Recharge summary statistics |
POST | /api/finance/recharge/records | JWT | Recharge history |
Recharge Lifecycle
- User selects a recharge plan from the catalog
- System creates a recharge order and a linked payment order
- Payment channel returns a pay URL (QR code for WeChat Native Pay)
- User completes payment on the external channel
- Payment callback arrives at
/api/payment/notify/:channel - System credits the amount to the user’s balance
Payment Channels
WeChat Pay
Profy integrates with WeChat Pay using the Native payment method (QR code scan) viawechatpay-node-v3.
| Config Variable | Description |
|---|---|
WECHAT_PAY_APP_ID | WeChat application ID |
WECHAT_PAY_MCH_ID | Merchant ID |
WECHAT_PAY_SERIAL_NO | API certificate serial number |
WECHAT_PAY_PRIVATE_KEY | RSA private key for signing |
WECHAT_PAY_API_V3_KEY | APIv3 key for callback decryption |
Alipay
Alipay integration usesalipay-sdk as an alternative payment strategy.
Payment API
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST | /api/payment/create | JWT | Create a payment order |
GET | /api/payment/status/:outTradeNo | JWT | Query payment status |
POST | /api/payment/close/:outTradeNo | JWT | Close an unpaid order |
POST | /api/payment/notify/:channel | None | Callback from payment provider |
Payment Callback Flow
Service Plans
Service plans define tiered access levels for platform services (e.g., Expert agent tiers).| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET | /api/finance/servicePlan/list | JWT | List plans by ?serviceCode= |
Consumption Records
Users can view a detailed breakdown of their spending:| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST | /api/consumption/summary | JWT | Aggregated spending summary |
POST | /api/consumption/records | JWT | Detailed transaction log |
OpenAPI Consumption
The AutoExpert agent engine uses API Key authentication to consume credits programmatically:| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST | /openapi/credit/consume | API Key | Consume credits on behalf of a user |
POST | /openapi/credit/preCheck | API Key | Pre-validate consumption |
GET | /openapi/credit/balance | API Key | Query balance |
Related Pages
Authentication
JWT and API Key auth for finance endpoints
Task Orchestration
Tasks consume credits through pay-to-view
Agent Platform
AutoExpert uses OpenAPI credit consumption for billing

