メインコンテンツへスキップ
POST
/
subscriptions
/
portal
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..."
}

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 アクセストークン)が必要です。
サードパーティ連携: API キー認証で POST /subscriptions/portal/api を利用してください。

認証

Authorization
string
必須
JWT アクセストークン。形式: Bearer YOUR_ACCESS_TOKEN

リクエストボディ

returnUrl
string
ポータル終了後のリダイレクト 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..."
}

レスポンスフィールド

url
string
ユーザーがアクセスする URL。Stripe がホストする Billing Portal です。

ポータルでできること

Stripe Customer Portal ではユーザーは次が行えます。
機能説明
支払い方法カードの追加・更新・削除
請求書過去の請求書の閲覧とダウンロード
プラン変更サブスクのアップグレード/ダウングレード
解約サブスクの解約
請求履歴すべての請求・取引の閲覧

エラーレスポンス

400
不正なリクエスト — 請求用アカウントが見つからない場合。先に購入が必要です。
401
未認証 — トークンが無効または未指定です。
Billing Portal は、過去に購入済みまたはアクティブな契約があるユーザーのみ利用できます。新規ユーザーは Checkout エンドポイントを利用してください。

POST /subscriptions/portal/api

API キー認証で Stripe Customer Portal セッションを作成します。サードパーティ連携向けです。

認証

API キー認証が必要です。Authorization ヘッダーに API キーを付与します。
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"
  }'

運用上のヒント

  • 設定へのリンク: アプリ設定に「請求を管理」ボタンを置く
  • Checkout 後: 契約購入直後はポータルへ誘導するとよい
  • サポート: 請求に関するセルフサービスとしてポータルを案内する