Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.profy.cn/llms.txt

Use this file to discover all available pages before exploring further.

Finance & Payments

Profy uses a coin-based virtual currency system for all platform transactions. Users recharge coins through real-money payment channels and consume them for tasks, agent usage, and premium features.

Overview

Coin System

Coins are the universal unit of value on the platform. All billable operations deduct from the user’s coin balance.

Balance API

MethodEndpointAuthDescription
GET/api/finance/balanceJWTGet current coin balance
POST/api/finance/consumeJWTConsume coins for a service
POST/api/finance/preCheckJWTValidate balance before consumption
POST/api/finance/recordsJWTQuery consumption history

Consumption Types

TypeUse CaseBilling Model
TOKENAI agent token usagePer-token rate
DURATIONTime-based servicesPer-minute rate
FIXEDOne-time operationsFixed coin 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 coin balance by purchasing recharge plans through payment channels.

Recharge API

MethodEndpointAuthDescription
GET/api/finance/recharge/plansJWTList available recharge plans
GET/api/finance/recharge/previewJWTPreview order before payment
POST/api/finance/recharge/createJWTCreate a recharge order
GET/api/finance/recharge/status/:orderNoJWTCheck order status
POST/api/finance/recharge/summaryJWTRecharge summary statistics
POST/api/finance/recharge/recordsJWTRecharge history

Recharge Lifecycle

  1. User selects a recharge plan from the catalog
  2. System creates a recharge order and a linked payment order
  3. Payment channel returns a pay URL (QR code for WeChat Native Pay)
  4. User completes payment on the external channel
  5. Payment callback arrives at /api/payment/notify/:channel
  6. System credits coins to the user’s balance

Payment Channels

WeChat Pay

Profy integrates with WeChat Pay using the Native payment method (QR code scan) via wechatpay-node-v3.
Config VariableDescription
WECHAT_PAY_APP_IDWeChat application ID
WECHAT_PAY_MCH_IDMerchant ID
WECHAT_PAY_SERIAL_NOAPI certificate serial number
WECHAT_PAY_PRIVATE_KEYRSA private key for signing
WECHAT_PAY_API_V3_KEYAPIv3 key for callback decryption

Alipay

Alipay integration uses alipay-sdk as an alternative payment strategy.

Payment API

MethodEndpointAuthDescription
POST/api/payment/createJWTCreate a payment order
GET/api/payment/status/:outTradeNoJWTQuery payment status
POST/api/payment/close/:outTradeNoJWTClose an unpaid order
POST/api/payment/notify/:channelNoneCallback from payment provider

Payment Callback Flow

Service Plans

Service plans define tiered access levels for platform services (e.g., Expert agent tiers).
MethodEndpointAuthDescription
GET/api/finance/servicePlan/listJWTList plans by ?serviceCode=

Consumption Records

Users can view a detailed breakdown of their spending:
MethodEndpointAuthDescription
POST/api/consumption/summaryJWTAggregated spending summary
POST/api/consumption/recordsJWTDetailed transaction log

OpenAPI Consumption

The AutoExpert agent engine uses API Key authentication to consume credits programmatically:
MethodEndpointAuthDescription
POST/openapi/coin/consumeAPI KeyConsume coins on behalf of a user
POST/openapi/coin/preCheckAPI KeyPre-validate consumption
GET/openapi/coin/balanceAPI KeyQuery balance

Authentication

JWT and API Key auth for finance endpoints

Task Orchestration

Tasks consume coins through pay-to-view

Agent Platform

AutoExpert uses OpenAPI coin consumption for credit billing