跳转到主要内容

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.

POST /credits/checkout

创建 Stripe Checkout 会话以购买积分套餐。需要登录后的 JWT 访问令牌。
**第三方集成:**请改用 POST /credits/checkout/api 并以 API Key 鉴权。

请求体

packageId
string
必填
要购买的套餐 ID,可用列表见 /credits/packages
successUrl
string
支付成功后的跳转 URL,默认回到控制台并带成功标记。
cancelUrl
string
用户取消支付时的跳转 URL,默认回到控制台并带取消标记。

响应

sessionId
string
Stripe Checkout 会话 ID。
url
string
Stripe 结账页 URL,请将用户重定向到此地址完成支付。
package
object
所选套餐详情。
curl -X POST https://api.llmgenerator.com/api/v1/credits/checkout \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
        "packageId": "pkg_pro",
        "successUrl": "https://example.com/success?session_id={CHECKOUT_SESSION_ID}",
        "cancelUrl": "https://example.com/cancel"
      }'
{
  "sessionId": "cs_test_a1b2c3d4e5f6g7h8i9j0",
  "url": "https://checkout.stripe.com/c/pay/cs_test_a1b2c3d4e5f6g7h8i9j0",
  "package": {
    "id": "pkg_pro",
    "name": "Pro Pack",
    "credits": 500,
    "priceCents": 1999
  }
}

POST /credits/checkout/api

使用 API Key 创建 Stripe Checkout 会话,适合第三方集成与外部应用。

认证

需要 API Key:
Authorization: Bearer llmgen_your_api_key_here

请求体

/credits/checkout 相同。

响应

/credits/checkout 相同。
curl -X POST https://api.llmgenerator.com/api/v1/credits/checkout/api \
  -H "Authorization: Bearer llmgen_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
        "packageId": "pkg_pro",
        "successUrl": "https://yourapp.com/success?session_id={CHECKOUT_SESSION_ID}",
        "cancelUrl": "https://yourapp.com/cancel"
      }'