Files
cozsweet-frontend-nextjs/docs/backend/plans.md
T
2026-06-30 10:49:14 +08:00

34 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
GET https://proapi.banlv-ai.com/api/payment/plans
结果:
status=200
success=true
plans 数量 8
VIP 套餐 3 个
credits 套餐 5 个
snake_keys=[],已经没有 plan_id / amount_cents 这种字段
schema 校验通过:proapi_plans_camel_schema_ok true
前端按这个结构用:
type PaymentPlan = {
planId: string;
planName: string;
orderType: 'vip_monthly' | 'vip_quarterly' | 'vip_annual' | 'dol';
vipDays: number | null;
dolAmount: number | null;
creditBalance: number;
amountCents: number;
originalAmountCents: number | null;
dailyPriceCents: number | null;
currency: string;
};
分组:
const plans = res.data.plans;
const vipPlans = plans.filter(p => p.vipDays !== null);
const creditPlans = plans.filter(p => p.dolAmount !== null);
下单仍然传 planId
{
"planId": "vip_monthly",
"payChannel": "stripe",
"autoRenew": true
}
价格、币种全部以前端拿到的 amountCents / currency 展示,不要写死。当前我这边访问 pro 返回的是 JPY,这是 Cloudflare 根据访问 IP 判的国家币种。