Purchase Subscription with Wallet
POST /api/subscription/wallet/pay
Purchases the specified subscription plan using the wallet balance. An idempotency key is required to prevent duplicate charges.
Authentication
User console endpoint. Requires a logged-in user identity (session Cookie, or Authorization: Bearer <access_token>). This token is different from the sk- key used for model calls.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
plan_id | integer | Required | Subscription plan ID, must be greater than 0 |
idempotency_key | string | Required | Idempotency key to prevent duplicate charges |
Request Example
{
"plan_id": 1,
"idempotency_key": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Response Fields(200)
| Field Name | Type | Description |
|---|---|---|
success | boolean | Whether the request succeeded |
message | string | Message |
data | object | Purchase result (subscription details) |
Related subscription payment endpoints
- Claim a free plan:
POST /api/subscription/free/pay, body{ "plan_id": <integer> } - Renew with wallet:
POST /api/subscription/wallet/renew, body{ "subscription_id": <integer>, "idempotency_key": <string> } - Alipay top-up (belongs to the top-up module, not subscriptions):
POST /api/user/alipay/pay