請求とサブスクリプション
Traeの請求システム、プラン、サブスクリプション管理について理解しましょう。
概要
Traeは柔軟な請求システムを提供し、個人開発者から大企業まで対応できます:
- 無料プラン: 基本機能とAI使用量制限
- プロプラン: 高度な機能と増加したAI使用量
- チームプラン: コラボレーション機能とチーム管理
- エンタープライズプラン: カスタムソリューションと専用サポート
プランの比較
無料プラン
- ✅ 基本的なコード編集
- ✅ 限定的なAI支援(月間100リクエスト)
- ✅ 基本的なGit統合
- ✅ コミュニティサポート
- ❌ 高度なAI機能
- ❌ チームコラボレーション
- ❌ 優先サポート
プロプラン(月額$19)
- ✅ 無料プランのすべて
- ✅ 無制限のAI支援
- ✅ 高度なコード生成
- ✅ カスタムテーマ
- ✅ 優先サポート
- ✅ 高度なデバッグツール
- ❌ チーム機能
チームプラン(ユーザーあたり月額$39)
- ✅ プロプランのすべて
- ✅ チームワークスペース
- ✅ 共有プロジェクト
- ✅ チーム分析
- ✅ 役割ベースのアクセス制御
- ✅ チーム請求管理
エンタープライズプラン(カスタム価格)
- ✅ チームプランのすべて
- ✅ SSO統合
- ✅ 高度なセキュリティ
- ✅ カスタム統合
- ✅ 専用アカウントマネージャー
- ✅ SLA保証
サブスクリプション管理
プランのアップグレード
設定にアクセス:
設定 > アカウント > サブスクリプションプランを選択:
- 現在のプランと使用量を確認
- 利用可能なプランを比較
- 適切なプランを選択
支払い情報:
- クレジットカード情報を入力
- 請求先住所を設定
- 支払い方法を確認
確認とアクティベーション:
- プラン詳細を確認
- 利用規約に同意
- サブスクリプションをアクティベート
プランのダウングレード
- 現在のサブスクリプションにアクセス
- プラン変更を選択
- ダウングレードオプションを選択
- 変更を確認
注意: ダウングレードは次の請求サイクルから有効になります。
サブスクリプションのキャンセル
- 設定 > アカウント > サブスクリプション
- 「サブスクリプションをキャンセル」をクリック
- キャンセル理由を選択(オプション)
- キャンセルを確認
キャンセル後も、現在の請求期間の終了まで機能にアクセスできます。
請求管理
請求履歴の表示
typescript
// 請求履歴にアクセス
設定 > アカウント > 請求履歴請求履歴では以下を確認できます:
- 過去の請求書
- 支払い状況
- 使用量の詳細
- 税金情報
請求書のダウンロード
- 請求履歴にアクセス
- ダウンロードしたい請求書を選択
- 「PDFをダウンロード」をクリック
支払い方法の管理
クレジットカードの追加
typescript
// 新しい支払い方法を追加
const addPaymentMethod = async (cardDetails) => {
try {
const response = await fetch('/api/payment-methods', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
type: 'credit_card',
card_number: cardDetails.number,
exp_month: cardDetails.expMonth,
exp_year: cardDetails.expYear,
cvc: cardDetails.cvc,
name: cardDetails.name
})
});
if (response.ok) {
console.log('支払い方法が追加されました');
}
} catch (error) {
console.error('支払い方法の追加に失敗しました:', error);
}
};デフォルト支払い方法の設定
- 設定 > アカウント > 支払い方法
- 使用したい支払い方法を選択
- 「デフォルトに設定」をクリック
請求先住所の管理
typescript
// 請求先住所を更新
const updateBillingAddress = async (address) => {
try {
const response = await fetch('/api/billing-address', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
street: address.street,
city: address.city,
state: address.state,
postal_code: address.postalCode,
country: address.country,
tax_id: address.taxId // オプション
})
});
if (response.ok) {
console.log('請求先住所が更新されました');
}
} catch (error) {
console.error('請求先住所の更新に失敗しました:', error);
}
};使用量の監視
AI使用量の追跡
typescript
// 現在の使用量を取得
const getUsageStats = async () => {
try {
const response = await fetch('/api/usage', {
headers: {
'Authorization': `Bearer ${token}`
}
});
const usage = await response.json();
return {
aiRequests: usage.ai_requests,
codeGeneration: usage.code_generation,
monthlyLimit: usage.monthly_limit,
resetDate: usage.reset_date
};
} catch (error) {
console.error('使用量の取得に失敗しました:', error);
}
};
// 使用量アラートの設定
const setUsageAlert = async (threshold) => {
try {
const response = await fetch('/api/usage-alerts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
threshold: threshold, // 80% など
notification_type: 'email'
})
});
if (response.ok) {
console.log('使用量アラートが設定されました');
}
} catch (error) {
console.error('使用量アラートの設定に失敗しました:', error);
}
};使用量ダッシュボード
使用量ダッシュボードでは以下を監視できます:
- AIリクエスト数: 月間のAI支援リクエスト数
- コード生成: 生成されたコード行数
- ストレージ使用量: プロジェクトファイルのストレージ
- 帯域幅: データ転送量
チーム請求
チーム請求の設定
typescript
// チーム請求を有効化
const enableTeamBilling = async (teamId) => {
try {
const response = await fetch(`/api/teams/${teamId}/billing`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
billing_email: 'billing@company.com',
payment_method_id: 'pm_1234567890',
billing_address: {
company: '株式会社サンプル',
street: '東京都渋谷区1-1-1',
city: '渋谷区',
state: '東京都',
postal_code: '150-0001',
country: 'JP'
}
})
});
if (response.ok) {
console.log('チーム請求が有効化されました');
}
} catch (error) {
console.error('チーム請求の設定に失敗しました:', error);
}
};チームメンバーの管理
typescript
// チームメンバーを追加
const addTeamMember = async (teamId, memberEmail, role) => {
try {
const response = await fetch(`/api/teams/${teamId}/members`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
email: memberEmail,
role: role, // 'admin', 'member', 'viewer'
send_invitation: true
})
});
if (response.ok) {
console.log('チームメンバーが追加されました');
}
} catch (error) {
console.error('チームメンバーの追加に失敗しました:', error);
}
};
// チームメンバーを削除
const removeTeamMember = async (teamId, memberId) => {
try {
const response = await fetch(`/api/teams/${teamId}/members/${memberId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
}
});
if (response.ok) {
console.log('チームメンバーが削除されました');
}
} catch (error) {
console.error('チームメンバーの削除に失敗しました:', error);
}
};税金と法的事項
税金の処理
Traeは以下の税金を自動的に計算します:
- 消費税(日本): 10%
- VAT(EU): 国によって異なる
- GST(カナダ、オーストラリア): 地域によって異なる
- 売上税(米国): 州によって異なる
税務書類
typescript
// 税務書類を取得
const getTaxDocuments = async (year) => {
try {
const response = await fetch(`/api/tax-documents/${year}`, {
headers: {
'Authorization': `Bearer ${token}`
}
});
const documents = await response.json();
return documents.map(doc => ({
type: doc.type, // 'invoice', 'receipt', 'tax_summary'
date: doc.date,
amount: doc.amount,
downloadUrl: doc.download_url
}));
} catch (error) {
console.error('税務書類の取得に失敗しました:', error);
}
};法人アカウント
法人アカウントでは以下の追加機能があります:
- 会社情報の管理
- 複数の請求先住所
- 購買発注書の統合
- カスタム支払い条件
typescript
// 法人アカウントを設定
const setupCorporateAccount = async (companyInfo) => {
try {
const response = await fetch('/api/corporate-account', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
body: JSON.stringify({
company_name: companyInfo.name,
tax_id: companyInfo.taxId,
industry: companyInfo.industry,
employee_count: companyInfo.employeeCount,
billing_contact: {
name: companyInfo.billingContact.name,
email: companyInfo.billingContact.email,
phone: companyInfo.billingContact.phone
},
payment_terms: companyInfo.paymentTerms // 'net_30', 'net_60', etc.
})
});
if (response.ok) {
console.log('法人アカウントが設定されました');
}
} catch (error) {
console.error('法人アカウントの設定に失敗しました:', error);
}
};API統合
請求APIの使用
typescript
// 請求API クライアント
class BillingAPI {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://api.trae.ai/v1';
}
async getSubscription() {
const response = await fetch(`${this.baseUrl}/subscription`, {
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json'
}
});
return response.json();
}
async updateSubscription(planId) {
const response = await fetch(`${this.baseUrl}/subscription`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${this.apiKey}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ plan_id: planId })
});
return response.json();
}
async getInvoices(limit = 10) {
const response = await fetch(`${this.baseUrl}/invoices?limit=${limit}`, {
headers: {
'Authorization': `Bearer ${this.apiKey}`
}
});
return response.json();
}
async getUsage(startDate, endDate) {
const params = new URLSearchParams({
start_date: startDate,
end_date: endDate
});
const response = await fetch(`${this.baseUrl}/usage?${params}`, {
headers: {
'Authorization': `Bearer ${this.apiKey}`
}
});
return response.json();
}
}
// 使用例
const billing = new BillingAPI('your-api-key');
// 現在のサブスクリプションを取得
const subscription = await billing.getSubscription();
console.log('現在のプラン:', subscription.plan.name);
// 使用量を取得
const usage = await billing.getUsage('2024-01-01', '2024-01-31');
console.log('AI使用量:', usage.ai_requests);Webhookの設定
typescript
// Webhook エンドポイントの設定
app.post('/webhooks/billing', express.raw({type: 'application/json'}), (req, res) => {
const sig = req.headers['stripe-signature'];
let event;
try {
event = stripe.webhooks.constructEvent(req.body, sig, process.env.WEBHOOK_SECRET);
} catch (err) {
console.log(`Webhook署名の検証に失敗しました: ${err.message}`);
return res.status(400).send(`Webhook Error: ${err.message}`);
}
// イベントの処理
switch (event.type) {
case 'invoice.payment_succeeded':
console.log('支払いが成功しました:', event.data.object);
// ユーザーのサブスクリプション状態を更新
break;
case 'invoice.payment_failed':
console.log('支払いが失敗しました:', event.data.object);
// ユーザーに通知を送信
break;
case 'customer.subscription.updated':
console.log('サブスクリプションが更新されました:', event.data.object);
// プラン変更を処理
break;
case 'customer.subscription.deleted':
console.log('サブスクリプションがキャンセルされました:', event.data.object);
// アカウントを無料プランにダウングレード
break;
default:
console.log(`未処理のイベントタイプ: ${event.type}`);
}
res.json({received: true});
});トラブルシューティング
よくある請求問題
支払いの失敗
原因:
- カードの有効期限切れ
- 残高不足
- カードの制限
解決方法:
- 支払い方法を確認
- カード情報を更新
- 別の支払い方法を追加
請求書が見つからない
解決方法:
- 請求履歴を確認
- スパムフォルダを確認
- 請求メールアドレスを確認
プランの変更が反映されない
解決方法:
- ブラウザを更新
- ログアウト/ログイン
- サポートに連絡
サポートへの連絡
請求に関する問題がある場合:
- メール: billing@trae.ai
- チャット: アプリ内サポートチャット
- 電話: +1-555-TRAE-HELP(プロプラン以上)
セキュリティ
支払い情報のセキュリティ
- PCI DSS準拠: すべての支払い処理はPCI DSS準拠
- 暗号化: すべてのデータは転送時と保存時に暗号化
- トークン化: カード情報は安全にトークン化
データ保護
typescript
// 支払い情報の暗号化例
const encryptPaymentData = (paymentData) => {
const cipher = crypto.createCipher('aes-256-cbc', process.env.ENCRYPTION_KEY);
let encrypted = cipher.update(JSON.stringify(paymentData), 'utf8', 'hex');
encrypted += cipher.final('hex');
return encrypted;
};
// 支払い情報の復号化例
const decryptPaymentData = (encryptedData) => {
const decipher = crypto.createDecipher('aes-256-cbc', process.env.ENCRYPTION_KEY);
let decrypted = decipher.update(encryptedData, 'hex', 'utf8');
decrypted += decipher.final('utf8');
return JSON.parse(decrypted);
};まとめ
Traeの請求システムは:
- 柔軟: 様々なプランとオプション
- 透明: 明確な価格設定と使用量追跡
- 安全: 業界標準のセキュリティ
- サポート: 包括的なサポートとドキュメント
適切なプランを選択し、請求を効率的に管理して、Traeを最大限に活用しましょう。