<div v-pre>

# Payment Management

Manage platform supported payment methods and view payment channel statistics.

## Payment Method Table

### Table Column Description

#### Status
Switch button to control whether payment method is enabled.

#### Name
Payment method name.

#### Type
Payment channel type:
- Alipay
- WeChat Pay
- PayPal
- Stripe
- Cryptocurrency

#### Configuration
View payment method configuration status.

#### Updated At
Last update time.

### Table Operations

#### Edit
Opens side drawer to modify payment config:
- API keys
- Merchant ID
- Callback URL
- Transaction fee rate
- Min/Max amount

#### Delete
Deletes payment method (requires confirmation).

#### Create Payment Method
Adds new payment channel.

## Payment Statistics Panel

Displays statistics for each payment method:

### Total Transaction Amount
Cumulative transaction amount for each method.

### Transaction Count
Number of transactions per method.

### Success Rate
Payment success rate statistics.

### Transaction Fees
Fees generated by each method.

## Payment Configuration Form

### Basic Information
- Payment method name
- Payment type
- Display icon
- Display order

### API Configuration
Different payment methods require different configs:

**Alipay**:
- App ID
- Merchant Private Key
- Alipay Public Key
- Callback URL

**WeChat Pay**:
- Merchant ID
- API Key
- App ID
- App Secret
- Certificate files

**PayPal**:
- Client ID
- Client Secret
- Sandbox mode

**Stripe**:
- Publishable Key
- Secret Key
- Webhook Secret

**Cryptocurrency**:
- Wallet address
- API key
- Confirmation blocks

### Transaction Settings
- Minimum payment amount
- Maximum payment amount
- Transaction fee rate
- Payment timeout

## Usage Scenarios

### Scenario 1: Configure Alipay

**Create Payment Method**:
- Name: Alipay
- Type: Alipay
- App ID: 2021xxx
- Merchant Private Key: [key content]
- Alipay Public Key: [key content]
- Callback URL: https://myvpn.com/callback/alipay
- Min Amount: ¥1
- Max Amount: ¥10000
- Fee Rate: 0.6%
- Status: Enabled

### Scenario 2: Configure Stripe

**Create Payment Method**:
- Name: Credit Card Payment
- Type: Stripe
- Publishable Key: pk_live_xxx
- Secret Key: sk_live_xxx
- Webhook Secret: whsec_xxx
- Callback URL: https://myvpn.com/callback/stripe
- Min Amount: $1
- Max Amount: $1000
- Fee Rate: 2.9% + $0.30
- Status: Enabled

### Scenario 3: Configure Cryptocurrency

**Create Payment Method**:
- Name: USDT Payment
- Type: Crypto
- Currency: USDT (TRC-20)
- Wallet Address: TXxx...
- API Key: [optional]
- Confirmation Blocks: 1
- Min Amount: 10 USDT
- Exchange Rate API: Real-time fetch
- Status: Enabled

## Payment Callback

### Callback Handling
Platform auto-handles payment callbacks:
1. Verify callback signature
2. Update order status
3. Credit user balance
4. Send notification email

### Callback Logs
View payment callback logs:
- Callback time
- Payment status
- Order information
- Error messages (if any)

## Important Notes

1. **Key Security**: Protect API keys and certificates
2. **Callback Verification**: Must verify callback signature to prevent forgery
3. **Test Environment**: Validate config in test environment first
4. **HTTPS Required**: Callback URLs must use HTTPS
5. **Transaction Fees**: Calculate fees properly to avoid losses
6. **Amount Limits**: Set reasonable min/max payment amounts
7. **Timeout Handling**: Set reasonable payment timeout
8. **Exchange Rates**: Crypto requires real-time rates
9. **Certificate Updates**: Regularly update payment certificates
10. **Backup Channels**: Configure multiple payment methods for availability

</div>
