Documentation Index
Fetch the complete documentation index at: https://docs.llmgenerator.com/llms.txt
Use this file to discover all available pages before exploring further.
创建 Stripe Customer Portal 会话,用户可在此:
- 更新支付方式
- 查看账单历史
- 更换订阅套餐
- 下载发票
- 取消订阅
需要 JWT 访问令牌(会话鉴权)。
**第三方集成:**请改用 POST /subscriptions/portal/api 并以 API Key 鉴权。
JWT 访问令牌。格式:Bearer YOUR_ACCESS_TOKEN
请求体
用户退出门户后的跳转 URL,默认返回应用控制台。
curl -X POST https://api.llmgenerator.com/api/v1/subscriptions/portal \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"returnUrl": "https://yourapp.com/settings/billing"
}'
{
"url": "https://billing.stripe.com/p/session/test_a1b2c3d4..."
}
响应字段
用户需跳转到的 Stripe 托管账单门户 URL。
门户能力
Stripe Customer Portal 支持用户:
| 功能 | 说明 |
|---|
| 支付方式 | 添加、更新或移除银行卡 |
| 发票 | 查看并下载历史发票 |
| 套餐变更 | 升级或降级订阅 |
| 取消订阅 | 取消订阅 |
| 账单历史 | 查看历史交易 |
错误响应
账单门户仅对已发生过购买或拥有活跃订阅的用户可用;新用户请使用结账接口。
POST /subscriptions/portal/api
使用 API Key 创建 Stripe Customer Portal 会话,适合第三方集成。
需要 API Key:
Authorization: Bearer llmgen_your_api_key_here
请求体
与 /subscriptions/portal 相同。
与 /subscriptions/portal 相同。
curl -X POST https://api.llmgenerator.com/api/v1/subscriptions/portal/api \
-H "Authorization: Bearer llmgen_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"returnUrl": "https://yourapp.com/settings/billing"
}'
最佳实践
- 设置页入口:在应用设置中提供「管理账单」按钮
- 结账后:订阅购买完成后可引导用户进入门户
- 客服:将门户作为账单问题的自助渠道